You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Arch Linux中通过CMake安装XGBoost时遇依赖目录错误

解决Git仓库编译XGBoost时的CMake错误

问题场景

从Git仓库安装XGBoost时,执行以下编译命令:

cd xgboost
mkdir build
cd build 
cmake ..

运行cmake ..时触发如下错误:

-- CMake version 3.25.0
-- xgboost VERSION: 2.1.0
CMake Error at CMakeLists.txt:227 (add_subdirectory):
The source directory

/mnt/32F6E6CAF6E68D83/Downloads/xgboost/dmlc-core

does not contain a CMakeLists.txt file.

CMake Error at cmake/Utils.cmake:198 (set_target_properties):
set_target_properties Can not find target to add properties to: dmlc
Call Stack (most recent call first):
CMakeLists.txt:307 (xgboost_target_properties)

CMake Error at cmake/Utils.cmake:270 (target_link_libraries):
Cannot specify link libraries for target "dmlc" which is not built by this
project.
Call Stack (most recent call first):
CMakeLists.txt:308 (xgboost_target_link_libraries)

-- Configuring incomplete, errors occurred!
See also "/mnt/32F6E6CAF6E68D83/Downloads/xgboost/CMakeFiles/CMakeOutput.log".

问题原因

dmlc-core是XGBoost依赖的核心子模块,克隆仓库时未同步拉取子模块内容,导致该目录缺失必要的CMake配置文件,进而触发编译错误。

修复步骤

  1. 切换到xgboost主目录:
    cd /mnt/32F6E6CAF6E68D83/Downloads/xgboost
    
  2. 初始化并更新所有子模块:
    git submodule init
    git submodule update
    
  3. 清理旧的编译缓存并重新执行编译流程:
    rm -rf build
    mkdir build
    cd build
    cmake ..
    

内容的提问来源于stack exchange,提问作者Vaibhav Singh Chandel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 05:51:09