After a few days of effort, finally solved the problem of compiling coreclr on CentOS. The final discovery problem is caused by the cmake_c_flags setting.
Just delete "SET (cmake_c_flags_init"-wall-std=c11 ")" in "Src/pal/tools/clang-compiler-override.txt" and "src/pal/tests/ CMakeLists.txt "Add" SET (cmake_c_flags "-wall-std=c11"), you can compile it.
Let's share the steps to compile coreclr on CentOS.
CentOS version 7.0 is used.
1) Download the LLVM source code
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
3) Download the COMPILER-RT source code
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) Compiling LLVM
Make-j2
8) Install the compiled LLVM
Make install
9) Check out the source code of CORECLR to compile
git clone Https://github.com/dotnet/coreclr.gitcd coreclr./build.sh
10) Fix "Native context type is not known" compilation error
The following error occurred during compilation:
--Check size of siginfo_t--check size of siginfo_t-failed--check size of ucontext_t--check size of Ucontext_t-fail Ed ... [ 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 isn't known on this platform!
Modify the src/pal/tools/clang-compiler-override.txt file to remove the SET (cmake_c_flags_init "-wall-std=c11") can solve this problem.
10) Fix "Use of undeclared identifier" compilation error
The following error occurred during the process of continuing the compilation:
/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");
Adding SET (cmake_c_flags "-wall-std=c11") in src/pal/tests/cmakelists.txt can solve this problem.
11) accomplished
Repo successfully built. Product binaries is available at/data/git/coreclr/binaries/product/amd64/debug
Compiling coreclr on Linux CentOS