This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove hard-coded path to /usr/bin/libtool for Darwin
- From: Shantonu Sen <ssen at opendarwin dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 23 Jan 2006 09:22:37 -0800
- Subject: [PATCH] Remove hard-coded path to /usr/bin/libtool for Darwin
gcc/config/darwin.h has:
#define LINK_COMMAND_SPEC "\
%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
Note the explicit path to Darwin libtool. For people not familiar with
Darwin, this is an Apple tool used to create shared and static
libraries, not GNU libtool.
Not only does this violate the documentation on searching for target
tools (tools directory, then OS-specific dirs, then PATH), it creates
the following issues:
1) Cross compilers (for instance Linux hosted, targetting Darwin) by
default do the wrong thing, since /usr/bin/libtool is often GNU
libtool. Even if you use odcctools (<http://www.opendarwin.org/projects/odcctools/
>), the other target tools like "as" and "ld" are found, but
"libtool" stubbornly isn't without source tree modification
2) Even for a native Darwin bootstrap, the stock toolchain from Apple
may have bugs which are fixed in a local install of odcctools built
with --prefix=/usr/local/foo. gcc's configure process generally finds
the new tools, but for the same reasons as above, the stock /usr/bin/
libtool is used, which can result in incorrect behavior when mixed and
matched with object files created by /usr/local/foo/bin/as
This partially addresses
PR 24598 - Need to support odcctools and its ablity to use --prefix
and libtool
However I would not consider this fixed, because my changes only
facilitate finding these tools if they are already in your PATH.
Another common desire is for functionality on par with --with-as/--
with-ld. There is no --with-darwin-libtool, and its existence is
Darwin specific. Until there's a good way of doing that so that
odcctools doesn't have to be in your PATH in order for the right tools
to be invoked, that bug should remain open.
Some may be concerned by "what if you have GNU libtool in your PATH
and it gets used instead?". Apple for this reason installs GNU libtool
as "glibtool", and most people do the same to avoid conflicts in the
bin namespace.
Regression tested on Mac OS X 10.4.4 (PowerPC) with the stock tools
from Apple and no regressions.
The interesting part is when you have an in-development of odcctools
and use it with mainline. Running the test suite with -m64 goes, for g+
+ for example, from:
=== g++ Summary ===
# of expected passes 9223
# of unexpected failures 1422
# of expected failures 63
# of unresolved testcases 77
# of unsupported tests 121
/Volumes/HD/ltmp/ssen/gcc-3-libtool-build/gcc/testsuite/g++/../../g++
version 4.2.0 20060123 (experimental)
To:
=== g++ Summary ===
# of expected passes 11835
# of unexpected failures 53
# of expected failures 66
# of unsupported tests 121
/Volumes/HD/ltmp/ssen/gcc-4-odcctools-libtool-build/gcc/testsuite/g+
+/../../g++ version 4.2.0 20060123 (experimental)
Note that this change doesn't fix those testsuite problems, but rather
it enables the fix in odcctools to be used by using the right versions
of the tools to link things.
2006-01-23 Shantonu Sen <ssen@opendarwin.org>
* config/darwin.h (LINK_COMMAND_SPEC): Do not hardcode
the path to Darwin libtool.
Index: config/darwin.h
===================================================================
--- config/darwin.h (revision 110108)
+++ config/darwin.h (working copy)
@@ -201,7 +201,7 @@
linkers, and for positional arguments like libraries. */
#define LINK_COMMAND_SPEC "\
%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
- %{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
+ %{!Zdynamiclib:%(linker)}%{Zdynamiclib:libtool} \
%l %X %{d} %{s} %{t} %{Z} \
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \