After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 783482 - Fail to link invert-svg in jhbuild prefix on FreeBSD because LDFLAGS is ignored
Fail to link invert-svg in jhbuild prefix on FreeBSD because LDFLAGS is ignored
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
git master
Other FreeBSD
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2017-06-06 14:58 UTC by Ting-Wei Lan
Modified: 2017-06-08 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ting-Wei Lan 2017-06-06 14:58:42 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
Comment 1 Jehan 2017-06-07 09:26:00 UTC
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(-)
Comment 2 Ting-Wei Lan 2017-06-08 12:30:40 UTC
(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.
Comment 3 Jehan 2017-06-08 22:57:04 UTC
(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(-)