Set rpath with cmake for CUDA build (#2932)

This commit is contained in:
Cheng
2025-12-19 12:53:38 +09:00
committed by GitHub
parent ab4dce4e18
commit b2e2b19bf7
4 changed files with 29 additions and 33 deletions
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
auditwheel repair dist/* \
--plat manylinux_2_35_${1} \
--exclude libcublas* \
--exclude libnvrtc* \
--exclude libcuda* \
--exclude libcudnn* \
--exclude libnccl* \
-w wheel_tmp
mkdir wheelhouse
cd wheel_tmp
repaired_wheel=$(find . -name "*.whl" -print -quit)
unzip -q "${repaired_wheel}"
rm "${repaired_wheel}"
mlx_so="mlx/lib/libmlx.so"
rpath=$(patchelf --print-rpath "${mlx_so}")
base="\$ORIGIN/../../nvidia"
rpath=$rpath:${base}/cublas/lib:${base}/cuda_nvrtc/lib:${base}/cudnn/lib:${base}/nccl/lib
patchelf --force-rpath --set-rpath "$rpath" "$mlx_so"
python ../python/scripts/repair_record.py ${mlx_so}
# Re-zip the repaired wheel
zip -r -q "../wheelhouse/${repaired_wheel}" .