This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] do not disregard LD_LIBRARY_PATH for native c++ tests
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: aldh at redhat dot com
- Date: Fri, 27 Feb 2004 19:51:07 -0500 (EST)
- Subject: Re: [patch] do not disregard LD_LIBRARY_PATH for native c++ tests
> 2004-02-27 Aldy Hernandez <aldyh@redhat.com>
>
> * lib/g++.exp (g++_link_flags): Append LD_LIBRARY_PATH to
> ld_library_path.
This isn't right and if you do this in objc.exp with dejagnu 1.4.4,
ld_library_path eventually exceeds the maximum length for environment
variables on hppa-linux. Look at unix.exp. It already appends
a preexisting LD_LIBRARY_PATH to ld_library_path.
Look at the solution in lib/libstdc++.exp. There is a better fix
there.
I have tested the following on hppa-linux.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2004-02-27 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* lib/g++.exp, lib/g77.exp, lib/objc.exp (LD_LIBRARY_PATH, SHLIB_PATH,
DYLD_LIBRARY_PATH, LD_LIBRARY_PATH_32, LD_LIBRARY_PATH_64): Append
original library path to the new environment library path.
Index: lib/g++.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/g++.exp,v
retrieving revision 1.36
diff -u -3 -p -r1.36 g++.exp
--- lib/g++.exp 23 Jan 2004 04:42:39 -0000 1.36
+++ lib/g++.exp 28 Feb 2004 00:41:49 -0000
@@ -166,6 +166,25 @@ proc g++_link_flags { paths } {
}
}
+ # Find the existing LD_LIBRARY_PATH.
+ if [info exists env(LD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH)
+ # For HP-UX
+ } elseif [info exists env(SHLIB_PATH)] {
+ set original_ld_library_path $env(SHLIB_PATH)
+ # For Darwin:
+ } elseif [info exists env(DYLD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(DYLD_LIBRARY_PATH)
+ # For Solaris 32 bit:
+ } elseif [info exists env(LD_LIBRARY_PATH_32)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH_32)
+ # For Solaris 64 bit:
+ } elseif [info exists env(LD_LIBRARY_PATH_64)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH_64)
+ } else {
+ set original_ld_library_path ""
+ }
+
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
# called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
# (for the 64-bit ABI). The right way to do this would be to modify
@@ -176,13 +195,13 @@ proc g++_link_flags { paths } {
# (SHLIB_PATH).
# Doing this does cause trouble when testing cross-compilers.
if {![is_remote target]} {
- setenv LD_LIBRARY_PATH $ld_library_path
- setenv SHLIB_PATH $ld_library_path
- setenv LD_LIBRARYN32_PATH $ld_library_path
- setenv LD_LIBRARY64_PATH $ld_library_path
- setenv LD_LIBRARY_PATH_32 $ld_library_path
- setenv LD_LIBRARY_PATH_64 $ld_library_path
- setenv DYLD_LIBRARY_PATH $ld_library_path
+ setenv LD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
+ setenv SHLIB_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARYN32_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY64_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY_PATH_32 "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY_PATH_64 "$ld_library_path:$original_ld_library_path"
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
}
return "$flags"
Index: lib/g77.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/g77.exp,v
retrieving revision 1.18
diff -u -3 -p -r1.18 g77.exp
--- lib/g77.exp 23 Jan 2004 04:42:39 -0000 1.18
+++ lib/g77.exp 28 Feb 2004 00:41:49 -0000
@@ -110,6 +110,25 @@ proc g77_link_flags { paths } {
}
}
+ # Find the existing LD_LIBRARY_PATH.
+ if [info exists env(LD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH)
+ # For HP-UX
+ } elseif [info exists env(SHLIB_PATH)] {
+ set original_ld_library_path $env(SHLIB_PATH)
+ # For Darwin:
+ } elseif [info exists env(DYLD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(DYLD_LIBRARY_PATH)
+ # For Solaris 32 bit:
+ } elseif [info exists env(LD_LIBRARY_PATH_32)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH_32)
+ # For Solaris 64 bit:
+ } elseif [info exists env(LD_LIBRARY_PATH_64)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH_64)
+ } else {
+ set original_ld_library_path ""
+ }
+
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
# called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
# (for the 64-bit ABI). The right way to do this would be to modify
@@ -118,13 +137,13 @@ proc g77_link_flags { paths } {
# The same applies to Darwin (DYLD_LIBRARY_PATH), Solaris 32 bit
# (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), and HP-UX
# (SHLIB_PATH).
- setenv LD_LIBRARY_PATH $ld_library_path
- setenv SHLIB_PATH $ld_library_path
- setenv LD_LIBRARYN32_PATH $ld_library_path
- setenv LD_LIBRARY64_PATH $ld_library_path
- setenv LD_LIBRARY_PATH_32 $ld_library_path
- setenv LD_LIBRARY_PATH_64 $ld_library_path
- setenv DYLD_LIBRARY_PATH $ld_library_path
+ setenv LD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
+ setenv SHLIB_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARYN32_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY64_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY_PATH_32 "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY_PATH_64 "$ld_library_path:$original_ld_library_path"
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
return "$flags"
}
Index: lib/objc.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.21
diff -u -3 -p -r1.21 objc.exp
--- lib/objc.exp 23 Jan 2004 04:42:39 -0000 1.21
+++ lib/objc.exp 28 Feb 2004 00:41:49 -0000
@@ -184,6 +184,25 @@ proc objc_target_compile { source dest t
}
lappend options "compiler=$OBJC_UNDER_TEST"
+ # Find the existing LD_LIBRARY_PATH.
+ if [info exists env(LD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH)
+ # For HP-UX
+ } elseif [info exists env(SHLIB_PATH)] {
+ set original_ld_library_path $env(SHLIB_PATH)
+ # For Darwin:
+ } elseif [info exists env(DYLD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(DYLD_LIBRARY_PATH)
+ # For Solaris 32 bit:
+ } elseif [info exists env(LD_LIBRARY_PATH_32)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH_32)
+ # For Solaris 64 bit:
+ } elseif [info exists env(LD_LIBRARY_PATH_64)] {
+ set original_ld_library_path $env(LD_LIBRARY_PATH_64)
+ } else {
+ set original_ld_library_path ""
+ }
+
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
# called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
# (for the 64-bit ABI). The right way to do this would be to modify
@@ -192,13 +211,13 @@ proc objc_target_compile { source dest t
# The same applies to Darwin (DYLD_LIBRARY_PATH), Solaris 32 bit
# (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), and HP-UX
# (SHLIB_PATH).
- setenv LD_LIBRARY_PATH $ld_library_path
- setenv SHLIB_PATH $ld_library_path
- setenv LD_LIBRARYN32_PATH $ld_library_path
- setenv LD_LIBRARY64_PATH $ld_library_path
- setenv LD_LIBRARY_PATH_32 $ld_library_path
- setenv LD_LIBRARY_PATH_64 $ld_library_path
- setenv DYLD_LIBRARY_PATH $ld_library_path
+ setenv LD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
+ setenv SHLIB_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARYN32_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY64_PATH "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY_PATH_32 "$ld_library_path:$original_ld_library_path"
+ setenv LD_LIBRARY_PATH_64 "$ld_library_path:$original_ld_library_path"
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
return [target_compile $source $dest $type $options]
}