aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/shell/configure.sh
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2025-08-16 20:09:38 +0200
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2025-08-17 00:24:42 +0200
commitc72da75105d438a480b3721e6d94ae68f34ba9d5 (patch)
treeaa78afc6897796d3915bd602da98311a0062c977 /reproduce/software/shell/configure.sh
parent5bcbaccadae0353a88ef4510006540bf6b3b68b5 (diff)
PDF building: pdflatex uses local shell's LD_LIBRARY_PATH
Summary: will not affect existing configuration or analysis. Until this commit, if the Maneage readline library (used by the shell) did not match the local readline library, the 'pdflatex' command would crash when building the template Maneage branch. This was because PGFPlots uses the local shell and we do not build TeXLive from source within Maneage yet. Previously, we had added a modification to 'LD_LIBRARY_PATH' before the 'pdflatex' command to use 'sys_library_sh_path', but the variable was never initilized (because it was only available within the configuration phase)! With this commit, the problem is solved by adding that variable within 'LOCAL.conf' so it is available in the analysis phase of a Maneage'd project also. In order to do so, the set of commands that set the 'sys_library_sh_path' variable within 'configure.sh' was brought up before the creation of 'LOCAL.conf'. In case you have had this problem, the solution is to delete '.build/software/config/LOCAL.conf' and re-configure your project by manually setting the necessary directories. In this way, the 'LOCAL.conf' is created again with the new variable. This bug was found with the help of Faezeh Bidjarchian.
Diffstat (limited to 'reproduce/software/shell/configure.sh')
-rwxr-xr-xreproduce/software/shell/configure.sh97
1 files changed, 50 insertions, 47 deletions
diff --git a/reproduce/software/shell/configure.sh b/reproduce/software/shell/configure.sh
index 1771487..a409920 100755
--- a/reproduce/software/shell/configure.sh
+++ b/reproduce/software/shell/configure.sh
@@ -1410,6 +1410,55 @@ elapsed_time_from_prev_step downloader
+# Libraries necessary for the system's shell
+# ------------------------------------------
+#
+# In some cases (mostly the programs that Maneage doesn't yet build by
+# itself), the programs may call the system's shell, not Maneage's
+# shell. After we close-off the system environment from Maneage, this will
+# cause a crash! To avoid such cases, we need to find the locations of the
+# libraries that the shell needs and temporarily add them to the library
+# search path.
+#
+# About the 'grep -v "(0x[^)]*)"' term (from bug 66847, see [1]): On some
+# systems [2], the output of 'ldd /bin/sh' includes a line for the vDSO [3]
+# that is different to the formats that are assumed, prior to this commit,
+# by the algorithm in 'configure.sh' when evaluating the variable
+# 'sys_library_sh_path'. This leads to a fatal syntax error in (at least)
+# 'ncurses', because the option using 'sys_library_sh_path' contains an
+# unquoted RAM address in parentheses. Even if the address were quoted, it
+# would still be incorrect. This 'grep command excludes candidate host path
+# strings that look like RAM addresses to address the problem.
+#
+# [1] https://savannah.nongnu.org/bugs/index.php?66847
+# [2] https://stackoverflow.com/questions/34428037/how-to-interpret-the-output-of-the-ldd-program
+# [3] man vdso
+if [ $built_container = 0 ]; then
+ if [ x"$on_mac_os" = xyes ]; then
+ sys_library_sh_path=$(otool -L /bin/sh \
+ | awk '/\/lib/{print $1}' \
+ | sed 's#/[^/]*$##' \
+ | sort \
+ | uniq \
+ | awk '{if (NR==1) printf "%s", $1; \
+ else printf ":%s", $1}')
+ else
+ sys_library_sh_path=$(ldd /bin/sh \
+ | awk '{if($3!="") print $3}' \
+ | sed 's#/[^/]*$##' \
+ | grep -v "(0x[^)]*)" \
+ | sort \
+ | uniq \
+ | awk '{if (NR==1) printf "%s", $1; \
+ else printf ":%s", $1}')
+ fi
+ elapsed_time_from_prev_step sys-library-sh-path
+fi
+
+
+
+
+
# When no local configuration existed, write the parameters into the local
# configuration file.
sdir=$bdir/software
@@ -1429,6 +1478,7 @@ if [ $rewritelconfig = yes ]; then
-e's|@sys_cpath[@]|'"$sys_cpath"'|' \
-e's|@downloader[@]|'"$downloader"'|' \
-e's|@groupname[@]|'"$maneage_group_name"'|' \
+ -e's|@sys_library_sh_path[@]|'"$sys_library_sh_path"'|' \
$lconfin >> $lconf
fi
elapsed_time_from_prev_step LOCAL-write
@@ -1680,53 +1730,6 @@ fi
-# Libraries necessary for the system's shell
-# ------------------------------------------
-#
-# In some cases (mostly the programs that Maneage doesn't yet build by
-# itself), the programs may call the system's shell, not Maneage's
-# shell. After we close-off the system environment from Maneage, this will
-# cause a crash! To avoid such cases, we need to find the locations of the
-# libraries that the shell needs and temporarily add them to the library
-# search path.
-#
-# About the 'grep -v "(0x[^)]*)"' term (from bug 66847, see [1]): On some
-# systems [2], the output of 'ldd /bin/sh' includes a line for the vDSO [3]
-# that is different to the formats that are assumed, prior to this commit,
-# by the algorithm in 'configure.sh' when evaluating the variable
-# 'sys_library_sh_path'. This leads to a fatal syntax error in (at least)
-# 'ncurses', because the option using 'sys_library_sh_path' contains an
-# unquoted RAM address in parentheses. Even if the address were quoted, it
-# would still be incorrect. This 'grep command excludes candidate host path
-# strings that look like RAM addresses to address the problem.
-#
-# [1] https://savannah.nongnu.org/bugs/index.php?66847
-# [2] https://stackoverflow.com/questions/34428037/how-to-interpret-the-output-of-the-ldd-program
-# [3] man vdso
-if [ $built_container = 0 ]; then
- if [ x"$on_mac_os" = xyes ]; then
- sys_library_sh_path=$(otool -L /bin/sh \
- | awk '/\/lib/{print $1}' \
- | sed 's#/[^/]*$##' \
- | sort \
- | uniq \
- | awk '{if (NR==1) printf "%s", $1; \
- else printf ":%s", $1}')
- else
- sys_library_sh_path=$(ldd /bin/sh \
- | awk '{if($3!="") print $3}' \
- | sed 's#/[^/]*$##' \
- | grep -v "(0x[^)]*)" \
- | sort \
- | uniq \
- | awk '{if (NR==1) printf "%s", $1; \
- else printf ":%s", $1}')
- fi
- elapsed_time_from_prev_step sys-library-sh-path
-fi
-
-
-
# Find Zenodo URL for software downloading
# ----------------------------------------