问题
I've been building Clang for years on Linux and OS X. From the LLVM Download page, I've always used the following sources:
- LLVM (LLVM source)
- Compiler Front End (Clang source)
- Compiler RT (Runtime source)
- Compiler Tools (Tools Extra sources)
The recipe I am using to download, build and install Clang 3.5 can be found at Clang 3.5 download, build and install script.
Its works great on OS X 10.7 and 10.8, and I've never needed the libc++ gear on OS X 10.7.x or 10.8.x (that's about 2010 or so through current).
Question: when does one need the libc++ and libc++ ABI sources?
I'm trying to help troubleshoot the inability to compile a simple C++ "Hello World" program on OS X 10.9. Clang 3.5 installed in /usr/local
(just like the others), but its failing to find headers (like <iostream>
) and it encounters undefined symbols during link (like "std::ostream::operator<<(std::ostream& (*)(std::ostream&))"
).
I'm wondering if 10.7 and 10.8 had headers and libraries where previous versions of Clang expected, but 10.9 needs them built and installed.
Question: is this symptomatic of a missing libc++ and libc++ ABI?
回答1:
You should have the libc++ sources checked out when building/installing clang such that you will also install the C++ STL.
If you don't have a libc++ runtime on your system, you should checkout and install libc++abi and libc++ which can be done standalone and independently of their checkout in your llvm/clang install.
As reference, I suggest you take a look at the libcxxabi, libcxx, libunwind, and llvm-X.Y ports in MacPorts which show how I've configured these projects to build on Leopard through Yosemite.
来源:https://stackoverflow.com/questions/27812611/when-is-libc-sources-needed-when-building-clang-from-sources