Compile CoreCLR on CentOS

Source: Internet
Author: User

Compile CoreCLR on CentOS

After several days of efforts, we finally solved the problem of compiling CoreCLR on CentOS. The final problem was caused by CMAKE_C_FLAGS settings.

Just remove "SET (CMAKE_C_FLAGS_INIT"-Wall-std = c11 ")" from "src/pal/tools/clang-compiler-override.txt ")", add "SET (CMAKE_C_FLAGS"-Wall-std = c11 ")" to "src/pal/tests/CMakeLists.txt" to compile the SDK. (Updated: Later I found a better solution: Just change-std = c11 to-std = gnu11)

The following describes how to compile CoreCLR on CentOS.

CentOS version 7.0.

1) download the llvm source code

wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xzmv llvm-3.5.0.src llvm

2) download the clang source code

cd llvm/toolswget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xztar xf cfe-3.5.0.src.tar.xzmv cfe-3.5.0.src clang

2 +) download the lldb source code and install related components

wget http://llvm.org/releases/3.5.0/lldb-3.5.0.src.tar.xztar -xf lldb-3.5.0.src.tar.xzmv lldb-3.5.0.src lldbyum install swig python-devel libedit-devel

3) download the source code of compiler-rt.

cd ../projectswget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xztar xf compiler-rt-3.5.0.src.tar.xzmv compiler-rt-3.5.0.src compiler-rt

4) download the libcxxabi source code.

wget http://llvm.org/releases/3.5.0/libcxxabi-3.5.0.src.tar.xztar -xf libcxxabi-3.5.0.src.tar.xzmv libcxxabi-3.5.0.src.tar.xz libcxxabi

5) download the libcxx source code

wget http://llvm.org/releases/3.5.0/libcxx-3.5.0.src.tar.xztar xf  libcxx-3.5.0.src.tar.xzmv libcxx-3.5.0.src libcxx

6) Configure compilation options

cd .../configure --enable-optimized CC=gcc CXX=g++

7) Compile llvm

make -j2

8) install the compiled llvm

make install

(If only lldb is installed, run make install in llvm/tools/lldb)

9) Check out the source code of CoreClr for compilation.

git clone https://github.com/dotnet/coreclr.gitcd coreclr./build.sh

10) install libunwind

wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gztar -xf libunwind-1.1.tar.gzcd libunwind-1.1./configuremakemake install

If you do not install libunwind, the following error occurs:

/data/git/coreclr/src/pal/src/exception/seh-unwind.cpp:32:10: fatal error: 'libunwind.h' file not found

10) solve the "Native context type is not known" Compilation Error

The following error occurs during compilation:

-- Check size of siginfo_t-- Check size of siginfo_t - failed-- Check size of ucontext_t-- Check size of ucontext_t - failed...[  0%] Building CXX object src/palrt/CMakeFiles/palrt.dir/bstr.cpp.oIn file included from /data/git/coreclr/src/pal/src/arch/i386/context.cpp:25:/data/git/coreclr/src/pal/src/include/pal/context.h:40:2: error: Native context type is not known on this platform!

Modify the src/pal/tools/clang-compiler-override.txt file and remove SET (CMAKE_C_FLAGS_INIT "-Wall-std = c11") to solve this problem.

(Updated: Later I found a better solution: Just change-std = c11 to-std = gnu11)

10) solved the "use of undeclared identifier" Compilation error.

The following error occurs during the compilation process:

/data/git/coreclr/src/pal/tests/palsuite/c_runtime/wprintf/test2/test2.c:31:15: error: use of undeclared      identifier 'u'    DoStrTest(u"foo %s", u"bar", u"foo bar");

Add SET (CMAKE_C_FLAGS "-Wall-std = c11") to src/pal/tests/CMakeLists.txt to solve this problem.

(Updated: Later I found a better solution: Just change-std = c11 to-std = gnu11)

11) Success

Repo successfully built.Product binaries are available at /data/git/coreclr/binaries/Product/amd64/debug

Related Article

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.