[Bug build/23681] Program environment variables (AR, LD, AS, ...) are ignored

joseph at codesourcery dot com sourceware-bugzilla@sourceware.org
Wed Sep 19 23:50:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=23681

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Do the settings in aclocal.m4 override variables set on the configure 
command line, or only those in the environment?

In my view, settings in the environment and those on the command line 
should be equivalent - the difference being that those in the environment 
can't reliably be saved by configure for cases where it gets rerun 
automatically, and hence putting settings on the command line is preferred 
over putting them in the environment.  Since the way configure handles 
settings on the command line is to save them and export them, I'd expect 
aclocal.m4 to be overriding both.

In my view, explicit settings either on the command line or in the 
environment should override defaults, *for tools that the build system 
uses explicitly in the build*.

Normally, both $target-$tool and `$CC -print-prog-name=$tool` should be 
the same thing for any binutils $tool (in two different locations, one in 
$exec_prefix/bin and one in $exec_prefix/$target/bin).

Directly running tools in $exec_prefix/$target/bin by hand can be a bad 
idea; they are for internal use by the compiler and may not search in the 
correct directories unless certain environment variables are set that only 
the compiler driver sets.  This is especially the case for the copies of 
gcc and g++ in that directory - they won't work correctly when called 
directly - as most binutils programs don't have search paths like that, 
and ld has logic to find its linker scripts whichever one of those 
directories it is called from.

On the whole I'd say that looking for the $target-prefixed tools in PATH 
is safer *for the tools that are actually used in the build* than asking 
the compiler what tools it uses.

*However*, the code determining AS and LD values is *not* determining 
tools that will then be used from the glibc makefiles.  It's only 
determining tools that will be used by the configure tests to see if 
binutils is recent enough (and a few other configure tests using --help, 
--version and similar on those tools).  And for that, it probably *is* 
best to check only the tools actually used by the compiler, ignoring any 
other settings passed to configure.

So: for $AS and $LD (which are *not* passed to AC_SUBST, only used in 
configure tests) I think the existing code, overriding any settings from 
the command line, is correct.  For other binutils tools, which are passed 
to AC_SUBST so that the resulting values get used in the build, I think 
using AC_CHECK_TOOL makes sense.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list