python - OS X : ld: library not found for -lstdc++

标签 python c++ xcode clang clang++

我正在尝试将 Python 库包装在 C++ 库周围,而 distutils 在 OS X 上对我来说失败了。以下是我的 setup.py 中的相关行:

if sys.platform.startswith("darwin"):
    extra_compile_args_setting = ["-std=c++1z", "-stdlib=libc++", "-O3"]

这是相关的输出:

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/x/anaconda/include -arch x86_64 -I/Users/x/anaconda/include -arch x86_64 -I../../cpp_client/libsrc -I../../cpp_client/third_party -I/Users/x/anaconda/include/python3.6m -c navdb_python_client_wrap.cxx -o build/temp.macosx-10.7-x86_64-3.6/navdb_python_client_wrap.o -std=c++1z -stdlib=libc++ -O3
clang++ -bundle -undefined dynamic_lookup -L/Users/x/anaconda/lib -L/Users/x/anaconda/lib -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/navdb_python_client_wrap.o -L../../cpp_client/lib -L/Users/x/anaconda/lib -lnavdb_cpp_client_api -o /Users/x/Development/NavDB/trunk/src/client/lang_clients/python3_client/build/_navdb_python_client.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1

我最近升级到 XCode 10。库似乎在那里:

$ ls -lrt /usr/lib/libstdc++*
lrwxr-xr-x  1 root  wheel       17 Sep 26  2017 /usr/lib/libstdc++.dylib -> libstdc++.6.dylib
lrwxr-xr-x  1 root  wheel       21 Sep 26  2017 /usr/lib/libstdc++.6.dylib -> libstdc++.6.0.9.dylib
-rwxr-xr-x  1 root  wheel  1461584 Mar 28 06:02 /usr/lib/libstdc++.6.0.9.dylib

欢迎任何帮助。

最佳答案

在没有卸载 XCode Command Line Tools v10 的情况下,我安装了 XCode Command Line Tools v9.4.1 并解决了问题。

关于python - OS X : ld: library not found for -lstdc++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52441952/

相关文章:

类中的 C++ 枚举 - 声明顺序很重要吗?

c++ - C++ 中的 operator<< 和 stringstream 重载

python - 如何将 AWS 证书与 python 请求库一起使用?

python - 当我以为我放置了一个字符串时,我的函数让我返回 "none"?

c++ - 显示来自 MFC DLL 的对话框

ios - IOS Xcode 中的样式按钮

iphone - 用于数据的文本文件

iphone - IOS 5 - XCode 4 - 应用程序启动时的 SIGABRT

python - 使用python从c源代码文件中提取函数代码

Python。写入文件,无法理解行为