Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

node build fails on OS X 10.11 #40653

Closed
mologie opened this issue Jun 13, 2015 · 27 comments
Closed

node build fails on OS X 10.11 #40653

mologie opened this issue Jun 13, 2015 · 27 comments

Comments

@mologie
Copy link

mologie commented Jun 13, 2015

EDIT: This issue appears on Google now and seems to affect quite a few people. To spare you from reading the comments:

The solution for the issue described here is to install Xcode 7 and configure it as default toolchain. Xcode 6 is not supported on OS X 10.11.


$ brew install node --with-icu4c --with-openssl   
==> Downloading https://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/node-0.12.4.tar.gz
==> ./configure --prefix=/Users/oliver/.local/Cellar/node/0.12.4 --without-npm --with-intl=system-icu --shared-openssl
==> make install
  ./gyp-mac-tool flock /private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/linker.lock clang++ -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L/private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release  -o "/private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/mksnapshot" /private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/obj.target/mksnapshot/deps/v8/src/mksnapshot.o /private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/libv8_base.a /private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/libv8_nosnapshot.a /private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/libv8_libplatform.a /private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/libv8_libbase.a -L/Users/oliver/.local/Cellar/openssl/1.0.2a-1/lib -lssl -lcrypto -L/Users/oliver/.local/Cellar/icu4c/55.1/lib -licui18n -licuuc -licudata
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [/private/tmp/node20150613-90188-1v83nmc/node-v0.12.4/out/Release/mksnapshot] Error 1
make: *** [node] Error 2

This is likely an upstream issue in node-gyp: Apple removed the deprecated symlinks from libgcc*.dylib to libSystem.B.dylib.

Note that I have Homebrew installed under $HOME/.local, but considering the nature of the error, I would not deem this relevant. Installation with the same setup succeeds on OS X 10.10.

Harmless workaround for us early adopters:

$ cd /usr/local/lib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib
@mistydemeo
Copy link
Member

Apple appears to be shipping .tbd files for libgcc_s.10.{4,5}.

At least on my 10.10 system (upgraded from previous OS Xs), libgcc_s.10.4.dylib is not a symlink to libSystem the way that libgcc_s.1.dylib is.

@mistydemeo
Copy link
Member

Also, for reference, I was able to install node on 10.11 using the Xcode 7 CLT without an issue. Maybe there's an issue with your setup? Can you provide the output of brew gist-logs node please?

@mologie
Copy link
Author

mologie commented Jun 13, 2015

You are right, it looks like the reason this worked before is that the required symlinks exists in the OS X 10.10 SDK:

# oliver at Olivers-MacBook-Pro.fritz.box in /Applications/Xcode.app/Contents [19:18:15]
$ find . -iname 'libgcc_s.10.4*' 
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libgcc_s.10.4.dylib
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libgcc_s.10.4.dylib

# oliver at Olivers-MacBook-Pro.fritz.box in /Applications/Xcode.app/Contents [19:18:27]
$ ls -l ./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libgcc_s*
lrwxr-xr-x  1 root  wheel     17 Jun 10 22:35 ./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libgcc_s.1.dylib -> libSystem.B.dylib
lrwxr-xr-x  1 root  wheel     19 Jun 10 22:35 ./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libgcc_s.10.4.dylib -> libgcc_s.10.5.dylib
-rwxr-xr-x  1 root  wheel  30976 Sep  9  2014 ./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libgcc_s.10.5.dylib

In the Xcode beta, they are gone:

# oliver at Olivers-MacBook-Pro.fritz.box in /Applications/Xcode-beta.app [19:20:03]
$ find . -iname 'libgcc_s.10.4*'                                                              
./Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libgcc_s.10.4.tbd
./Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libgcc_s.10.4.tbd

The Xcode stable version is my current command-line SDK according to xcode-select -p. I am unfamiliar with what tbd files actually are - this is the first time I stumbled upon them and Google is not very helpful on the issue.

@mistydemeo
Copy link
Member

I am unfamiliar with what tbd files actually are - this is the first time I stumbled upon them and Google is not very helpful on the issue.

They're new to Xcode 7, and I don't believe there is any public documentation on them yet.

@mologie
Copy link
Author

mologie commented Jun 13, 2015

That is probably the reason why the Xcode 6 toolchain did not pick these libraries/links up in the first place. This issue may just "go away" once Xcode 7 ships as default toolchain for OS X 10.11.

Using the Xcode 7 toolchain, everything worked as expected:

$ brew rm node
Error: No such keg: /Users/oliver/.local/Cellar/node

$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
Password:

$ xcode-select -p
/Applications/Xcode-beta.app/Contents/Developer

$ clang -v
Apple LLVM version 7.0.0 (clang-700.0.53)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

$ brew install node
==> Downloading https://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/node-0.12.4.tar.gz
==> ./configure --prefix=/Users/oliver/.local/Cellar/node/0.12.4 --without-npm --without-ssl2 --without-ssl3
==> make install
==> Downloading https://registry.npmjs.org/npm/-/npm-2.10.1.tgz
Already downloaded: /Library/Caches/Homebrew/node--npm-2.10.1.tgz
==> ./configure --prefix=/Users/oliver/.local/Cellar/node/0.12.4/libexec/npm
==> make install
==> Caveats
Bash completion has been installed to:
  /Users/oliver/.local/etc/bash_completion.d
==> Summary
/Users/oliver/.local/Cellar/node/0.12.4: 2590 files, 28M, built in 4.4 minutes

Thank you for the quick feedback - lesson learned, early access software tends to bite :). Shall we leave this bug report open for future reference, or close right away?

@mistydemeo
Copy link
Member

Ah, yep, that would be the reason. We don't support Xcode 6 on 10.11; you need to use Xcode 7 to build software on 10.11. I'll close this then, thanks!

@MikeMcQuaid
Copy link
Member

@mistydemeo Perhaps we should hard-error in that case?

@mistydemeo
Copy link
Member

@MikeMcQuaid After #40536 is merged, maybe? We'd get a doctor warning there but hard erroring might be better than continuing to field these reports.

@MikeMcQuaid
Copy link
Member

@DomT4 ❤️

@galxy25
Copy link

galxy25 commented Jul 11, 2015

👍 for @mologie writeup. Saved me today.

@mrtorks
Copy link

mrtorks commented Jul 23, 2015

Saved my ass and I do believe we should keep it open.

@mologie
Copy link
Author

mologie commented Jul 23, 2015

This issue should remain closed. As discussed in the comments, the issue was with my setup: Xcode 6 is not supported on OS X 10.11. Install Xcode 7 and configure Xcode 7 as default toolchain. With Xcode 7, node builds just fine without the workaround mentioned in my first post.

@paulhybryant
Copy link

I am seeing this error in my OSX 10.10 too.

@snikch
Copy link

snikch commented Sep 20, 2015

This occurred to me too in OSX 10.10 after I downloaded an updated command line tools. Updating Xcode to 7 fixed the issue for me too.

@JoeyCarson
Copy link

Hate to ask on this thread, but I'm a little desperate. I'm having the same build issue for libjpeg-turbo since updating to Xcode 7 and El Captian (missing libgcc). The comment above mentions to set Xcode 7 as the default toolchain. What do you mean by setting it as the default toolchain? For instance, I'm using a configure and make style build for libjpeg-turbo. Is there another step I need to take to make this work with Xcode 7?

@DomT4
Copy link
Member

DomT4 commented Sep 24, 2015

@JoeyCarson Open a new issue with brew gist-logs libjpeg-turbo if you like.

@JoeyCarson
Copy link

Well this isn't really dependent on brew, I'm building libjpeg-turbo from svn trunk for iOS and simulator. But when building it for the simulator, the same issue occurs, configure fails because it can't find libgcc.

This thread mentions that the issue is fixed by setting Xcode 7 as the default toolchain. I have already installed the official Xcode 7 and my xcode-select -p shows the correct directory to it.

@mologie
Copy link
Author

mologie commented Sep 24, 2015

My last comment from Jun 13 in this thread shows how to change the default toolchain from command line. You can also do so from Xcode -> Preferences... -> Locations -> Command Line Tools.

@JoeyCarson
Copy link

Yes I just saw that. I do have my xcode-select pointing to the proper directory, so if that was your solution, then mine perhaps just shows the same symptom and not the same cause.

@sonicaghi
Copy link

+1

@polyma
Copy link

polyma commented Oct 19, 2015

It helps to uninstall the older version of Xcode:
sudo /Library/uninstall-devtools --mode=all
is the directory where the tools are installed. For typical installations the full path is /Developer/Library/uninstall-devtools

Also freed up 4GB, wahey!

@saihgal
Copy link

saihgal commented Nov 19, 2015

+1 @mologie

@hartman
Copy link

hartman commented Dec 7, 2015

It is with luck that I found this ticket, because the way npm install fails when this occurs is really difficult to trace back to this problem. Anyone have ideas how the error reporting of node or gyp can be improved to make this more clear ?

@cstyan
Copy link

cstyan commented Jan 4, 2016

I'm getting this error same error in OSX 10.10 using xcode 6.4, just wondering if upgrading OSX and xcode is going to be easier than tracking down the cause in OSX 10.10/xcode 6.4.

Edit: just to be clear, this is the error I get during a node-gyp build.

> node-gyp rebuild

  CXX(target) Release/obj.target/binding/binding/sign.o
  SOLINK_MODULE(target) Release/binding.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: **\* [Release/binding.node] Error 1

And in /Applications/Xcode.app/contents/.../lib/ I have:

lrwxr-xr-x   1 root  wheel       17 19 Nov 11:57 libgcc_s.1.dylib -> libSystem.B.dylib
lrwxr-xr-x   1 root  wheel       19 19 Nov 11:57 libgcc_s.10.4.dylib -> libgcc_s.10.5.dylib
-rwxr-xr-x   1 root  wheel    30976  9 Sep  2014 libgcc_s.10.5.dylib

@MikeMcQuaid
Copy link
Member

I'm getting this error same error in OSX 10.10 using xcode 6.4, just wondering if upgrading OSX and xcode is going to be easier than tracking down the cause in OSX 10.10/xcode 6.4.

Yes, it will be.

@cstyan
Copy link

cstyan commented Jan 4, 2016

I simply upgraded Xcode and that fixed the issue. So this issue is independent of OSX version.

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

No branches or pull requests