diff --git a/scripts/install_linux_x64.sh b/scripts/install_linux_x64.sh index cd10f5d..ff05d0a 100755 --- a/scripts/install_linux_x64.sh +++ b/scripts/install_linux_x64.sh @@ -35,7 +35,7 @@ else fi # --- ONNX Runtime (C++ GPU, installs to /usr/local) --- -if [ -f /usr/local/lib64/libonnxruntime.so ] && [ -d /usr/local/include/onnxruntime ]; then +if [ -f /usr/local/lib64/libonnxruntime.so ] && [ -d /usr/local/lib/cmake/onnxruntime ]; then echo ">>> ONNX Runtime already installed — skipping." else echo ">>> Downloading ONNX Runtime ${ORT_VERSION} GPU..." @@ -49,6 +49,15 @@ else sudo cp -r "${TMP_DIR}/onnxruntime-linux-x64-gpu-${ORT_VERSION}/include/"* /usr/local/include/onnxruntime/ sudo mkdir -p /usr/local/lib64 sudo cp -r "${TMP_DIR}/onnxruntime-linux-x64-gpu-${ORT_VERSION}/lib/"* /usr/local/lib64/ + # onnxruntimeTargets.cmake resolves the library as /lib64, but Ubuntu + # is multiarch: CMake does not search lib64 for packages and ld.so does not + # search /usr/local/lib64 at all. Move only the package files to lib/cmake + # and put lib64 on the linker path. + sudo mkdir -p /usr/local/lib/cmake + sudo rm -rf /usr/local/lib/cmake/onnxruntime + sudo mv /usr/local/lib64/cmake/onnxruntime /usr/local/lib/cmake/ + sudo rmdir /usr/local/lib64/cmake + echo /usr/local/lib64 | sudo tee /etc/ld.so.conf.d/onnxruntime.conf > /dev/null sudo ldconfig fi