Last active
November 2, 2022 12:33
-
-
Save Reiot/d787a4b319c4d54cbf325183cbe0f9e1 to your computer and use it in GitHub Desktop.
fix cannot find c++ header in recent mac OS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] | |
../node_modules/nan/nan.h:50:10: fatal error: 'algorithm' file not found | |
#include <algorithm> | |
^~~~~~~~~~~ | |
# install command line tools | |
> xcode-select --install | |
> xcrun --show-sdk-path | |
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk | |
# add these lines to .zshrc | |
export CPATH=`xcrun --show-sdk-path`/usr/include | |
export CPLUS_INCLUDE_PATH=`xcrun --show-sdk-path`/usr/include/c++/v1 | |
export LIBRARY_PATH=$LIBRARY_PATH:`xcrun --show-sdk-path`/usr/lib:/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/lib | |
# in terminal | |
export CXXFLAGS="-mmacosx-version-min=10.9" | |
npm install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment