Skip to content

Commit

Permalink
Fix ld config
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Applencourt committed Sep 11, 2023
1 parent 86490b8 commit 6a66402
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions xprof/xprof.sh.erb.in
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,32 @@ display_version() {
exit 1
}

populate_whichlib_cache() {
set +x
whichlib_cached=$(PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null)
if [ $debug = true ]; then
set -x
fi
}

# Find all location of a `.so`
whichlib() {
{
# Always remove `x` here, too much nose due to ldconfig -vNX
set +x

# Output of ldconfig:
#/usr/lib32:
# libstdc++.so.6 -> libstdc++.so.6.0.26
# After the awk:
# -> /usr/lib32/libstdc++.so.6

# In OpenSUSE ldconfig, is in '/sbin'.
PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null |
echo $whichlib_cached |
awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \
match($1, "^lib") && match($1, p) { print header "/" $1}'
}
if [ $debug = true ]; then
set -x
fi
}

whichlib64_head() {
Expand Down Expand Up @@ -377,6 +387,8 @@ setup_lttng() {
}

preload_lib_tracers() {
populate_whichlib_cache

IFS=","
if [[ "$traced_ranks" == "-1" ]] || [[ "$IFS$traced_ranks$IFS" =~ "$IFS$(mpi_rank_id)$IFS" ]]; then
<% if languages.include?("omp") %>
Expand Down

0 comments on commit 6a66402

Please sign in to comment.