天天看点

MAC编译OpenJDK8:clang: error: include path for libstdc++ headers not found(独家解决办法)

别人提供了下载办法,吾找到了修改脚本的解决办法。

  • 下载文件

git clone

https://github.com/quantum6/xcode-missing-libstdcpp
  • 修改脚本(独家办法)
#!/usr/bin/env bash
 
set -e
 
DEST_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr
 
sudo ln -snf \
    $PWD/include/c++ \
    ${DEST_DIR}/include/
 
sudo ln -snf \
    $PWD/lib/libstdc++.6.0.9.tbd \
    $PWD/lib/libstdc++.6.tbd \
    $PWD/lib/libstdc++.tbd \
    ${DEST_DIR}/lib/      
  • 安装
./install.sh      
  • 配置环境
NEW_INCLUDE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
export   CFLAGS="-I$NEW_INCLUDE"
export CXXFLAGS="-I$NEW_INCLUDE"
 
NEW_LIB=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
export LDFLAGS="-L${NEW_LIB}"
 
export LIBRARY_PATH=$NEW_LIB:$LIBRARY_PATH