Skip to content

Commit 00f9199

Browse files
Fix all CMake dependency issues
Resolved issues: 1. MKL_H NOTFOUND - Added Intel oneAPI setvars.sh sourcing and CMAKE_PREFIX_PATH 2. fmt library not found - Installed libfmt-dev package 3. Additional warnings: - numa library - Installed libnuma-dev package - glog not found - Installed libgoogle-glog-dev package - libgomp conflict - Set LD_LIBRARY_PATH to prioritize system library All system dependencies now properly installed and environment configured.
1 parent 97c4cd5 commit 00f9199

2 files changed

Lines changed: 31 additions & 19 deletions

File tree

algorithms_impl/build.sh

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,22 @@ echo "Configuring with CMake..."
3535
echo "----------------------------------------"
3636

3737
# 设置 MKL 环境变量(Puck 需要)
38+
if [ -f "/opt/intel/oneapi/setvars.sh" ]; then
39+
echo " Loading Intel oneAPI environment..."
40+
source /opt/intel/oneapi/setvars.sh --force 2>/dev/null
41+
fi
42+
3843
if [ -d "/opt/intel/oneapi/mkl/latest" ]; then
3944
export MKLROOT="/opt/intel/oneapi/mkl/latest"
4045
export LD_LIBRARY_PATH="$MKLROOT/lib/intel64:$LD_LIBRARY_PATH"
4146
export CPATH="$MKLROOT/include:$CPATH"
47+
export CMAKE_PREFIX_PATH="$MKLROOT:$CMAKE_PREFIX_PATH"
4248
echo " MKL found: $MKLROOT"
4349
elif [ -d "/opt/intel/mkl" ]; then
4450
export MKLROOT="/opt/intel/mkl"
4551
export LD_LIBRARY_PATH="$MKLROOT/lib/intel64:$LD_LIBRARY_PATH"
4652
export CPATH="$MKLROOT/include:$CPATH"
53+
export CMAKE_PREFIX_PATH="$MKLROOT:$CMAKE_PREFIX_PATH"
4754
echo " MKL found: $MKLROOT"
4855
else
4956
echo " ⚠ Warning: MKL not found"
@@ -59,28 +66,26 @@ else
5966
echo " ⚠ Warning: Could not get torch.utils.cmake_prefix_path"
6067
fi
6168

62-
# 运行 CMake 配置 (CPU only)
69+
# 构建 CMake 参数
70+
CMAKE_ARGS=(
71+
-DCMAKE_BUILD_TYPE=Release
72+
-DPYTHON_EXECUTABLE=$(which python3)
73+
-DFAISS_ENABLE_GPU=OFF
74+
-DFAISS_ENABLE_PYTHON=OFF
75+
-DBUILD_TESTING=OFF
76+
)
77+
78+
# 添加 torch 路径
6379
if [ -n "$TORCH_CMAKE_PATH" ]; then
64-
cmake .. \
65-
-DCMAKE_BUILD_TYPE=Release \
66-
-DPYTHON_EXECUTABLE=$(which python3) \
67-
-DCMAKE_PREFIX_PATH="$TORCH_CMAKE_PATH" \
68-
-DFAISS_ENABLE_GPU=OFF \
69-
-DFAISS_ENABLE_PYTHON=OFF \
70-
-DBUILD_TESTING=OFF \
71-
2>&1 | tee cmake_config.log \
72-
|| { echo ""; echo "❌ CMake configuration failed"; cat cmake_config.log | tail -100; exit 1; }
73-
else
74-
cmake .. \
75-
-DCMAKE_BUILD_TYPE=Release \
76-
-DPYTHON_EXECUTABLE=$(which python3) \
77-
-DFAISS_ENABLE_GPU=OFF \
78-
-DFAISS_ENABLE_PYTHON=OFF \
79-
-DBUILD_TESTING=OFF \
80-
2>&1 | tee cmake_config.log \
81-
|| { echo ""; echo "❌ CMake configuration failed"; cat cmake_config.log | tail -100; exit 1; }
80+
CMAKE_ARGS+=(-DCMAKE_PREFIX_PATH="$TORCH_CMAKE_PATH")
8281
fi
8382

83+
# 运行 CMake 配置
84+
echo " Running: cmake ${CMAKE_ARGS[@]} .."
85+
cmake "${CMAKE_ARGS[@]}" .. \
86+
2>&1 | tee cmake_config.log \
87+
|| { echo ""; echo "❌ CMake configuration failed"; cat cmake_config.log | tail -100; exit 1; }
88+
8489
echo ""
8590
echo "========================================="
8691
echo "Building Thirdparty Libraries"

deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ if [ "$SKIP_SYSTEM_DEPS" = false ]; then
201201
sudo apt-get update -qq || print_warning "更新 Intel 源失败"
202202
sudo apt-get install -y intel-oneapi-mkl-devel || print_warning "Intel MKL 安装失败,Puck 可能无法构建"
203203

204+
# 设置 MKL 环境变量
205+
if [ -f "/opt/intel/oneapi/setvars.sh" ]; then
206+
print_step "设置 MKL 环境变量..."
207+
source /opt/intel/oneapi/setvars.sh --force
208+
print_success "MKL 环境已配置"
209+
fi
210+
204211
echo ""
205212
print_success "系统依赖安装完成"
206213
;;

0 commit comments

Comments
 (0)