# HG changeset patch # User Thomas De Schampheleire <[email protected]> # Date 1384427165 -3600 # Node ID e2a04d7b8981bcc7de64e12251eb5fd52c1096f5 # Parent 0c37f66b4f3b7f32b02a98fad3d8368c283a2b61 link: disable --as-needed to fix gettext on some systems
In some configurations, vim fails to link correctly with messages such as: edit.c:(.text+0x1614): undefined reference to `libintl_gettext' In particular, this has been seen by the buildroot autobuilds (see [1]) but has also been reported at [2] and [3]. In the bad case, the configure script says: checking for NLS... gettext() works In the good case, it says: checking for NLS... gettext() works with -lintl In the bad case, the system has libelf, vim detects that and takes it along in $LIBS. Libelf needs libintl on this system, and so linking the test program with -lelf will automatically take -lintl too. This causes configure to think gettext() does not need libintl, while in reality it does. In the good case, libelf is not present and thus not used. The first configure test for gettext fails, and then configure retries with -lintl (which succeeds). Until now, there isn't really a problem. In both cases, you could link correctly. In the 'bad' case, libintl is implicitly taken through libelf, in the second case it is explicitly taken. The real problem occurs because configure also tests whether the linker supports --as-needed and uses it when possible, instead of the link.sh script. However, --as-needed seems to cause libintl NOT to be taken in the bad case, causing the undefined references to libintl_gettext. If you remove --as-needed from the link command, it succeeds. [1] http://autobuild.buildroot.net/results/21b5a910e6a27fa1cb12d0002ffed7e6ed9d6c83/ [2] http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-November/243930.html [3] http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-May/234184.html Signed-off-by: Thomas De Schampheleire <[email protected]> --- src/auto/configure | 15 --------------- src/configure.in | 20 ++++++-------------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/auto/configure b/src/auto/configure --- a/src/auto/configure +++ b/src/auto/configure @@ -13049,23 +13049,7 @@ if test "$GCC" = yes; then fi fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5 -$as_echo_n "checking linker --as-needed support... " >&6; } LINK_AS_NEEDED= -# Check if linker supports --as-needed and --no-as-needed options -if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then - LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'` - LINK_AS_NEEDED=yes -fi -if test "$LINK_AS_NEEDED" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - # IBM z/OS reset CFLAGS for config.mk if test "$zOSUnix" = "yes"; then diff --git a/src/configure.in b/src/configure.in --- a/src/configure.in +++ b/src/configure.in @@ -3907,21 +3907,13 @@ if test "$GCC" = yes; then fi AC_SUBST(DEPEND_CFLAGS_FILTER) -dnl link.sh tries to avoid overlinking in a hackish way. -dnl At least GNU ld supports --as-needed which provides the same functionality -dnl at linker level. Let's use it. -AC_MSG_CHECKING(linker --as-needed support) +dnl On some systems, libelf needs libintl. In this case, when the configure +dnl script tests how to link for gettext support, it will think libintl is not +dnl needed (but in reality it is, it was simply implicitly through libelf). +dnl When the final link command uses --as-needed, libintl won't be taken in, +dnl not even through libelf, and the link fails with undefined references to +dnl libintl_gettext. Hence, disable --as-needed. LINK_AS_NEEDED= -# Check if linker supports --as-needed and --no-as-needed options -if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then - LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'` - LINK_AS_NEEDED=yes -fi -if test "$LINK_AS_NEEDED" = yes; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi AC_SUBST(LINK_AS_NEEDED) # IBM z/OS reset CFLAGS for config.mk -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
