Howto - linker dependent linker flags in makefile - help needed
Hello developers,
we run into a little problem while dealing with upcoming gcc 4.6 compatibility.
Any help for a "good" solution appreciated. Full story below. Thanks, Adib. -- There should be linker flags leading by "-Wl" curently there is not such option. Gcc fails builing without. But under OSX a native apple darwin compiler is used that do not know this option.
I modified makefile to test for osx: src/Makefile.am: ... if PLATFORM_OSX inkscape_LDFLAGS = --export-dynamic $(kdeldflags) $(mwindows) else inkscape_LDFLAGS = -Wl,--export-dynamic $(kdeldflags) $(mwindows) endif ... and conficure.ac: ... dnl ****************************** dnl MacOS X dnl ****************************** AC_MSG_CHECKING([for OSX platform]) if test "x$build_vendor" = "xapple" ; then platform_osx=yes else platform_osx=no fi AC_MSG_RESULT([$platform_osx]) AM_CONDITIONAL(PLATFORM_OSX, test "$platform_osx" = "yes") ...
But we should test for linker not a gnu linker. There is such test in aclocal.m4: ... # _LT_PATH_LD_GNU #- -------------- m4_defun([_LT_PATH_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 </dev/null` in *GNU* | *'with BFD'*) lt_cv_prog_gnu_ld=yes ;; *) lt_cv_prog_gnu_ld=no ;; esac]) with_gnu_ld=$lt_cv_prog_gnu_ld ])# _LT_PATH_LD_GNU ...
So the question is how to modify those files that gnu linker is checked and in case on gnu linker we put "-Wl" in front of those linkre oprtions?
Thanks for patience, Adib.
2011/3/3 the Adib <theadib@...1439...>:
So the question is how to modify those files that gnu linker is checked and in case on gnu linker we put "-Wl" in front of those linkre oprtions?
Thanks for patience, Adib.
It's better to specifically check whether the compiler accepts -Wl,--export-dynamic or --export-dynamic. Just test compile and link with AC_TRY_LINK, and store the correct flag in EXPORT_DYNAMIC_FLAGS.
By the way, the option exports all symbols in the program, and has to be used with "reverse dependncies", e.g. when some shared library contains undefined symbols that need to be defined in the program itself, as part of its use conventions. Why is it necessary? Is it used by the DBus bindings?
Regards, Krzysztof
On 5/3/11 18:13, Krzysztof Kosiński wrote:
2011/3/3 the Adib <theadib@...1439...>:
So the question is how to modify those files that gnu linker is checked and in case on gnu linker we put "-Wl" in front of those linkre oprtions?
It's better to specifically check whether the compiler accepts -Wl,--export-dynamic or --export-dynamic. Just test compile and link with AC_TRY_LINK, and store the correct flag in EXPORT_DYNAMIC_FLAGS.
By the way, the option exports all symbols in the program, and has to be used with "reverse dependncies", e.g. when some shared library contains undefined symbols that need to be defined in the program itself, as part of its use conventions. Why is it necessary? Is it used by the DBus bindings?
AFAICT after searching the bzr and SVN logs, it is unrelated to the new DBUS bindings, but a legacy linker flag from sodipodi:
src/Makefile.am (SVN r4, line 161) sodipodi_LDFLAGS = -Wl,--export-dynamic $(kdeldflags) http://inkscape.svn.sourceforge.net/viewvc/inkscape/trunk/inkscape/src/Makefile.am?view=markup&pathrev=4
which was changed to
src/Makefile.am (SVN r243, Patches to make compile on OSX/Darwin) inkscape_LDFLAGS = --export-dynamic $(kdeldflags) http://inkscape.svn.sourceforge.net/viewvc/inkscape?view=revision&revision=243
and later (SVN r2993) moved to
src/Makefile_insert http://inkscape.svn.sourceforge.net/viewvc/inkscape?view=revision&revision=2993
and later (BZR r7336) moved back to
src/Makefile.am http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/7336
This relates to
707205 Inkscape 0.48.0 fails to build with gcc 4.6 https://bugs.launchpad.net/inkscape/+bug/707205
and the latest comment there by Emil Karlson.
How could it be verified whether this linker option is indeed needed on any platform which is using a GNU linker?
~suv
participants (3)
-
Krzysztof Kosiński
-
the Adib
-
~suv