nodejs / node-gyp

Node.js native addon build tool
MIT License
9.92k stars 1.79k forks source link

node-gyp rebuild Fails on Mac OS X 10.9.4 #489

Closed shkfnly closed 6 years ago

shkfnly commented 10 years ago

Terminal output


hiredis@0.1.17
node@v0.11.13
node-gyp@v1.0.1
npm@1.4.9

which libtool
/usr/bin/libtool

$ npm install -g hiredis
npm http GET https://registry.npmjs.org/hiredis
npm http 304 https://registry.npmjs.org/hiredis
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/nan

> hiredis@0.1.17 install /usr/local/lib/node_modules/hiredis
> node-gyp rebuild

  CC(target) Release/obj.target/hiredis/deps/hiredis/hiredis.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/net.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/sds.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/async.o
  LIBTOOL-STATIC Release/hiredis.a
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make: *** [Release/hiredis.a] 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/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1046:12)
gyp ERR! System Darwin 13.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/hiredis
gyp ERR! node -v v0.11.13
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! hiredis@0.1.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hiredis@0.1.17 install script.
npm ERR! This is most likely a problem with the hiredis 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 hiredis
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.3.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "hiredis"
npm ERR! cwd /Users/ashokafinley
npm ERR! node -v v0.11.13
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/ashokafinley/npm-debug.log
npm ERR! not ok code 0

joemanfoo commented 10 years ago

I get similar issue on Ubuntu 12.04.5 LTS. when I try to install nodetime. Some suggest that python needs to be installed (which I have) so just posting this to hope that it helps you in case you do not have python installed.

sanderhouttekier commented 10 years ago

@joemanfoo and installing python works? because I have python but that doesn't make this rebuild correctly.

when i install node-gyp manually npm install node-gyp it installs just fine. so it leads me to believe the weak module which has node-gyp as dependency just uses it wrong. i made a ticket over there as well.

https://github.com/TooTallNate/node-weak/issues/30

jfroffice commented 10 years ago

on darwin (MacOS) xcode-select --install did the job

wa0x6e commented 10 years ago

@jfroffice, xcode-select --install did not works for me, on Yosemite.

Downgrading node.js to the 0.10.x branch seems to fix the thing.

jfroffice commented 10 years ago

@kamisama, I am also on node.js 0.10.x.

nousacademy commented 9 years ago

this binding.gyp file is the biggest pain in the ass

Globegitter commented 9 years ago

Any solution for node 0.11.x yet? Getting the same error on Mac OSX 10.10. Works with node 0.10.x though.

veacks commented 9 years ago

If you are using Homebrew, this link was very usefull for me: http://flummox-engineering.blogspot.com.au/2014/04/libtool-unrecognized-option-static.html

brew unlink libtool

They was a conflict between usr/bin/libtool (Xcode) and usr/local/bin/libtool (HomeBrew)

topherhunt commented 9 years ago

Ditto what @Globegitter said: I've given up trying to get around this failed build on Mac OSX and Node v0.12 (I'm trying to npm install canvas which requires node-gyp) but once I removed Node and installed version 0.10.9 instead (directly from nodejs.org, rather than via Homebrew), canvas and node-gyp install fine.

My issue sounds more similar to https://github.com/Homebrew/homebrew/issues/14123 in that the error message when rebuilding node-gyp was Package 'xcb-shm', required by 'cairo', not found, but the only solution that's worked for me so far was the Node version downgrade mentioned above.

oliveremi commented 9 years ago

http://stackoverflow.com/questions/22100213/package-cairo-was-not-found-in-the-pkg-config-search-path-node-j-s-install-canv This worked for me (answer by Piyush Dholariya)

akhildave commented 9 years ago

@Arkantas Many Thanks for the link, It really helped me out :)

pipi32167 commented 9 years ago

Same problem here. But I found my libtool is actully /opt/chefdk/embedded/bin/libtool, so sudo rm -rf /opt/chefdk can solve my problem.

kristianmandrup commented 9 years ago

I raised this issue https://github.com/redis/hiredis-node/issues/94

mydearxym commented 9 years ago

gyp: binding.gyp not found ... big pain

turboladen commented 9 years ago

I'm on El Capitan (10.11) and @veacks suggestion of brew unlink libtool did the trick for me.

adriano-di-giovanni commented 9 years ago

Just solved same problem.

In my case, Mac OS X automatic updates downloaded and installed a new version of XCode.

As you may know, you have to accept the license agreement in order to use both XCode and its command line tools.

libtool is one of these command line tools. libtool is used by node-gyp.

I run libtool and accepted license agreement via terminal.

Everything worked soon after.

yaron-idan commented 8 years ago

@adriano-di-giovanni, I've tried running libtool to accept the agreement and got this output -

 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
 Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
 Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

Could you help me solve this please?

adriano-di-giovanni commented 8 years ago

Running libtool is just a shortcut to accept license agreement. I don't know why it fails on your machine but you can always open XCode and accept the license agreement.

Try and please, let me know πŸ˜‰

Inviato da iPhone

Il giorno 02 nov 2015, alle ore 15:44, Yaron Idan notifications@github.com ha scritto:

@adriano-di-giovanni, I've tried running libtool to accept the agreement and got this output - error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols] Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load]

Could you help me solve this please?

β€” Reply to this email directly or view it on GitHub.

yaron-idan commented 8 years ago

True enough, XCode license wasn't my problem, and the license agreement was already accepted (as I found out through opening XCode like you advised) The problem ended up being node not upgraded to suit El-Capitan, after I upgraded it everything went pretty smooth...

Thank you for the support!

adriano-di-giovanni commented 8 years ago

You're welcome πŸ˜‰

Inviato da iPhone

Il giorno 03 nov 2015, alle ore 09:31, Yaron Idan notifications@github.com ha scritto:

True enough, XCode license wasn't my problem, and the license agreement was already accepted (as I found out through opening XCode like you advised) The problem ended up being node not upgraded to suit El-Capitan, after I upgraded it everything went pretty smooth...

Thank you for the support!

β€” Reply to this email directly or view it on GitHub.

carljokl commented 8 years ago

I am on Yosemite (10.10.5) tried with Node 5.0.0 then with 0.10.x direct from Node.js website and have this issue and nothing listed above has fixed the problem.

qmmr commented 8 years ago

I've had a similar issue with node-gyp and node v5.0.0 but it turned out to be the xcode that was causing issues. After accepting the license via sudo xcodebuild -license it was a smooth ride.

mmahalwy commented 8 years ago

@yaron-idan what did you mean you upgraded everything? What'd you upgrade?

yaron-idan commented 8 years ago

@mmahalwy My node version was <5.0.0, I don't remember the exact number. After I've upgraded node to 5.0.0 and npm to 3.3.9 the problem was solved.

vudodov commented 8 years ago
xcode-select --install
npm install -g npm@latest

worked for me

yamii commented 8 years ago

I have darwin and node 5.0 installed sudo xcodebuild -license fix my issue. Thanks @qmmr

haschu commented 8 years ago

Same problem as @topherhunt while trying to install canvas. brew install pkg-config solved the problem for me.

mdodkins commented 8 years ago

this is a useful link... http://flummox-engineering.blogspot.com/2014/04/libtool-unrecognized-option-static.html

basically, if you're using GNU Libtool, you need to unlink it... I had to do this manually because I was using it, but not because of brew...

cecilialam commented 8 years ago

@adriano-di-giovanni suggestion works for me. Thanks for your post!

ulesta commented 8 years ago

Ran all the suggested commands above and still didn't work. Restarted my computer and it started working magically. So if all fails, try restarting! πŸ‘

nihakue commented 8 years ago

I was having this problem on OSX v10.11.5 (15F34) running node v6.2.1 and sudo xcodebuild -license seems to have resolved it. Weird.

xdamman commented 8 years ago

Same issue with:

MacOSX 10.11.6 (also tried with MacOSX 10.11.5)
node v.6.3.1 (also tried with node v6.2.2)
npm 3.10.3
python 2.7.10

I did sudo xcodebuild -license

I did xcode-select --install

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Still doesn't work. Then I tried brew unlink libtool

Error: No such keg: /usr/local/Cellar/libtool

Still doesn't work. Then I tried brew install pkg-config

Warning: pkg-config-0.29.1_1 already installed

Still no luck. Running out of ideas.

npm install -g node-gyp works like a charm. but npm install still fails at:

> bcrypt@0.8.5 install /Users/xdamman/github/opencollective/api/node_modules/bcrypt
> node-gyp rebuild

My only luck was to downgrade node to v5.12.0.

xdamman commented 8 years ago

Update, I solved it. This was happening when npm was trying to install bcrypt.

For some reason, within the project, npm install bcrypt was failing, but npm install -g bcrypt worked. So running within the directory of the project npm link bcrypt did the trick.

This is still weird. Not sure what's wrong with my setup.

xdamman commented 8 years ago

Update 2: the reason why it was working with npm -g is because it was installing bcrypt 0.8.7, whereas within the project directory, it was installing bcrypt 0.8.5. So updating the version number of bcrypt in package.json solved the issue. Mystery solved!

afacanerman commented 8 years ago

@xdamman cheers saved my night.

mevlutsahinn commented 7 years ago

@xdamman thank you. Worked like charm after trying tons of suggestions.

mbutler commented 7 years ago

None of the suggestions in this issue thread worked for me except downgrading node to 6.10.0 LTS

intafon commented 7 years ago

@mbutler Same here. I had lwip installing fine running node-gyp rebuild, then updated brew this morning and updated node from 7.7.2 to 7.7.3 and it broke it. After trying many things, finally uninstalled node from brew altogether and installed 6.10.0LTS from nodejs.org...

now I need to go back and discover what else has been broken by this whole process... :-/

erick2014 commented 7 years ago

tested in mac os x 10.11.6, using v6.10.1 and npm 4.4.4, I run npm install -g npm@latest node-gyp, and now I'm able to compile the modules

brycereynolds commented 7 years ago

I just encountered this issue and realized that previously I had used pyenv and changed my python version. Since it seems to be involved in the compiling of bcrypt (news to me), I had to change my python version back to 2.7.10 to make it work:

pyenv global 2.7.10

tomchapin commented 7 years ago

I use pyenv to manage my python installations, and I was unable to get node-gyp to build until I explicitly configured npm so that it used the correct python virtualenv shim, like so: npm config set python /Users/your_username_here/.pyenv/versions/2.7.10/envs/virtual_env_name_here/bin/python

refack commented 7 years ago

Do you know if pyenv has a local registry that node-gyp can query (or a stable path)?

tomchapin commented 7 years ago

@refack the .pyenv directory is typically at the user's home folder at $HOME/.pyenv but the path can also be determined by evaluating $(pyenv root)/ or by looking at the PYENV_ROOT environment variable.

maclover7 commented 6 years ago

It seems like general installation issues (XCode license, etc.) was the issue here, as well as running on outdated versions of Node.js and node-gyp. Upgrading Node.js / node-gyp to a supported version will fix this problem, so going to close this this ticket for now since a fix has been identified.

toadead commented 6 years ago

Node v9.11.2 with npm 5.6.0 seemed working for me

mattbontrager commented 6 years ago

For anyone who still runs into this issue, here's the fix: npm config set python /usr/bin/python.

I finally figured out what the actual problem is. npm is being pointed to the userland python (typically installed by brew ... /usr/local/bin/python) not the system level python (/usr/bin/python). I just didn't know that there was a system level python.

shaunlebron commented 5 years ago

@mattbontrager's solution fixed it for me. I had a Python 3 at /usr/local/bin/python, and node-gyp needs Python 2 at /usr/bin/python

simesy commented 5 years ago

brew upgrade worked for me. must not have done it since OSX update

tamitutor commented 5 years ago

You may want to look at what package you are trying to install. For instance, the firebase@latest package fails with node-gyp because it has an outdated grpc dependency. I was trying to do just that and ended up having to downgrade my node version to 10.13.0 in order to avoid the node-gyp build errors when installing firebase.

schakra19 commented 5 years ago

This helped me solve the problem of node-gyp version - https://github.com/nodejs/node-gyp/wiki/Updating-npm%27s-bundled-node-gyp