我正在尝试使用以下命令通过 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".
如果您从网站下载了 tarball,它不包含 git 子模块(例如 dmlc-core;请参阅 https://github.com/dmlc/xgboost/issues/3594 进行进一步讨论)。
如果您使用这些步骤,是否会遇到同样的错误?
git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update
cd xgboost
mkdir build
cd build
cmake ..
make -j$(nproc)