When is libc++ sources needed when building Clang from sources?

混江龙づ霸主 提交于 2019-12-11 02:59:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!