Installing LLVM libraries along with Xcode

六月ゝ 毕业季﹏ 提交于 2019-11-30 03:54:01
Hongxu Chen

If you do not need to read LLVM implementation source code(such as in lib/tools directories) and might only play with libclang, perhaps using homebrew is enough for you.

brew install --with-clang --with-lld --with-python --HEAD llvm

Next you need to set PATH, CPLUS_INCLUDE_PATH and LD_LIBRARY_PATH. For me,

# export PATH=/usr/local/opt/llvm/bin:$PATH
# export CPLUS_INCLUDE_PATH=$(llvm-config --includedir):$CPLUS_INCLUDE_PATH 
# export LD_LIBRARY_PATH=$(llvm-config --libdir):$LD_LIBRARY_PATH 

You might configure the above information in your LLVM derived project with XCode.

However if you are also interested in Compiler-RT, Clang-Tools-Extra(see LLVM Download Page) you probably have to make LLVM as your XCode project (download from that page or via SVN as said in Getting Started with the LLVM System). After putting the sub-projects in proper directories, you can use XCode generator from CMake, the typical usage is:

cd YOUR_LLVM_SRC_ROOT
mkdir build
cd build
cmake -G Xcode ..

Use XCode to open the project file XXX.xcodeproj and it should build the project.

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