2017-06-16 214 views
0

在macOS Sierra中,啓用openmp的xgboost安裝始終會失敗。ld:找不到的庫-lomp

https://xgboost.readthedocs.io/en/latest/build.html

我已經試過:

CP化妝/ config.mk ./config.mk;使-j4

有了,

export CC=/usr/local/Cellar/llvm/4.0.0_1/bin/clang 
export CXX=/usr/local/Cellar/llvm/4.0.0_1/bin/clang++ 
export CXX1X=/usr/local/Cellar/llvm/4.0.0_1/bin/clang++ 

它失敗,

clang-4.0clang-4.0: : warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]warning: 
argument unused during compilation: '-pthread' [-Wunused-command-line-argument] 
ld: library not found for -lomp 
ld: library not found for -lomp 
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation) 

LLVM支持OpenMP的,但它失敗ld: library not found for -lomp

相關的問題 Install xgboost on Mac - ld: library not found

但是,clang-omp會轉向boneyard,並停止使用llvm的OpenMP支持。

我鑽下來,(與-v選項)

/usr/local/Cellar/llvm/4.0.0_1/bin/clang++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -shared -o lib/libxgboost.so build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/common/hist_util.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_fast_hist.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit.a -pthread -lm -fopenmp 

回答

4

解決

cd /usr/local/lib 
ln -s /usr/local/Cellar/llvm/4.0.0_1/lib/libomp.dylib libomp.dylib 

LLVM安裝錯過它的符號鏈接。