Closed melroy89 closed 2 years ago
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.
Thank god for acting so fast! To be honest I'm busing trying to cross-compile my GTK app for about 1 week now. Good to see my road blocks are taken away.
I will check the package.. I think I can use those packages, as long as I put the files in the /mingw64
directory in the root directory of host GNU/Linux.
With the current build, I'm getting now:
/usr/bin/x86_64-w64-mingw32-g++-posix -static -Os -Wno-attributes -static -Os -Wno-attributes -Wall -Wextra -O3 -DNDEBUG -O3 -DNDEBUG src/CMakeFiles/libreweb-browser.dir/main.cc.obj src/CMakeFiles/libreweb-browser.dir/about.cc.obj src/CMakeFiles/libreweb-browser.dir/draw.cc.obj src/CMakeFiles/libreweb-browser.dir/file.cc.obj src/CMakeFiles/libreweb-browser.dir/ipfs.cc.obj src/CMakeFiles/libreweb-browser.dir/mainwindow.cc.obj src/CMakeFiles/libreweb-browser.dir/md-parser.cc.obj src/CMakeFiles/libreweb-browser.dir/menu.cc.obj src/CMakeFiles/libreweb-browser.dir/option-group.cc.obj src/CMakeFiles/libreweb-browser.dir/source-code-dialog.cc.obj -o bin/libreweb-browser.exe -Wl,--out-implib,src/liblibreweb-browser.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -L/mingw64/lib lib/commonmarker/src/libLibCommonMarker.a lib/commonmarker/extensions/libLibCommonMarkerExtensions.a lib/ipfs-http-client/libipfs-http-client.a lib/whereami/libwhereami.a -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lgtk-3 -lgdk-3 -lz -lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lpangowin32-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl lib/commonmarker/src/libLibCommonMarker.a /mingw64/lib/libcurl.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
/usr/bin/x86_64-w64-mingw32-ld: /mingw64/lib/libgdk-3.a(gdkmain-win32.c.obj):gdkmain-win32.:(.text+0xd0): multiple definition of `DllMain'; /mingw64/lib/libgtk-3.a(gtkwin32.c.obj):gtkwin32.c:(.text+0x50): first defined here
/usr/bin/x86_64-w64-mingw32-ld: /mingw64/lib/libatk-1.0.a(atkprivate.c.obj):(.text+0x0): multiple definition of `DllMain'; /mingw64/lib/libgtk-3.a(gtkwin32.c.obj):gtkwin32.c:(.text+0x50): first defined here
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk_pixbuf-2.0
collect2: error: ld returned 1 exit status
EDIT: So gdk_pixelbuf-2.0 is still missing. The error I see, could be maybe because I copied over the files from your package to MY existing files. eg. libatk-1.0.a
was the file I already have via msys2, but I also NEED that library for my GTK build.
What I try to say is, if you really want me to test your package in isolation, I need the full gtk stack.
What are the other packages in your "full gtk stack"?
Seems kind of problematic if DllMain is being included in the static libs
What are the other packages in your "full gtk stack"?
Well all the deps of all the deps of all deps (of.. all.. the deps..) of https://packages.msys2.org/package/mingw-w64-x86_64-gtkmm3 (GTK for C++).
Seems kind of problematic if DllMain is being included in the static libs
This seems true. DllMain should not be part of static libs, unless you are actually building a DLL.
Uh just posting the latest results of the latest build (doesn't seems to be pleasant output), but here you go:
These undefined reference
were not there before..?
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 :wink:
Keep in mind, those undefined reference
where NOT in the previous build of github actions. Only in the latest github actions build. Just saying.....
GTK comes with nice .pc files in the lib/pkgconfig
directory, containing all the required packages you need, that should not be the issue in this case.
Are you sure you are building the .a files correctly? I mean this issue looks related to #988. Like missing -DGLIB_STATIC_COMPILATION
or -DGOBJECT_STATIC_COMPILATION
or -DLIBXML_STATIC
, or something.. Please, don't blame me 🍰
not trying to blame, just starting with the simplest explanation first.
@danger89 Do you have a test program to compile with commands used?
@danger89 Do you have a test program to compile with commands used?
I try to cross-compile my libreweb app: https://gitlab.melroy.org/libreweb/browser to Windows. See also the PR
That being said you could also try a new one gtkmm hello world first? Create a basic cmake file. And try to statically build it.
g++ $(pkg-config -cflags gtkmm-3.0) test.cpp $(pkg-config -libs gtkmm-3.0)
. --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".First things first. Did you try to compile the static build with DGLIB_STATIC_COMPILATION or -DGOBJECT_STATIC_COMPILATION and -DLIBXML_STATIC options?
Nope. Feel free to experiment with those. Contributions are always welcomed.
Sorry, I'm going to use MXE. https://mxe.cc/#tutorial
* 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).
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?? :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 thelibgtk-3.a
file is missing completely?..See the error I get during a cross-compile on Linux towards Windows:
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