Skip to content

Commit 756e362

Browse files
committed
Add debug stuff, try to create symlink
1 parent ac7b387 commit 756e362

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

packaging/pre_build_script.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,114 @@ set -ex
77
# and PyTorch actually has it included. PyTorch, however, does not have the
88
# CMake helpers.
99
conda install -y pybind11 -c conda-forge
10+
11+
# Need to create a symlink for libnvcuvid.so.1 to libnvcuvid.so becuase that's
12+
# what Cmake is looking for and it doesn't exist by default. This is pretty
13+
# brittle.
14+
sudo ln -s libnvcuvid.so.1 /usr/lib64/libnvcuvid.so
15+
16+
17+
# Search for nvcuvid library in various locations for debugging CI build issues
18+
echo "[NVCUVID-SEARCH] === Searching for nvcuvid library ==="
19+
20+
# First, let's find where CUDA nppi libraries are located
21+
echo "[NVCUVID-SEARCH] Looking for CUDA nppi libraries to find potential nvcuvid location..."
22+
NPPI_LOCATIONS=()
23+
24+
# Search for CUDA nppi libraries that CMake should find
25+
for nppi_lib in "libnppi.so*" "libnppicc.so*" "nppi.so*" "nppicc.so*" "libnppi*" "libnppicc*"; do
26+
found_nppi=$(find /usr -name "$nppi_lib" 2>/dev/null | head -5)
27+
if [ -n "$found_nppi" ]; then
28+
echo "[NVCUVID-SEARCH] Found CUDA nppi library: $found_nppi"
29+
while IFS= read -r lib_path; do
30+
lib_dir=$(dirname "$lib_path")
31+
if [[ ! " ${NPPI_LOCATIONS[@]} " =~ " $lib_dir " ]]; then
32+
NPPI_LOCATIONS+=("$lib_dir")
33+
fi
34+
done <<< "$found_nppi"
35+
fi
36+
done
37+
38+
# Add these locations to our search paths
39+
for nppi_dir in "${NPPI_LOCATIONS[@]}"; do
40+
echo "[NVCUVID-SEARCH] Adding CUDA library directory to search: $nppi_dir"
41+
done
42+
43+
# Standard library search paths
44+
SEARCH_PATHS=(
45+
"/usr/lib"
46+
"/usr/lib64"
47+
"/usr/lib/x86_64-linux-gnu"
48+
"/usr/local/lib"
49+
"/usr/local/lib64"
50+
"/lib"
51+
"/lib64"
52+
"/opt/cuda/lib64"
53+
"/usr/local/cuda/lib64"
54+
"/usr/local/cuda/lib"
55+
"/usr/local/cuda-*/lib64"
56+
"/usr/local/cuda-*/lib"
57+
)
58+
59+
# Add the CUDA nppi library directories to our search paths
60+
for nppi_dir in "${NPPI_LOCATIONS[@]}"; do
61+
SEARCH_PATHS+=("$nppi_dir")
62+
done
63+
64+
# Library name variations to search for
65+
LIB_PATTERNS=(
66+
"libnvcuvid.so*"
67+
"nvcuvid.so*"
68+
"libnvcuvid.a"
69+
"nvcuvid.a"
70+
"libnvcuvid*"
71+
"nvcuvid*"
72+
)
73+
74+
found_libraries=()
75+
76+
for search_path in "${SEARCH_PATHS[@]}"; do
77+
if [ -d "$search_path" ]; then
78+
echo "[NVCUVID-SEARCH] Searching in: $search_path"
79+
for pattern in "${LIB_PATTERNS[@]}"; do
80+
# Use find with error suppression to avoid permission errors
81+
found_files=$(find "$search_path" -maxdepth 3 -name "$pattern" 2>/dev/null || true)
82+
if [ -n "$found_files" ]; then
83+
echo "[NVCUVID-SEARCH] Found: $found_files"
84+
found_libraries+=($found_files)
85+
fi
86+
done
87+
else
88+
echo "[NVCUVID-SEARCH] Directory not found: $search_path"
89+
fi
90+
done
91+
92+
# Also try using ldconfig to find the library
93+
echo "[NVCUVID-SEARCH] Checking ldconfig cache for nvcuvid..."
94+
if command -v ldconfig >/dev/null 2>&1; then
95+
ldconfig_result=$(ldconfig -p 2>/dev/null | grep -i nvcuvid || echo "Not found in ldconfig cache")
96+
echo "[NVCUVID-SEARCH] ldconfig result: $ldconfig_result"
97+
fi
98+
99+
# Try pkg-config if available
100+
echo "[NVCUVID-SEARCH] Checking pkg-config for cuda libraries..."
101+
if command -v pkg-config >/dev/null 2>&1; then
102+
pkg_result=$(pkg-config --list-all 2>/dev/null | grep -i cuda || echo "No CUDA packages found in pkg-config")
103+
echo "[NVCUVID-SEARCH] pkg-config cuda packages: $pkg_result"
104+
fi
105+
106+
# Summary
107+
if [ ${#found_libraries[@]} -gt 0 ]; then
108+
echo "[NVCUVID-SEARCH] === SUMMARY: Found ${#found_libraries[@]} nvcuvid library files ==="
109+
for lib in "${found_libraries[@]}"; do
110+
echo "[NVCUVID-SEARCH] $lib"
111+
# Show file info if possible
112+
if [ -f "$lib" ]; then
113+
ls -la "$lib" 2>/dev/null || true
114+
fi
115+
done
116+
else
117+
echo "[NVCUVID-SEARCH] === SUMMARY: No nvcuvid libraries found ==="
118+
fi
119+
120+
echo "[NVCUVID-SEARCH] === End nvcuvid library search ==="

0 commit comments

Comments
 (0)