[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to make libtool support cross-compile

From: Dan Kegel
Subject: Patch to make libtool support cross-compile
Date: Sat, 09 Mar 2002 07:34:13 -0800

As pointed out by H. Lu in October
( )
and seconded by Guido
( )
libtool improperly searches /lib and /usr/lib when doing
a cross-compile, which results in libraries from the build system
leaking into the link (which results in programmers throwing rotten
tomatoes at the screen).

You can see the essential problem in the current cvs version
It sets sys_lib_search_path_spec without asking the cross-compiler
what its default system search path is.

Following a suggestion by Guido, I posted a patch
that solved this problem for me. Guido liked the patch,
but pointed out a bug.

I suppose the following is closer to correct:

--- libtool.m4.orig     Sat Mar  9 07:28:58 2002
+++ libtool.m4  Sat Mar  9 07:30:59 2002
@@ -984,7 +984,11 @@
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+if test "$GCC" = yes && test "$cross_compiling" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed 
-e "s/^libraries://" -e "s/:/ /g"`
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"

That stays closer to the original spirit of the code, and
should fix the bug Guido pointed out.


- Dan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]