构建 Clang,libstdc++4.6 到 libstdc++4.7

Building Clang, libstdc++4.6 to libstdc++4.7

提问人:asimes 提问时间:1/16/2014 更新时间:6/7/2014 访问量:4373

问:

我正在尝试按照以下方式构建 Clang:http://clang.llvm.org/get_started.html

在步骤 6 中,该命令运行一系列检查,其中一个告诉我:../llvm/configure

checking whether Clang will select a modern C++ standard library... no
configure: error:
We detected a missing feature in the standard C++ library that was known to be
missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous
C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older
than 4.7. You will need to update your system and ensure Clang uses the newer
standard library.

If this error is incorrect or you need to force things to work, you may pass
'--disable-compiler-version-checks' to configure to bypass this test.

我不知道如何解决这个问题,谷歌搜索 libstdc++4.7 没有产生任何对我有用的东西或我理解的东西。我该如何更换/升级它?我在 Mac 上 (10.7.5)

llvm的 libstdc++

评论


答:

7赞 Eli Bendersky 1/17/2014 #1

就在本周,LLVM & Clang 项目将最低编译器版本要求提高到 gcc 4.7,并带有 libstdc++。您需要安装或构建更新的 gcc。

这是一篇博文我今天早些时候写了一篇关于在 Ubuntu 12.04 上构建 gcc 4.8 并使用它来编译主干 LLVM 和 Clang 的文章。希望这会有所帮助!

评论

0赞 asimes 1/17/2014
我找到了一个将 gcc 升级到 4.7(适用于 Mac)的链接,但不幸的是我仍然收到相同的消息。jamesreubenknowles.com/how-to-install-gcc-4-7-on-mac-os-x-1774
0赞 Eli Bendersky 1/17/2014
@asimes:您确定 GCC 4.7 安装在配置脚本可以找到的位置吗?
0赞 asimes 1/17/2014
老实说,我不知道如何确定这一点,但我找到了不同的解决方案
9赞 Ivan Jibaja 1/22/2014 #2

我遇到了同样的问题。构建 Clang 的最简单方法是使用 libc++ 而不是 libstdc++。如果您没有 libc++,可以通过安装 XCode 4.2(或更高版本)来获取它,也可以按照以下说明自行构建它: http://libcxx.llvm.org/

安装 libc++ 后,可以将 --enable-libcpp=yes 标志与 configure 命令一起使用。

评论

0赞 asimes 3/30/2014
毕竟我最终需要自己做,这奏效了,谢谢
1赞 Albert 4/3/2014
这仅在您在 MacOSX 上时有效,因为 libcxx 目前仅适用于 MacOSX。在其他 Unix/Linux 上,我认为唯一的解决方案是以某种方式安装 libstdc++4.7。
2赞 john07 1/25/2014 #3

我在Mac 10.8.5 Xcode 5.0上遇到同样的错误 configure option --enable-libcpp 解决我的问题 ../llvm/configure --enable-cxx11 --enable-optimized --enable-libcpp

0赞 jwatt 6/7/2014 #4

对我来说,发生这种情况是因为我之前从源代码构建的旧 clang 和 clang++(我试图构建以替换的那个)在我的 PATH 中排在第一位。这些都太老了。删除这两个文件,以便构建过程使用 XCode 的命令行工具附带的 clang 和 clang++,然后重新构建工作正常。