First knowledge of clang

Source: Internet
Author: User
Tags emit svn
referring to the official website http://clang.llvm.org/get_started.html, depends on a lot of things, compiling clang very slow, patiently waiting. ----------------------------------------------------------------------------------------------------------- ------------------ On unix-like Systems

If you are would like to check out and build clang, the current procedure is as follows:get the required tools. See getting started with the LLVM system-requirements. Note also this Python is needed for running the test suite. Get it at: http://www.python.org/download Checkout Llvm:change directory to where you want the LLVM directory placed . SVN co http://llvm.org/svn/llvm-project/llvm/trunk llvm Checkout CLANG:CD llvm/tools SVN co http://llvm.org/svn/ Llvm-project/cfe/trunk clang CD. /.. Checkout extra clang Tools: (optional) CD Llvm/tools/clang/tools SVN co http://llvm.org/svn/llvm-project/ Clang-tools-extra/trunk Extra CD. /.. /.. /.. Checkout COMPILER-RT:CD llvm/projects SVN co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt CD. /.. Build LLVM and Clang:mkdir build  [for building without polluting the source dir] CD build ... /llvm/configure make this builds both LLVM and clang for debug mode. Note:for subsequent clang development, can just do MaKe at the clang directory level. It is also possible to use CMake instead of the makefiles. With CMake it are possible to generate project files for several ides:xcode, Eclipse CDT4, Codeblocks, qt-creator (Use the Codeblocks generator), KDEVELOP3. If you are intend to use clang ' C + + support, you'll be need to the tell it I find your C + + standard library headers. In general, Clang would detect the best version of libstdc++ headers available and use them-it'll look both for system Installations of libstdc++ as-installations adjacent to clang itself. If your configuration fits neither of these scenarios, your can use the --with-gcc-toolchain configure option to Tell Clang where the GCC containing the desired libstdc++ is installed. Try it out (assuming your add llvm/debug+asserts/bin to your path): clang--help clang (check for Correctness) clang file.c-s-emit-llvm-o-  (print out unoptimized LLVM code) clang file.c-s-emit-llvm-o--O3 CLang file.c-s-o3-o-  (output native machine code)

This is the C front-end uses LLVM, but does not depend on LLVM-GCC. If you are encounter problems with building clang, make sure you have the latest SVN version of LLVM. LLVM contains support libraries for clang of that'll be updated as as as the development on clang.


~not End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.