GNOME Bugzilla – Bug 783482
Fail to link invert-svg in jhbuild prefix on FreeBSD because LDFLAGS is ignored
Last modified: 2017-06-08 22:57:04 UTC
In jhbuild prefix environment, GLib is usually installed by jhbuild and libintl is usually provided by the system package. GLib requires libintl, so 'pkg-config --libs glib-2.0' includes -lintl on systems that don't have gettext runtime in libc. Since GLib and libintl are installed in different prefixes, GLib only know its installation prefix and 'pkg-config --libs glib-2.0' cannot print required -L options for libintl. We always rely on LDFLAGS environment variable set by jhbuild to add -L/usr/local/lib to linker command line, but the build command of tools/invert-svg doesn't use LDFLAGS. gmake[3]: Leaving directory '/home/lantw44/gnome/build/gimp/tools' cc -o invert-svg /home/lantw44/gnome/source/gimp/tools/invert-svg.c -L/home/lantw44/gnome/devinstall/lib -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -I/home/lantw44/gnome/devinstall/include/glib-2.0 -I/home/lantw44/gnome/devinstall/lib/glib-2.0/include -pthread /usr/bin/ld: cannot find -lintl cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[2]: *** [Makefile:1118: invert-svg] Error 1
Let's make sure that: 1/ invert-svg uses the variables LDFLAGS_FOR_BUILD and CFLAGS_FOR_BUILD as it should. 2/ these variables are set respectively to LDFLAGS and CFLAGS when in a native build. This should be fixed with this commit. Could you please test and reopen if it did not fix it? Thanks for reporting! commit 20fdb8dfa319d57e86f9f135f2d6c246df088357 Author: Jehan <jehan@girinstud.io> Date: Wed Jun 7 11:16:37 2017 +0200 Bug 783482 - Fail to link invert-svg in jhbuild prefix on FreeBSD... ... because LDFLAGS is ignored. Firstly let's make sure that invert-svg build uses LDFLAGS_FOR_BUILD and CFLAGS_FOR_BUILD; secondly, default these to LDFLAGS and CFLAGS respectively when not-cross-compiling, unless values are explicitly set. configure.ac | 11 +++++++++++ tools/Makefile.am | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-)
(In reply to Jehan from comment #1) > Let's make sure that: > 1/ invert-svg uses the variables LDFLAGS_FOR_BUILD and CFLAGS_FOR_BUILD as > it should. > 2/ these variables are set respectively to LDFLAGS and CFLAGS when in a > native build. You may want to do the same thing for CPPFLAGS. > > This should be fixed with this commit. > Could you please test and reopen if it did not fix it? > Thanks for reporting! > Yes, the problem is fixed now.
(In reply to Ting-Wei Lan from comment #2) > You may want to do the same thing for CPPFLAGS. You are right. commit 0de259682ed03c14bd55da139a8823f4ef78b33b Author: Jehan <jehan@girinstud.io> Date: Fri Jun 9 00:40:24 2017 +0200 configure: default CPPFLAGS_FOR_BUILD to CPPFLAGS on native builds. Similarly to what I did for CFLAGS and LDFLAGS in commit 20fdb8d, the preprocessor flags for build tools should also be correctly defaulted and used when building invert-svg. configure.ac | 3 +++ tools/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)