Building Clang, libstdc++4.6 to libstdc++4.7
Asked Answered
R

4

9

I am trying to build Clang following this: http://clang.llvm.org/get_started.html

At step 6 the command ../llvm/configure runs a series of checks and one tells me:

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.

I don't know how to resolve this and google searches for libstdc++4.7 did not produce anything useful to me or something I understand. How do I go about replacing / upgrading this? I am on a Mac (10.7.5)

Rotorua answered 16/1, 2014 at 6:29 Comment(0)
P
9

I ran into the same problem. The easiest way to build Clang is to use libc++ instead of libstdc++. If you don't have libc++, you can obtain it by installing XCode 4.2 (or newer) or you can build it yourself by following the instructions here: http://libcxx.llvm.org/

After you have libc++ installed, you can use the --enable-libcpp=yes flag with the configure command.

Prophesy answered 21/1, 2014 at 20:52 Comment(2)
I ended up needing to make it myself after all and this worked, thank youRotorua
This only works if you are on MacOSX, because libcxx only works on MacOSX at the moment. On other Unix/Linux, I think the only solution is to install libstdc++4.7 somehow.Alkanet
F
7

Just this week, the LLVM & Clang project upped the minimal compiler version requirement to gcc 4.7, with its libstdc++. You'll need to install or build a newer gcc.

Here's a blog post I wrote earlier today about building gcc 4.8 on Ubuntu 12.04 and using that to compile trunk LLVM & Clang. Hope this helps!

Fruiterer answered 16/1, 2014 at 16:49 Comment(3)
I found a link to upgrade gcc to 4.7 (for Mac) but unfortunately I still get the same message. jamesreubenknowles.com/how-to-install-gcc-4-7-on-mac-os-x-1774Rotorua
@asimes: are you sure gcc 4.7 was installed in a location the configure script can find?Fruiterer
To be honest I do not know how to determine that, I found a different solution to the problem thoughRotorua
F
2

i have the same error on mac 10.8.5 xcode 5.0 configure option --enable-libcpp resolve my problem ../llvm/configure --enable-cxx11 --enable-optimized --enable-libcpp

Fernery answered 25/1, 2014 at 0:15 Comment(0)
H
0

For me this happened because I had the old clang and clang++ that I'd previously built from source (the one I was attempting to build to replace) coming first in my PATH. These were too old. Removing those two files so that the build process would use the clang and clang++ that comes with XCode's Command Line Tools and then rebuilding worked fine.

Happygolucky answered 7/6, 2014 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.