[llvm-dev] Building LLVM with LLVM
Fabiano Sidler via llvm-dev
llvm-dev at lists.llvm.org
Thu Sep 5 03:15:34 PDT 2019
Hi folks!
I'm trying to build LLVM with LLVM on Ubuntu using the commands below.
Building it with the GNU stuff (cpp, gcc, g++ and binutils packages) works,
but after removing it, moving LLVM to /usr/local and symlinking /usr/bin/ld
to ld.lld, I'm getting the following:
=== snip ===
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- The ASM compiler identification is Clang
-- Found assembler: /usr/local/bin/clang
-- Check for working C compiler: /usr/local/bin/clang
-- Check for working C compiler: /usr/local/bin/clang -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/local/bin/clang" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /home/elux/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_a9eab/fast"
/usr/bin/make -f CMakeFiles/cmTC_a9eab.dir/build.make
CMakeFiles/cmTC_a9eab.dir/build
make[1]: Entering directory '/home/elux/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a9eab.dir/testCCompiler.c.o
/usr/local/bin/clang -o CMakeFiles/cmTC_a9eab.dir/testCCompiler.c.o -c
/home/elux/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_a9eab
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a9eab.dir/link.txt
--verbose=1
/usr/local/bin/clang CMakeFiles/cmTC_a9eab.dir/testCCompiler.c.o -o
cmTC_a9eab
ld: error: cannot open crt1.o: No such file or directory
ld: error: cannot open crti.o: No such file or directory
ld: error: cannot open crtbegin.o: No such file or directory
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lc
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
ld: error: cannot open crtend.o: No such file or directory
ld: error: cannot open crtn.o: No such file or directory
clang-8: error: linker command failed with exit code 1 (use -v to see
invocation)
CMakeFiles/cmTC_a9eab.dir/build.make:97: recipe for target 'cmTC_a9eab'
failed
make[1]: *** [cmTC_a9eab] Error 1
make[1]: Leaving directory '/home/elux/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_a9eab/fast' failed
make: *** [cmTC_a9eab/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:39 (project)
-- Configuring incomplete, errors occurred!
See also "/home/elux/build/CMakeFiles/CMakeOutput.log".
See also "/home/elux/build/CMakeFiles/CMakeError.log".
=== snap ===
Commands used:
=== snip ===
VERSION=8.0.1
DESTDIR=/tmp/llvm
PREFIX=/usr/local
#wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/llvm-${VERSION}.src.tar.xz
#wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/cfe-${VERSION}.src.tar.xz
#wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/libcxx-${VERSION}.src.tar.xz
#wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/libcxxabi-${VERSION}.src.tar.xz
#wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/lld-${VERSION}.src.tar.xz
#wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/compiler-rt-${VERSION}.src.tar.xz
tar xf llvm-${VERSION}.src.tar.xz
tar xf cfe-${VERSION}.src.tar.xz
tar xf libcxx-${VERSION}.src.tar.xz
tar xf libcxxabi-${VERSION}.src.tar.xz
tar xf lld-${VERSION}.src.tar.xz
tar xf compiler-rt-${VERSION}.src.tar.xz
mv cfe-${VERSION}.src llvm-${VERSION}.src/projects/clang
mv libcxx-${VERSION}.src llvm-${VERSION}.src/projects/libcxx
mv libcxxabi-${VERSION}.src llvm-${VERSION}.src/projects/libcxxabi
mv lld-${VERSION}.src llvm-${VERSION}.src/projects/lld
mv compiler-rt-${VERSION}.src llvm-${VERSION}.src/projects/compiler-rt
mkdir build
cd build
cmake \
-DLLVM_ENABLE_FFI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD="host" \
-DBUILD_SHARED_LIBS=ON \
../llvm-${VERSION}.src
cmake --build .
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}${PREFIX} -P cmake_install.cmake
=== snap ===
Any hints?
Greetings,
Fabiano
More information about the llvm-dev
mailing list