node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Cannot compile a node extension with node-gyp on MacOSX ('thread' file not found)

Open masiarb opened this issue 12 years ago • 3 comments

Hi all,

I have this node extension made by a colleague and I'm trying to compile it through node-gyp configure (everything alright) and then node-gyp build (fatal error, 'thread' file not found). Now, I believe this is a problem of gcc, and I read somewhere that I need as flag -stdlib=libc+++. My binding.gyp file looks like this:

{ "targets": [ { "target_name": "overcpu", "sources": [ "overcpu.cpp" ], "cflags" : [ "-stdlib=libc++" ] } ] }

But I still get the error. I installed XCode and the developer tools, moreover not satisfied I installed gcc through brew. Unfortunately I keep receiving the same error. By doing gcc -v I get the following output:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.3.0 Thread model: posix

Is there something wrong with my gcc, or is it node-gyp (v1.0.1) which is driving me crazy?

Thanks a lot!

masiarb avatar Sep 02 '14 13:09 masiarb

I realise that it's probably been long enough that you've moved on without worrying about fixing this issue, but I though I should mention that I have a native module that uses thread and it does compile on mac. I had to add a few flags. You can see my binding.gyp file at https://github.com/ForbesLindesay/thread-sleep/blob/master/binding.gyp

The "action_after_build" section is for node-pre-gyp so you can ignore that. And the "include_dirs" bit is for nan.

ForbesLindesay avatar Jan 16 '15 14:01 ForbesLindesay

@masiarb Are you able to reproduce this on a more recent version of node-gyp?

maclover7 avatar Jul 20 '18 18:07 maclover7

Closing due to inactivity, please feel free to reopen if you are able to reproduce on a more recent version of node-gyp :)

maclover7 avatar Jul 31 '18 03:07 maclover7