Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-30 Thread Dan Nicholson
On Thu, Jan 29, 2009 at 11:26 PM, Ralf Corsepius rc040...@freenet.de wrote:
 Dan Nicholson wrote:

 On Wed, Jan 28, 2009 at 01:50:51PM -0600, Bob Friesenhahn wrote:

 On Wed, 28 Jan 2009, Dan Nicholson wrote:

 When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
 system library path so that an RPATH is not added when using libraries
 from these directories.

 Are these libraries consistently available for 64-bit Linux?  If not,
  should they be explicitly tested for before depending on them?

 I got the impression that Linux systems which are completely 64-bit
  (i.e. don't support executing 32-bit binaries) don't use /lib64 and
  /usr/lib64.

 Well, actually, the search paths to system libs is hard coded into gcc.
 It may vary between architectures, vendors and OSes.

I'm talking about the dynamic linker search path, which is determined
by glibc. sys_lib_dlsearch_path_spec is how libtool decides whether to
encode an RPATH for programs or not. I'm not exactly sure what it does
for libraries.

--
Dan


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-30 Thread Ralf Corsepius

Dan Nicholson wrote:

On Thu, Jan 29, 2009 at 11:26 PM, Ralf Corsepius rc040...@freenet.de wrote:

Dan Nicholson wrote:

On Wed, Jan 28, 2009 at 01:50:51PM -0600, Bob Friesenhahn wrote:

On Wed, 28 Jan 2009, Dan Nicholson wrote:


When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
system library path so that an RPATH is not added when using libraries
from these directories.

Are these libraries consistently available for 64-bit Linux?  If not,
 should they be explicitly tested for before depending on them?

I got the impression that Linux systems which are completely 64-bit
 (i.e. don't support executing 32-bit binaries) don't use /lib64 and
 /usr/lib64.

Well, actually, the search paths to system libs is hard coded into gcc.
It may vary between architectures, vendors and OSes.


I'm talking about the dynamic linker search path, which is determined
by glibc. 

The dynamic linker's search path is not of much importance when linking.

Ralf


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-29 Thread Dan Nicholson
On Wed, Jan 28, 2009 at 01:50:51PM -0600, Bob Friesenhahn wrote:
 On Wed, 28 Jan 2009, Dan Nicholson wrote:

 When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
 system library path so that an RPATH is not added when using libraries
 from these directories.

 Are these libraries consistently available for 64-bit Linux?  If not,  
 should they be explicitly tested for before depending on them?

 I got the impression that Linux systems which are completely 64-bit  
 (i.e. don't support executing 32-bit binaries) don't use /lib64 and  
 /usr/lib64.

Here's a respin of the patch that adds the directories only when they
exist. I think this a pretty safe default for 64 bit systems.

--
Dan

Subject: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux 
ELF

When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
system library path so that an RPATH is not added when using libraries
from these directories.

Signed-off-by: Dan Nicholson dbn.li...@gmail.com
---
 libltdl/m4/libtool.m4 |   17 -
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index b75a55a..a760865 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -2410,10 +2410,25 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   # before this can be enabled.
   hardcode_into_libs=yes
 
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec=/lib /usr/lib
+  echo 'int i;'  conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+case `/usr/bin/file conftest.o` in
+  *64-bit*)
+   for ac_dir in /lib64 /usr/lib64; do
+ test -d $ac_dir  \
+   sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec $ac_dir
+   done
+   ;;
+esac
+  fi
+  rm -rf conftest*
+
   # Append ld.so.conf contents to the search path
   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;/^$/d' | tr '\n' ' '`
-sys_lib_dlsearch_path_spec=/lib /usr/lib $lt_ld_extra
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec $lt_ld_extra
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
-- 
1.5.6.6


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-29 Thread Ralf Corsepius

Dan Nicholson wrote:

On Wed, Jan 28, 2009 at 01:50:51PM -0600, Bob Friesenhahn wrote:

On Wed, 28 Jan 2009, Dan Nicholson wrote:


When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
system library path so that an RPATH is not added when using libraries
from these directories.
Are these libraries consistently available for 64-bit Linux?  If not,  
should they be explicitly tested for before depending on them?


I got the impression that Linux systems which are completely 64-bit  
(i.e. don't support executing 32-bit binaries) don't use /lib64 and  
/usr/lib64.


Well, actually, the search paths to system libs is hard coded into gcc.
It may vary between architectures, vendors and OSes.

Ralf


___
http://lists.gnu.org/mailman/listinfo/libtool


[PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-28 Thread Dan Nicholson
When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
system library path so that an RPATH is not added when using libraries
from these directories.

Signed-off-by: Dan Nicholson dbn.li...@gmail.com
---
 libltdl/m4/libtool.m4 |   16 +++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index b75a55a..b6a2435 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -2410,10 +2410,24 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   # before this can be enabled.
   hardcode_into_libs=yes
 
+  # Find out the system library path by ABI.
+  echo 'int i;'  conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+case `/usr/bin/file conftest.o` in
+  *64-bit*)
+   sys_lib_dlsearch_path_spec=/lib /lib64 /usr/lib /usr/lib64
+   ;;
+  *)
+   sys_lib_dlsearch_path_spec=/lib /usr/lib
+   ;;
+esac
+  fi
+  rm -rf conftest*
+
   # Append ld.so.conf contents to the search path
   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;/^$/d' | tr '\n' ' '`
-sys_lib_dlsearch_path_spec=/lib /usr/lib $lt_ld_extra
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec $lt_ld_extra
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
-- 
1.5.6.6



___
http://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-28 Thread Bob Friesenhahn

On Wed, 28 Jan 2009, Dan Nicholson wrote:


When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
system library path so that an RPATH is not added when using libraries
from these directories.


Are these libraries consistently available for 64-bit Linux?  If not, 
should they be explicitly tested for before depending on them?


I got the impression that Linux systems which are completely 64-bit 
(i.e. don't support executing 32-bit binaries) don't use /lib64 and 
/usr/lib64.


Bob
==
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/



___
http://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-28 Thread Dan Nicholson
On Wed, Jan 28, 2009 at 11:50 AM, Bob Friesenhahn
bfrie...@simple.dallas.tx.us wrote:
 On Wed, 28 Jan 2009, Dan Nicholson wrote:

 When the ABI is 64-bit on Linux ELF, add /lib64 and /usr/lib64 to the
 system library path so that an RPATH is not added when using libraries
 from these directories.

 Are these libraries consistently available for 64-bit Linux?  If not, should
 they be explicitly tested for before depending on them?

 I got the impression that Linux systems which are completely 64-bit (i.e.
 don't support executing 32-bit binaries) don't use /lib64 and /usr/lib64.

If they follow the LSB, then they should be using lib64. However, you
can configure the linker any number of ways. I tried to get a patch to
glibc so this path could be determined, but it was rejected.

http://sourceware.org/ml/libc-alpha/2008-12/msg00052.html

I think this is the only reasonable way to proceed, but I suppose that
an existence test would be safe, too:

sys_lib_dlsearch_path_spec=/lib /usr/lib
case `/usr/bin/file conftest.o` in
*64-bit*)
for dir in /lib64 /usr/lib64; do
test -d $dir 
sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec $dir
done
;;
esac

--
Dan


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] Add 64 bit directories to sys_lib_dlsearch_path_spec for Linux ELF

2009-01-28 Thread Richard Purdie

On Wed, 2009-01-28 at 12:01 -0800, Dan Nicholson wrote:
 If they follow the LSB, then they should be using lib64. However, you
 can configure the linker any number of ways. I tried to get a patch to
 glibc so this path could be determined, but it was rejected.
 
 http://sourceware.org/ml/libc-alpha/2008-12/msg00052.html
 
 I think this is the only reasonable way to proceed, but I suppose that
 an existence test would be safe, too:
 
 sys_lib_dlsearch_path_spec=/lib /usr/lib
 case `/usr/bin/file conftest.o` in
 *64-bit*)
 for dir in /lib64 /usr/lib64; do
 test -d $dir 
 sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec $dir
 done
 ;;
 esac

Just as a datapoint, my standard ubuntu 64 bit desktop has /lib64 as a
symlink to /lib which has 64 bit libraries in it.

Cheers,

Richard

-- 
Richard Purdie
Intel Open Source Technology Centre



___
http://lists.gnu.org/mailman/listinfo/libtool