fix ONNX Runtime install layout so CMake can find it
The release tarball ships its CMake package files under lib/, but onnxruntimeTargets.cmake resolves the library as <prefix>/lib64. Ubuntu is multiarch, so CMake does not search lib64 for packages and ld.so does not search /usr/local/lib64 at all, leaving find_package(onnxruntime) failing on a stock install. Keep the libraries in lib64, move only the package files to lib/cmake, and add lib64 to the linker path.
This commit is contained in:
@@ -35,7 +35,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# --- ONNX Runtime (C++ GPU, installs to /usr/local) ---
|
# --- 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."
|
echo ">>> ONNX Runtime already installed — skipping."
|
||||||
else
|
else
|
||||||
echo ">>> Downloading ONNX Runtime ${ORT_VERSION} GPU..."
|
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 cp -r "${TMP_DIR}/onnxruntime-linux-x64-gpu-${ORT_VERSION}/include/"* /usr/local/include/onnxruntime/
|
||||||
sudo mkdir -p /usr/local/lib64
|
sudo mkdir -p /usr/local/lib64
|
||||||
sudo cp -r "${TMP_DIR}/onnxruntime-linux-x64-gpu-${ORT_VERSION}/lib/"* /usr/local/lib64/
|
sudo cp -r "${TMP_DIR}/onnxruntime-linux-x64-gpu-${ORT_VERSION}/lib/"* /usr/local/lib64/
|
||||||
|
# onnxruntimeTargets.cmake resolves the library as <prefix>/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
|
sudo ldconfig
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user