Why does ltmain.sh::temp_rpath not need the same system lib considerations?

Nish Aravamudan <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <20170216203128.ej2avetcjhgw55b4@pitfall>
I am trying to get to the bottom of an odd build failure on Ubuntu 17.04
with heimdal. I believe the underlying issue is a bug in libtool, but
I'm not confident in my analysis (some of it is also at
https://github.com/heimdal/heimdal/issues/241), but here's what I have,
I would appreciate any feedback!

Using the system sqlite3 (/usr/lib/x86_64-linux-gnu/) via configure, we
end up inserting the above path into LD_LIBRARY_PATH for build-time
generated wrapper scripts and since we also happen to have heimdal
libraries install at the system-level, the system heimdal libraries are
used by the tests instead of the build-local ones. This is bad for two
reasons: a) it fails in this case because of an ABI mismatch and b) we
are trying to test the built libraries, not the system installed ones
when the library in question is built by this package.

It seems like there is rarely, if ever, a case to put a system library
path before a non-system library path in the wrapper script, and in
particular, it seems like ltmain.sh actually detects adding the system
path to compile_rpath and finalize_rpath. Is it correct to do the same
elision in temp_rpath? e.g.

--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8092,9 +8092,16 @@ func_mode_link ()
 	    # We need to hardcode the library path
 	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
 	      # Make sure the rpath contains only unique directories.
-	      case $temp_rpath: in
-	      *"$absdir:"*) ;;
-	      *) func_append temp_rpath "$absdir:" ;;
+	      # Skip directories that are in the system default run-time
+	      # search path.
+	      case " $sys_lib_dlsearch_path " in
+	      *" $absdir "*) ;;
+	      *)
+		case $temp_rpath: in
+		*"$absdir:"*) ;;
+		*) func_append temp_rpath "$absdir:" ;;
+		esac
+		;;
 	      esac
 	    fi

Doing the above does result in passing testcases, but I'm not sure why
this isn't seen in other environments or if the above change is a bad
idea.

Thanks!
-Nish
 

-- 
Nishanth Aravamudan
Ubuntu Server
Canonical Ltd

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.