GLib2 fails to configure when all dependencies are static
Description
What I'm doing is probably not an intended use of the system, but I'm building a number of programs as statically linked for use in the build process of another program I'm working on. When trying to compile GLib2 (for shared-mime-info), Meson fails to find libintl, and from the logs it's looking for a method called __builtin_ngettext. This might be a Meson bug (or quirk).
Verification
- [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)
Windows Version
Microsoft Windows [Version 10.0.22000.978]
MINGW environments affected
- [X] MINGW64
- [ ] MINGW32
- [ ] UCRT64
- [ ] CLANG64
- [ ] CLANG32
- [ ] CLANGARM64
Expected behavior
GLib configures for build
Actual behavior
Configure process fails
Repro steps
- Attempt to build Glib2 as static with all static dependencies
- Observe configure failure
Are you willing to submit a PR?
I have no idea what's broken, so no.
-Dc_links_args="-lintl -liconv" -Dcpp_links_args="-lintl -liconv" should get the build working. The problem is libintl doesn't have a pkg-config file. I encountered something similar when building Mesa3D statically.
Would adding a pkgconfig file mitigate the issue? If yes can you provide any sample pkgconfig file that would fix the issue? I can try to ask upstream.
The bug is with gettext not providing a pkgconfig file. Same problem as here.
Though it also worth looking how glib2 lookup gettext dependency to make sure it's doing the right thing.
Update: I checked glib2 source at 2.74.0 and it's using dependency() call to find intl as it should which leaves gettext missing pc file as the only problem
To workaround this issue your Meson build setup command must contain this:
--prefer-static -Dc_links_args="-static -lintl -liconv" -Dcpp_links_args="-static -lintl -liconv"
I'll try that later. Currently fighting with the Curseforge App while working on a Minecraft modpack.