-
Notifications
You must be signed in to change notification settings - Fork 540
Description
It won't build on my FreeBSD 10.1 system due to lack of GCC presence. FreeBSD uses Clang as it's default compiler (clang, clang++ and clang-cpp) providing alternative symlinks such as (c++, c89, c99, cc, cpp) to remain compatible with GCC.
This is what I get after trying npm install
[email protected] install /usr/home/babaei/dev/TaxiServer/node_modules/bcrypt
node-gyp rebuild
gmake: Entering directory '/usr/home/babaei/dev/TaxiServer/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
gmake: g++: Command not found
bcrypt_lib.target.mk:85: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
gmake: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
gmake: Leaving directory '/usr/home/babaei/dev/TaxiServer/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: gmake failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System FreeBSD 10.1-STABLE
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/home/babaei/dev/TaxiServer/node_modules/bcrypt
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! FreeBSD 10.1-STABLE
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm v2.1.18
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/home/babaei/dev/TaxiServer/npm-debug.log
I fixed the issue by editing binding.gyp as follows (also I had to install sysutils/flock from ports):
{
'make_global_settings': [
['CXX','/usr/bin/clang++'],
['LINK','/usr/bin/clang++'],
],
'targets': [
{
'target_name': 'bcrypt_lib',
'sources': [
'src/blowfish.cc',
'src/bcrypt.cc',
'src/bcrypt_node.cc'
],
'include_dirs' : [
"<!(node -e "require('nan')")"
],
'conditions': [
[ 'OS=="win"', {
'defines': [
'uint=unsigned int',
],
}],
],
}
]
}
Is there anyway to make clang the default compiler on FreeBSD systems? cause putting cc and link settings in conditions section won't work.