Hello Ian,

* Ian Lance Taylor wrote on Tue, Mar 29, 2011 at 07:39:25AM CEST:
> 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.

> Unfortunately, on a GNU/Linux host (recall that for a target library,
> the target is the host), libtool itself does a link test.

The general strategy I've been following with these is wrapping the link
test result with a cache variable, and trying to let the cache variable
be pre-set by configure.ac in the no-executables case (and adjusting
libtool/tests/no-executables.at).  Then, even if the cache variable is
not set, the user can work around it.

> 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.

There's a simple workaround for the time being: pass
  target_configargs='lt_cv_shlibpath_overrides_runpath=yes'

(or =no, depending on which is correct) to toplevel configure.

> 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.

Right.  There are probably more such cases.  I'm not sure how to change
the code for best results here, apart from just using /lib /usr/lib.

> 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?

Well, we can introduce another variable that tells Libtool macros that
/ is not something to look at for system details.  I'm not sure if
$with_sysroot can be (ab)used for that.

Cheers,
Ralf

Reply via email to