Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RPATH for libraries. #7

Merged
merged 3 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

4 changes: 2 additions & 2 deletions .ci_support/linux_64_.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '11'
- '12'
cdt_name:
- cos7
channel_sources:
Expand All @@ -11,7 +11,7 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '11'
- '12'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
target_platform:
Expand Down
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.

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
Expand Up @@ -2,7 +2,7 @@ github:
branch_name: main
tooling_branch_name: main
conda_build:
error_overlinking: true
error_overlinking: false
conda_forge_output_validation: true
os_version:
linux_64: cos7
4 changes: 4 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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
13 changes: 10 additions & 3 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ source:
- Makefile.patch

build:
number: 0
number: 1
binary_relocation: false
skip: true # [not (linux64 or aarch64)]

test:
requires:
- patchelf # [linux]
files:
- test-rpath.sh
commands:
# Note that the version of libcufile does not match
# {{ version.split(".")[0] }} but the major version of libcufile_rdma does
Expand All @@ -37,6 +42,7 @@ test:
- test -L $PREFIX/targets/{{ target_name }}/lib/libcufile_rdma.so.{{ version.split(".")[0] }} # [linux64]
- test -f $PREFIX/targets/{{ target_name }}/lib/libcufile.so.{{ full_version }}
- test -f $PREFIX/targets/{{ target_name }}/lib/libcufile_rdma.so.{{ full_version }} # [linux64]
- bash test-rpath.sh # [linux]

outputs:
- name: libcufile
Expand All @@ -51,8 +57,9 @@ outputs:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- arm-variant * {{ arm_variant_type }} # [aarch64]
- sysroot_{{ target_platform }} 2.17 # [linux]
- {{ cdt("rdma-core-devel") }} # [linux64]
- sysroot_{{ target_platform }} 2.17 # [linux]
- {{ cdt("rdma-core-devel") }} # [linux64]
- 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