Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build fails without OPENMP after setting USE_OPENMP=OFF #5518

Closed
aviks opened this issue Apr 12, 2020 · 0 comments · Fixed by #5566
Closed

CMake build fails without OPENMP after setting USE_OPENMP=OFF #5518

aviks opened this issue Apr 12, 2020 · 0 comments · Fixed by #5566

Comments

@aviks
Copy link

aviks commented Apr 12, 2020

The CMake option of USE_OPENMP=OFF is meant to allow compilation of xgboost without the OpenMP libraries. However this fails on master. It did work as expected on 1.0.2 and 0.82.0

Build Script:

git submodule init; git submodule update
mkdir build; cd build
cmake .. -DUSE_OPENMP=OFF
make -j2

On a Mac, using clang, without libgomp installed, we get a compiler error

[ 47%] Building CXX object src/CMakeFiles/objxgboost.dir/metric/rank_metric.cc.o
/Users/aviks/dev/julia/xgboost/src/metric/rank_metric.cc:192:13: error: use of undeclared identifier 'omp_in_parallel'
        if (omp_in_parallel()) {
            ^
/Users/aviks/dev/julia/xgboost/src/metric/rank_metric.cc:560:13: error: use of undeclared identifier 'omp_in_parallel'
        if (omp_in_parallel()) {
            ^
2 errors generated.
make[2]: *** [src/CMakeFiles/objxgboost.dir/metric/rank_metric.cc.o] Error 1
make[1]: *** [src/CMakeFiles/objxgboost.dir/all] Error 2
make: *** [all] Error 2

On a linux machine with gcc9, we get a linker error

[ 98%] Linking CXX executable ../xgboost
/usr/bin/ld: src/CMakeFiles/objxgboost.dir/metric/rank_metric.cc.o: in function `xgboost::metric::EvalAucPR::Eval(xgboos
t::HostDeviceVector<float> const&, xgboost::MetaInfo const&, bool)':
rank_metric.cc:(.text._ZN7xgboost6metric9EvalAucPR4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb[_ZN7xgboost6metric9E
valAucPR4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb]+0x5a4): undefined reference to `omp_in_parallel'
/usr/bin/ld: rank_metric.cc:(.text._ZN7xgboost6metric9EvalAucPR4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb[_ZN7xgb
oost6metric9EvalAucPR4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb]+0x1069): undefined reference to `omp_in_parallel
'
/usr/bin/ld: src/CMakeFiles/objxgboost.dir/metric/rank_metric.cc.o: in function `xgboost::metric::EvalAuc::Eval(xgboost:
:HostDeviceVector<float> const&, xgboost::MetaInfo const&, bool)':
rank_metric.cc:(.text._ZN7xgboost6metric7EvalAuc4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb[_ZN7xgboost6metric7Eva
lAuc4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb]+0x484): undefined reference to `omp_in_parallel'
/usr/bin/ld: rank_metric.cc:(.text._ZN7xgboost6metric7EvalAuc4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb[_ZN7xgboo
st6metric7EvalAuc4EvalERKNS_16HostDeviceVectorIfEERKNS_8MetaInfoEb]+0x864): undefined reference to `omp_in_parallel'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/runxgboost.dir/build.make:191: ../xgboost] Error 1
make[1]: *** [CMakeFiles/Makefile2:172: CMakeFiles/runxgboost.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants