0

I'm following the gtkmm tutorial for gtkmm4 and I'm getting an odd error when I try to run my program. The program is an exact copy of the provided code, and it compiles successfully: enter image description here

However, when I run the program it gives me a series of errors: enter image description here enter image description here enter image description here enter image description here

I'm not sure what to do at this point. I've tried googling, but I don't get anything helpful. I've check that the DLL in question does exist. Any advice is appreciated!

Edit: I ran the Dependency Walker program, and got some errors, not sure what this means though.

enter image description here

Edit2: I did some research on Dependency Walker, and it seems to have some known issues, so I also ran lucasg's "Dependencys" program, with this output. I'm still not really sure what this means, but it seems fine.

enter image description here

Edit3: I moved the 4 offending dll files into the build directory, and these are the new errors I'm getting. Its the same error, but now it points to the more local file.

enter image description here enter image description here enter image description here enter image description here enter image description here

Zico
  • 127
  • 16
  • 1
    See the section on DLL debugging [here](https://stackoverflow.com/a/64396980/2752075). That's for a different library, but should apply here too. – HolyBlackCat Apr 13 '22 at 07:13
  • 1
    Did you manually modify MSYS2 installation in any way, except for `pacman`? Did you run `make install` for any libraries? – HolyBlackCat Apr 13 '22 at 07:18
  • 1
    If you didn't, are you using MSYS2 with the default PATH, or you've configured it to inherit system PATH? If you do inherit (or modify) PATH, stop doing that. If you don't, check if any DLLs in `/mingw64/bin` also exist in `C:\Windows` (including subdirectories). If you find any overlaps, delete them from the latter location. – HolyBlackCat Apr 13 '22 at 07:18
  • @HolyBlackCat Thanks for the DLL debugging section! Based on that, It sounds like the DLLs are somehow wrong? I tried to copy the DLLS from my MSYS mingw64 folder into the build folder, but it didn't help. It did change the error message to have the new DLL location though, so I think I copied the files correctly. As for your questions, I only used pacman (no make install), I haven't messed with the PATH, and I didn't find any DLLS in the C:\Windows folder. Is there anything else I should try to get more information? – Zico Apr 14 '22 at 19:10
  • 1
    Most of the problems described in that post shouldn't happen in MSYS2. So how exactly did you install gtkmm and other libraries? – HolyBlackCat Apr 14 '22 at 19:34
  • I followed the tutorial [here](https://wiki.gnome.org/Projects/gtkmm/MSWindows) and installed everything using pacman. As to how I installed MSYS2, it was so long ago I can't say. Might it be worth a fill reinstall of MSYS2? – Zico Apr 14 '22 at 19:42
  • One thing to note I guess is that I did install both gtkmm 3 and 4. Perhaps that could be causing issues? I'll try to uninstall gtkmm 3 and see if that fixes anything – Zico Apr 14 '22 at 19:52
  • 1
    Ah. I didn't notice that you were running your program **outside** of MSYS2. Yes, you're supposed to copy those DLLs. Please show the new errors you got. – HolyBlackCat Apr 14 '22 at 20:00
  • @HolyBlackCat I've added the images to the post. Its the same error, but it points to the more local file now. – Zico Apr 14 '22 at 20:09
  • 1
    Please read the link in my first comment again. It explains what DLLs to copy. Start reading from "For ntldd algorithm is". – HolyBlackCat Apr 14 '22 at 20:21
  • Oh wow yeah that did it! I missed the part where I had to copy ALL the DLLs, not just the ones that were erroring – Zico Apr 14 '22 at 21:10
  • @HolyBlackCat Thanks for the help! If you post an answer I'll mark it as the solution. – Zico Apr 14 '22 at 21:10
  • 1
    You're welcome! I don't think I'm going to post one, since I already have that answer I linked... You can post one yourself though, if you want to. – HolyBlackCat Apr 14 '22 at 21:12
  • Understandable, I'll do that just in case anyone else has this problem. – Zico Apr 14 '22 at 21:23

2 Answers2

1

Check your .exe file with Dependency Walker to see which issues there are loading the .dll files.

One possible cause could be that you're mixing 32-bit and 64-bit.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40
  • Thanks for letting me know about that! I ran the program, but I'm not really sure what its telling me. Clearly, something is wrong though. I made an edit with the output, does it tell you anything? – Zico Apr 14 '22 at 19:02
  • 1
    It clearly says you're mixing CPUs, meaning you're mixing 32 and 64 bit. – Brecht Sanders Apr 15 '22 at 06:24
  • How do I fix that? I was able to get it to work by copying DLLS from C:\msys64\mingw64\bin into the build directory, but I'm not sure why it wasn't able to find the correct DLLS on its own in the first place. Is there a compiler flag I should be setting here? – Zico Apr 18 '22 at 20:25
1

The issue was something to do with finding the correct DLLs. The solution, as outlined here, is to copy all the DLLs from C:\msys64\mingw64\bin into the build directory. Then, using ntldd or some other profiler, determine which DLLs are unnecessary and remove them.

Zico
  • 127
  • 16
  • 1
    The `copypedeps -r` command from https://github.com/brechtsanders/pedeps can be used to copy only those `.dll` files that are used by your `.exe` (or `.dll`) file(s). – Brecht Sanders Apr 19 '22 at 07:56