Skip to content

Commit

Permalink
Merge pull request #4 from adibbley/fix-rpaths
Browse files Browse the repository at this point in the history
Fix RPATH for libraries.
  • Loading branch information
adibbley authored Dec 6, 2023
2 parents 71d19e7 + 086d03e commit 002edf2
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 62 deletions.
8 changes: 3 additions & 5 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 11 additions & 45 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .scripts/logging_utils.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .scripts/run_docker_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 120 additions & 0 deletions .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion conda-forge.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conda_build:
error_overlinking: true
error_overlinking: false
conda_forge_output_validation: true
github:
branch_name: main
Expand Down
4 changes: 4 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ for i in `ls`; do
for j in "$i"/*.so*; do
# Shared libraries are symlinked in $PREFIX/lib
ln -s ${PREFIX}/${targetsDir}/$j ${PREFIX}/$j

if [[ $j =~ \.so\. ]]; then
patchelf --set-rpath '$ORIGIN' ${PREFIX}/${targetsDir}/$j
fi
done
fi
else
Expand Down
11 changes: 9 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ source:
sha256: a7abd59e05b326d6adfca16840071d2ed02d0cc6df092d921ed96d489a2e864e # [win]

build:
number: 0
number: 1
binary_relocation: false
skip: true # [osx]

test:
requires:
- patchelf # [linux]
files:
- test-rpath.sh
commands:
- test -L $PREFIX/lib/libnppc.so.{{ version }} # [linux]
- test -L $PREFIX/lib/libnppc.so.{{ version.split(".")[0] }} # [linux]
- test -L $PREFIX/targets/{{ target_name }}/lib/libnppc.so.{{ version.split(".")[0] }} # [linux]
- test -f $PREFIX/targets/{{ target_name }}/lib/libnppc.so.{{ version }} # [linux]
- bash test-rpath.sh # [linux]
- if not exist %LIBRARY_BIN%\nppc64_{{ version.split(".")[0] }}.dll exit 1 # [win]

outputs:
Expand All @@ -46,7 +52,8 @@ outputs:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- arm-variant * {{ arm_variant_type }} # [aarch64]
- sysroot_{{ target_platform }} 2.17 # [linux]
- sysroot_{{ target_platform }} 2.17 # [linux]
- patchelf <0.18.0 # [linux]
host:
- cuda-version {{ cuda_version }}
run:
Expand Down
24 changes: 24 additions & 0 deletions recipe/test-rpath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

[[ ${target_platform} == "linux-64" ]] && targetsDir="targets/x86_64-linux"
[[ ${target_platform} == "linux-ppc64le" ]] && targetsDir="targets/ppc64le-linux"
[[ ${target_platform} == "linux-aarch64" ]] && targetsDir="targets/sbsa-linux"

errors=""

for lib in `find ${PREFIX}/${targetsDir}/lib -type f`; do
[[ $lib =~ \.so ]] || continue

rpath=$(patchelf --print-rpath $lib)
echo "$lib rpath: $rpath"
[[ $rpath == "\$ORIGIN" ]] || errors+="$lib\n"
done

if [[ $errors ]]; then
echo "The following libraries were found with an unexpected RPATH:"
echo -e "$errors"

exit 1
else
exit 0
fi

0 comments on commit 002edf2

Please sign in to comment.