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

npm install xgboost fails on OSX #7

Closed
dennismphil opened this issue Apr 26, 2018 · 4 comments
Closed

npm install xgboost fails on OSX #7

dennismphil opened this issue Apr 26, 2018 · 4 comments

Comments

@dennismphil
Copy link

dennismphil commented Apr 26, 2018

Description

npm install xgboost fails on Mac OS

Platform, Node.js version and C++ compiler version

Mac OS High Sierra 10.13.4

$ uname -a
Darwin 17.5.0 Darwin Kernel Version 17.5.0; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

$ node --version
v9.7.1

$ CC --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ gcc-7 --version
gcc-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Steps to reproduce this issue

Attempt 1

$ npm install xgboost
> xgboost@1.1.0 install /workspace/ews-360-sim/node_modules/xgboost
> bash ./build.sh; node-gyp rebuild

c++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
clang: error: unsupported option '-fopenmp'
make: *** [build/learner.o] Error 1
-----------------------------
Building multi-thread xgboost failed
Start to build single-thread xgboost
rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
rm -f -rf build_tests *.gcov tests/cpp/xgboost_test
cd dmlc-core; /Applications/Xcode.app/Contents/Developer/usr/bin/make clean; cd /workspace/ews-360-sim/node_modules/xgboost/xgboost
Makefile:9: make/config.mk: No such file or directory
make[1]: *** No rule to make target `make/config.mk'.  Stop.
cd rabit; /Applications/Xcode.app/Contents/Developer/usr/bin/make clean; cd /workspace/ews-360-sim/node_modules/xgboost/xgboost
...
...
clang: error: no such file or directory: 'dmlc-core/libdmlc.a'
make: *** [lib/libxgboost.dylib] Error 1
done building library
  CXX(target) Release/obj.target/xgboost/src/index.o
  CXX(target) Release/obj.target/xgboost/src/xgmodel.o
../src/xgmodel.cc:176:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1617:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.
  CXX(target) Release/obj.target/xgboost/src/xgmatrix.o
  SOLINK_MODULE(target) Release/xgboost.node
clang: error: no such file or directory: '../xgboost/dmlc-core/libdmlc.a'
make: *** [Release/xgboost.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/Cellar/node/8.1.4/bin/node" "/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Google Drive/workspace/ews-360-sim/node_modules/xgboost
gyp ERR! node -v v9.7.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN @fortawesome/react-fontawesome@0.0.18 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xgboost@1.1.0 install: `bash ./build.sh; node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xgboost@1.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2018-04-26T21_15_07_146Z-debug.log

Attempt 2

$ CC="gcc-7" CXX="g++-7" npm i xgboost
> xgboost@1.1.0 install /workspace/ews-360-sim/node_modules/xgboost
> bash ./build.sh; node-gyp rebuild

g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/learner.cc -o build/learner.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/logging.o src/logging.cc >build/logging.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/logging.cc -o build/logging.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/c_api/c_api.o src/c_api/c_api.cc >build/c_api/c_api.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/c_api/c_api.cc -o build/c_api/c_api.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/c_api/c_api_error.o src/c_api/c_api_error.cc >build/c_api/c_api_error.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/c_api/c_api_error.cc -o build/c_api/c_api_error.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/common/common.o src/common/common.cc >build/common/common.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/common/common.cc -o build/common/common.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/common/hist_util.o src/common/hist_util.cc >build/common/hist_util.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/common/hist_util.cc -o build/common/hist_util.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/data/data.o src/data/data.cc >build/data/data.d
g++-7 -c -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/data/data.cc -o build/data/data.o
g++-7 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude   -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -fopenmp -MM -MT build/data/simple_csr_source.o src/data/simple_csr_source.cc >build/data/simple_csr_source.d
...
...
...
g++-7: error: dmlc-core/libdmlc.a: No such file or directory
make: *** [lib/libxgboost.dylib] Error 1
-----------------------------
Building multi-thread xgboost failed
Start to build single-thread xgboost
rm -f -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
rm -f -rf build_tests *.gcov tests/cpp/xgboost_test
cd dmlc-core; /Applications/Xcode.app/Contents/Developer/usr/bin/make clean; cd /workspace/ews-360-sim/node_modules/xgboost/xgboost
Makefile:9: make/config.mk: No such file or directory
make[1]: *** No rule to make target `make/config.mk'.  Stop.
cd rabit; /Applications/Xcode.app/Contents/Developer/usr/bin/make clean; cd /workspace/ews-360-sim/node_modules/xgboost/xgboost
...
...
...
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_empty.a -pthread -lm
g++-7: error: dmlc-core/libdmlc.a: No such file or directory
make: *** [lib/libxgboost.dylib] Error 1
done building library
  CXX(target) Release/obj.target/xgboost/src/index.o
g++-7: error: unrecognized command line option '-stdlib=libc++'
make: *** [Release/obj.target/xgboost/src/index.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/Cellar/node/8.1.4/bin/node" "/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Google Drive/workspace/ews-360-sim/node_modules/xgboost
gyp ERR! node -v v9.7.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xgboost@1.1.0 install: `bash ./build.sh; node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xgboost@1.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2018-04-26T21_22_18_780Z-debug.log

Is compilation on Mac OS supported as claimed in the README?

@qinwf-nuan
Copy link
Contributor

The log file shows that you are using node-gyp with node 8.1.4, while npm install is using node 9.7.1.

gyp ERR! command "/usr/local/Cellar/node/8.1.4/bin/node" "/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Google Drive/workspace/ews-360-sim/node_modules/xgboost
gyp ERR! node -v v9.7.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

It works on this machine

c++ -v
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

npm --version
5.6.0

node --version
v9.11.1

uname -a
Darwin a.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

https://gist.github.com/qinwf-nuan/5b762163a97a634476f6e89ac610410a

@dennismphil
Copy link
Author

Thanks for the quick response. I switched to the node/npm versions above and removed node_modules directory and retried issuing npm install xgboost. However, it still fails.

node-gyp not sure why it is taking node v8.1.4

$ c++ -v
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ npm -v
5.6.0

$ node -v
v9.11.1

Full log here:
https://gist.github.com/dennismphil/23a7eca662be55593a0cce661a64bae4

@qinwf-nuan
Copy link
Contributor

https://gist.github.com/dennismphil/23a7eca662be55593a0cce661a64bae4#file-out-txt-L122-L123

There is an error:

cd dmlc-core; /Applications/Xcode.app/Contents/Developer/usr/bin/make libdmlc.a config=/workspace/node_modules/xgboost/xgboost/make/minimum.mk; cd /Users/dphilip/Google Driveoost/xgboost
make[1]: *** /Users/dphilip/Google: Is a directory.  Stop.

@dennismphil
Copy link
Author

dennismphil commented Apr 27, 2018

The parent folder path had a space😥

/Users/dphilip/Google Drive/workspace

Works perfectly fine when I run this from a different folder. Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants