我试图在XGBoost之后为Python构建these instructions包:
以下是使用支持OpenMP的编译器安装XGBoost的完整解决方案。通过
brew install gcc --without-multilib
的openmp支持获取gcc-5.x.x. (brew是OS X上apt-get的事实标准。因此不建议单独安装HPC,但它应该可以工作。):
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/config.mk ./config.mk; make -j4
此错误恰好出现在make -j4
命令中。
在搜索之前,我已经尝试过这两个解决方案(1和2),但是没有用,除了因为害怕搞乱所有内容而安装另一个gcc的部分。
以下是make
配置文件。它没有任何可疑之处。
#-----------------------------------------------------
# xgboost: the configuration compile script
#
# If you want to change the configuration, please use the following
# steps. Assume you are on the root directory of xgboost.
# First copy the this file so that any local changes will be ignored by git
#
# $ cp make/config.mk .
#
# Next modify the according entries, and then compile by
#
# $ make
#
# or build in parallel with 8 threads
#
# $ make -j8
#----------------------------------------------------
# choice of compiler, by default use system preference.
# export CC = gcc
# export CXX = g++
# export MPICXX = mpicxx
# the additional link flags you want to add
ADD_LDFLAGS =
# the additional compile flags you want to add
ADD_CFLAGS =
# Whether enable openmp support, needed for multi-threading.
USE_OPENMP = 1
# whether use HDFS support during compile
USE_HDFS = 0
# whether use AWS S3 support during compile
USE_S3 = 0
# whether use Azure blob support during compile
USE_AZURE = 0
# Rabit library version,
# - librabit.a Normal distributed version.
# - librabit_empty.a Non distributed mock version,
LIB_RABIT = librabit.a
# path to libjvm.so
LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
# List of additional plugins, checkout plugin folder.
# uncomment the following lines to include these plugins
# you can also add your own plugin like this
#
# XGB_PLUGINS += plugin/example/plugin.mk
答案 0 :(得分:30)
您使用Homebrew安装了gcc
,但错误来自clang
。这应该只是意味着您的默认编译器仍然指向clang
而不是新安装的gcc
。如果您阅读Makefile中的注释,您将看到以下行:
# choice of compiler, by default use system preference.
# export CC = gcc
# export CXX = g++
# export MPICXX = mpicxx
在您的情况下,您不希望系统一个
注意:系统的gcc
指向clang
:
$ which gcc
/usr/bin/gcc
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
相反,将这些变量指向/usr/local/bin
中的某些内容,例如:
$ export CC=/usr/local/bin/gcc
和其他两个变量类似CXX
和MPICXX
,例如:
$ export CC=/usr/local/bin/gcc;CXX=/usr/local/bin/g++;MPICXX=/usr/local/bin/mpicxx
答案 1 :(得分:9)
cd xgboost; cp make / minimum.mk ./config.mk; make -j4
而不是
的“Build On OSX”部分cd xgboost; cp make / config.mk ./config.mk; make -j4
答案 2 :(得分:2)
为了解决这个问题,我做了以下事情:我意识到我安装了community two
6,所以我跑了:
gcc
但它本身并不起作用,所以我还必须:
export CC=gcc-6
这为我解决了。我正在运行macOS Sierra的Macbook Pro中。如果需要,您也可以直接在XGBoost的Makefile上进行这些更改。有关此内容的详细信息:https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_on_Mac_OSX?lang=en
答案 3 :(得分:0)
无法编译本机libxgboost.dylib库,请检查此workaround