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

MacOS Mojave breaks npm module #120

Closed
dantheman213 opened this issue Sep 28, 2018 · 9 comments
Closed

MacOS Mojave breaks npm module #120

dantheman213 opened this issue Sep 28, 2018 · 9 comments

Comments

@dantheman213
Copy link

Hi, when updating to MacOS Mojave, I noticed I'm no longer able to pull down and use this module node-heapdump. Here is the output I get when I try to install via npm:

> [email protected] install /Users/myuser/myorg/repos/myapp/node_modules/heapdump
> node-gyp rebuild

  CXX(target) Release/obj.target/addon/src/heapdump.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead
      [-Wstdlibcxx-not-found]
In file included from ../src/heapdump.cc:17:
In file included from ../src/compat-inl.h:18:
In file included from ../src/compat.h:20:
/Users/myuser/.node-gyp/4.2.4/include/node/v8-profiler.h:8:10: fatal error: 'vector' file not found
#include <vector>
         ^~~~~~~~
1 warning and 1 error generated.
make: *** [Release/obj.target/addon/src/heapdump.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/myuser/.nvm/versions/node/v4.2.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/Users/myuser/.nvm/versions/node/v4.2.4/bin/node" "/Users/myuser/.nvm/versions/node/v4.2.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/myuser/myorg/repos/myapp/node_modules/heapdump
gyp ERR! node -v v4.2.4
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

Looking at the upgrade notes, I believe this is the cause:

Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when
targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a
deployment target of macOS 10.9 or later, or iOS 7 or later. Besides changing the C++ Standard
Library build setting, developers should audit hard-coded linker flags and target dependencies
to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and
libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against
libstdc++ will also need to be rebuilt against libc++. (40885260)

https://devapple.weebly.com/uploads/1/0/8/0/108009593/xcode_10_beta_6_release_notes.pdf

@dantheman213
Copy link
Author

We have a production environment where we can't upgrade from Node v4.2.4 overnight, btw.

@bnoordhuis
Copy link
Owner

Can you try upgrading to [email protected] and see if that fixes things? v3.0.3 is three years old now.

@CrunchyShark944
Copy link

CrunchyShark944 commented Oct 9, 2018

I tried to upgrade node-gyp to 3.8.0 and the problem was still there.

> [email protected] install /Users/myuser/node_modules/heapdump
> node-gyp rebuild

CXX(target) Release/obj.target/addon/src/heapdump.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the
command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]
In file included from ../src/heapdump.cc:17:
In file included from ../src/compat-inl.h:18:
In file included from ../src/compat.h:20:
/Users/myuser/.node-gyp/4.9.1/include/node/v8-profiler.h:8:10: fatal error:
'vector' file not found
#include
^~~~~~~~
1 warning and 1 error generated.
make: *** [Release/obj.target/addon/src/heapdump.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/myuser/.nvm/versions/node/v4.9.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/Users/myuser/.nvm/versions/node/v4.9.1/bin/node" "/Users/myuser/.nvm/versions/node/v4.9.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/myuser/node_modules/heapdump
gyp ERR! node -v v4.9.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! Darwin 18.0.0
npm ERR! argv "/Users/myuser/.nvm/versions/node/v4.9.1/bin/node" "/Users/myuser/.nvm/versions/node/v4.9.1/bin/npm" "install" "heapdump"
npm ERR! node v4.9.1
npm ERR! npm v2.15.11
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 heapdump 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 information on how to open an issue for this project with:
npm ERR! npm bugs heapdump
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls heapdump
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/myuser/npm-debug.log

@bnoordhuis
Copy link
Owner

bnoordhuis commented Oct 9, 2018

Okay, the issue is most likely that Node.js v4.x is built with -mmacosx-version-min=10.5 and node-heapdump inherits that through the MACOSX_DEPLOYMENT_TARGET stanza from Node's common.gypi - which doesn't work on new systems.

Can you delete node_modules/ and reinstall like this?

$ env CXXFLAGS="-mmacosx-version-min=10.7" npm install

Try 10.8, 10.9, etc. if 10.7 doesn't work.

@xeonarno
Copy link

Node lts/boron (6.14.4) doesn't work also with Mojave OSX. My collegue send me his compiled heapdump directory and I added in the node_modules manuelly. It sucks but It seems to work for the moment. Please compile with XCode 10 to upgrade the package !!!!

@bnoordhuis
Copy link
Owner

I'll close this out as it's not an issue with node-heapdump itself. See the linked nodejs/node issue for more background.

@cooperka
Copy link

cooperka commented Apr 3, 2020

MacOS Mojave v10.14 here, I solved it by adding LDFLAGS in addition to CXXFLAGS:

env LDFLAGS="-mmacosx-version-min=10.9" CXXFLAGS="-mmacosx-version-min=10.9" npm install

@spencerwasden
Copy link

@cooperka Thanks for posting that. What version of npm did you run it under?

@cooperka
Copy link

cooperka commented Apr 8, 2020

@spencerwasden this project was using Node v0.10.48, npm v2.15.1

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

6 participants