This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC_NO_EXECUTABLES vs. libtool
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 28 Mar 2011 22:39:25 -0700
- Subject: GCC_NO_EXECUTABLES vs. libtool
We have several bug reports for 4.6.0 about failures of the form
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
http://gcc.gnu.org/PR47836
http://gcc.gnu.org/PR46586
http://gcc.gnu.org/PR45174
http://gcc.gnu.org/PR39107
The problem arising when building a cross-compiler for a GNU/Linux
target. Configure scripts like libiberty/configure.ac,
libquadmath/configure.ac, etc., use GCC_NO_EXECUTABLES. The
GCC_NO_EXECUTABLES macro checks whether a link succeeds. If it does
not, it sets gcc_no_link. If a later attempt to run a link test, the
above error is reported.
Unfortunately, on a GNU/Linux host (recall that for a target library,
the target is the host), libtool itself does a link test. From the top
level libtool.m4 file, in _LT_SYS_DYNAMIC_LINKER, in the "linux* |
k*bsd*-gnu | kopensolaris*-gnu" case:
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
[lt_cv_shlibpath_overrides_runpath=yes])])
That test fails when a link fails. That test must not be run when
linking fails.
Shortly after that code in libtool.m4, I see this:
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
Testing /etc/ld.so.conf is absolutely meaningless when building a target
library for a non-native compilation. That test must not be run when
cross-compiling.
We should definitely fix this for gcc 4.6.1. However, I don't know what
the best way to fix this is. Our gcc-specific target libraries check
$with_cross_host to see if they are being built as a cross-compiled
target library. Presumably libtool doesn't want to check that.
GCC_NO_EXECUTABLES sets a gcc-specific shell variable and overrides
AC_LINK_IFELSE to test variable. libtool doesn't know anything about
that. So what should we do here?
Ian