代码之家  ›  专栏  ›  技术社区  ›  Jason

OS X:ld:找不到-lstdc的库++

  •  3
  • Jason  · 技术社区  · 6 年前

    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
    

    1 回复  |  直到 6 年前
        1
  •  0
  •   Jason    6 年前

    在没有卸载XCode命令行工具v10的情况下,我安装了XCode命令行工具v9.4.1,它解决了这个问题。