msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.27k stars 1.22k forks source link

GLib2 fails to configure when all dependencies are static #13276

Open brisingraerowing opened 2 years ago

brisingraerowing commented 2 years ago

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).

Meson Output Log

Verification

Windows Version

Microsoft Windows [Version 10.0.22000.978]

MINGW environments affected

Expected behavior

GLib configures for build

Actual behavior

Configure process fails

Repro steps

  1. Attempt to build Glib2 as static with all static dependencies
  2. Observe configure failure

Are you willing to submit a PR?

I have no idea what's broken, so no.

pal1000 commented 2 years ago

-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.

Biswa96 commented 2 years ago

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.

pal1000 commented 2 years ago

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"

brisingraerowing commented 2 years ago

I'll try that later. Currently fighting with the Curseforge App while working on a Minecraft modpack.