MINGW-packages: [gtk3] Missing several static GTK files (.a)

Hi,

The GTK packages (like mingw-w64-x86_64-gtk3), contains both the dynamic and static libs, respectively .dll.a and .a.

However, there are no static libs (so .a without .dll in the name) for the following 3 files?? :

  • gtk-3
  • gdk-3
  • gdk_pixbuf-2.0

So all other libraries are successfully found without issues, expect those 3 libraries above.

As you can see below, Gtkmm does have .a file (libgtkmm-3.0.a), while the libgtk-3.a file is missing completely?..

/mingw64/lib
❯ ll | grep gtk
drwxr-xr-x  3 root root      4096 Sep  9 13:07 gtk-3.0/
drwxr-xr-x  4 root root      4096 Sep  9 13:07 gtkmm-3.0/
-rw-rw-r--  1 root root   3047908 Aug 28 11:34 libgtk-3.dll.a
-rw-rw-r--  1 root root  11239588 Aug 27 15:51 libgtkmm-3.0.a
-rw-rw-r--  1 root root  11794490 Aug 27 15:51 libgtkmm-3.0.dll.a

See the error I get during a cross-compile on Linux towards Windows:

Missing libs

TLDR; Please add the remaining .a files to the GTK package(s), so static cross-compiling will work out of the box.

Regards, Melroy van den Berg

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

* For shared build, I have used this `g++ $(pkg-config -cflags gtkmm-3.0) test.cpp $(pkg-config -libs gtkmm-3.0)`.

* For static build, if I use `--static` option with pkgconfig then g++ says command is too long. So, I agree with with what Jeremy said "with static libs you are responsible for linking all the dependencies yourself".

* And about the multiple DllMain definition issue, it also appears with libatk-1.0.a file. Every gtk libraries need some kind of fix for that which I don't know.

After some work in MXE. I though I will give some information here as well.

The DllMain issue in some GTK packages are solved via separate .patch files by the MXE community. One example: https://github.com/mxe/mxe/blob/master/src/atk-1-DllMain.patch

Regarding the static build. Just make a simple Makefile and use Autotools via ./configure --host=i686-w64-mingw32.static --enable-static. Were you may need to change the host to your value (since is copied from MXE).

  • For shared build, I have used this g++ $(pkg-config -cflags gtkmm-3.0) test.cpp $(pkg-config -libs gtkmm-3.0).
  • For static build, if I use --static option with pkgconfig then g++ says command is too long. So, I agree with with what Jeremy said “with static libs you are responsible for linking all the dependencies yourself”.
  • And about the multiple DllMain definition issue, it also appears with libatk-1.0.a file. Every gtk libraries need some kind of fix for that which I don’t know.

not trying to blame, just starting with the simplest explanation first.

Yeah, with static libs you are responsible for linking all the dependencies yourself, rather than having the DLL depend on them all. Nice packages will tell everything they need via pkg-config --static --libs. Not so nice packages leave you to figure it out for yourself 😉

Seems kind of problematic if DllMain is being included in the static libs

Hi! @danger89 Thanks for the report. I have added a pull request here https://github.com/msys2/MINGW-packages/pull/9558 which adds the static library. Would you like to check the package from that PR’s CI artifacts? BTW, I am not sure if these mingw packages are supposed to be used in GNU/Linux cross build environment.