more robust access to shared libraries for poly executable: avoid global change of LD_LIBRARY_PATH (e.g. relevant for subprocesses);
authorwenzelm
Fri, 09 Feb 2018 11:14:13 +0100
changeset 67580 eb64467e8bcf
parent 67579 1a636c22d85c
child 67581 30f412d1d7c3
more robust access to shared libraries for poly executable: avoid global change of LD_LIBRARY_PATH (e.g. relevant for subprocesses);
Admin/polyml/polyi
src/Pure/Admin/build_polyml.scala
--- a/Admin/polyml/polyi	Thu Feb 08 15:15:01 2018 +0100
+++ b/Admin/polyml/polyi	Fri Feb 09 11:14:13 2018 +0100
@@ -4,7 +4,6 @@
 
 THIS="$(cd "$(dirname "$0")"; pwd)"
 
-export LD_LIBRARY_PATH="$THIS:$LD_LIBRARY_PATH"
 export DYLD_LIBRARY_PATH="$THIS:$DYLD_LIBRARY_PATH"
 
 if type -p rlwrap > /dev/null
--- a/src/Pure/Admin/build_polyml.scala	Thu Feb 08 15:15:01 2018 +0100
+++ b/src/Pure/Admin/build_polyml.scala	Fri Feb 09 11:14:13 2018 +0100
@@ -21,8 +21,12 @@
     "x86-linux" ->
       Platform_Info(
         options_multilib =
-          List("--build=i386", "CFLAGS=-m32 -O3", "CXXFLAGS=-m32 -O3", "CCASFLAGS=-m32")),
-    "x86_64-linux" -> Platform_Info(),
+          List("--build=i386", "CFLAGS=-m32 -O3", "CXXFLAGS=-m32 -O3", "CCASFLAGS=-m32",
+            "LDFLAGS=-Wl,-rpath,_DUMMY_"),
+        options = List("LDFLAGS=-Wl,-rpath,_DUMMY_")),
+    "x86_64-linux" ->
+      Platform_Info(
+        options = List("LDFLAGS=-Wl,-rpath,_DUMMY_")),
     "x86-darwin" ->
       Platform_Info(
         options =
@@ -163,6 +167,11 @@
 
     for (file <- "~~/Admin/polyml/polyi" :: info.copy_files ::: ldd_files ::: sha1_files)
       File.copy(Path.explode(file).expand_env(settings), target)
+
+
+    /* rpath */
+
+    if (Platform.is_linux) bash(target, "chrpath -r '$ORIGIN' poly", echo = true).check
   }