Clang and Libc++abi Library installation

Source: Internet
Author: User
Tags svn

System Ubuntu64 bit Clang4.0

Reference:

1 https://github.com/yangyangwithgnu/use_vim_as_ide#0.1

The 7th chapter of the tool chain integration

2. http://clang.llvm.org/get_started.html

where Release Clang Versions

3. http://libcxxabi.llvm.org/

Where get it and get involved!

Start with a separate compilation of CLANG/LLVM and corresponding libraries in 1, and compile the libcxx and Libcxxabi libraries separately, where Libcxxabi compile times is wrong: clang-4.0 link Error

In 3, Libcxx and Libcxxabi libraries can be integrated or compiled separately, so the Libcxxabi library is directly included in the Llvm/projects in 2 and the final integration compiles the entire project.

Finally compile the file with clang++.

Compile the source file as follows:

New_feature.cpp#include <iostream> #include <string>class myclass{public      :            std::string s = " Hello, world\n "; Non-static data member Initializer};int main () {      std::cout << MyClass (). S;}

The compile command is as follows

clang++-std=c++11-stdlib=libc++-werror-weverything-wno-disabled-macro-expansion-wno-float-equal-wno-c++98- Compat-wno-c++98-compat-pedantic-wno-global-constructors-wno-exit-time-destructors-wno-missing-prototypes- Wno-padded-wno-old-style-cast-lc++-lc++abi New_feature.cpp

The resulting a.out file appears

./a.out:error while loading shared libraries:libc++abi.so.1:cannot open Shared object file:no such file or directory

Finally, in the compilation file, several libraries are added to the/usr/lib inside to produce the output.

The Library files are:

Note: It may be necessary to manually copy the header files from the include included in build to/usr/include/c++/v1/, in order to find the directory for libc++ and Libc++abi header files.

The specific commands are as follows:

  1. Get the required tools.
    • See Getting Started with the LLVM system-requirements.
    • Note also that Python was needed for running the test suite. Get it At:http://www.python.org/download
    • Standard build process uses CMake. Get it At:http://www.cmake.org/download
  2. Check out LLVM:
    • Change directory to where you want the LLVM directory placed.
    • SVN Co http://llvm.org/svn/llvm-project/llvm/trunk LLVM
  3. Check out Clang:
    • CD Llvm/tools
    • SVN Co http://llvm.org/svn/llvm-project/cfe/trunk clang
    • Cd.. /..
  4. Check out extra Clang tools: (optional)
    • CD Llvm/tools/clang/tools
    • SVN Co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
    • Cd.. /.. /.. /..
  5. Check out Compiler-rt (optional):
    • CD llvm/projects
    • SVN Co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
    • Cd.. /..
  6. Check out Libcxx: (Required-to-build and run Compiler-rt tests on OS X, optional otherwise)
    • CD ll Vm/projects
    • SVN co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
    • Span style= "Background-color: #ff0000;" > SVN co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi
    • Cd.. /..   
  7. Build LLVM and Clang:
    • mkdir Build (In-tree build is not supported)
    • CD Build
    • Cmake-g "Unix makefiles". /llvm
    • Make
    • This builds both LLVM and Clang for debug mode.
    • Note:for subsequent Clang development, you can just run make Clang.
    • CMake allows generate project files for several ides:xcode, Eclipse CDT4, Codeblocks, Qt-creator (Use the Codebloc KS generator), KDEVELOP3. For more details see Building LLVM with CMake page.

Clang and Libc++abi Library installation

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.