/usr/bin/ld: crtbegin.o: No such file: No such file or directory
10,247
You can try adding --sysroot= option e.g.--sysroot=/home/lz/olimex/gcc-4.3.3/
Author by
SFbay007
Updated on June 21, 2022Comments
-
SFbay007 almost 2 years
I want to install llvm-clang but have no root access at work. many of our packages are outdated so I am installing everything locally under my home directory.
I installed cmake and gcc but now having errors when installing llvm.
I have my home directory structured this way:
~/gcc_build -> has the /bin directory which includes gcc, g++...etc (result of make install). ~/gcc-7.1.0 -> which has the main gcc build directory (where make was run) ~/llvm-4.0.0.src -> the main llvm directory ~/llvm_make -> where I am trying to make llvm in (empty)
This is my command:
[server-01:llvm_make]% ../cmake-3.8.2/bin/cmake ../llvm-4.0.0.src -DCMAKE_CXX_COMPILER=/home/sbay/gcc_build/bin/g++ -DCMAKE_C_COMPILER=/home/sbay/gcc_build/bin/gcc
But I am getting this error:
[server-01:llvm_make]% ../cmake-3.8.2/bin/cmake ../llvm-4.0.0.src -DCMAKE_CXX_COMPILER=/home/sbay/gcc_build/bin/g++ -DCMAKE_C_COMPILER=/home/sbay/gcc_build/bin/gcc -- The C compiler identification is GNU 7.1.0 -- The CXX compiler identification is GNU 7.1.0 -- The ASM compiler identification is GNU -- Found assembler: /home/sbay/bin/gcc -- Check for working C compiler: /home/sbay/gcc_build/bin/gcc -- Check for working C compiler: /whome/sbay/gcc_build/bin/gcc -- broken CMake Error at /home/sbay/cmake-3.8.2/Modules/CMakeTestCCompiler.cmake:51 (message): The C compiler "/home/sbay/gcc_build/bin/gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/sbay/llvm_make/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/gmake" "cmTC_13e2f/fast" /usr/bin/gmake -f CMakeFiles/cmTC_13e2f.dir/build.make CMakeFiles/cmTC_13e2f.dir/build gmake[1]: Entering directory `/home/sbay/llvm_make/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_13e2f.dir/testCCompiler.c.o /home/sbay/gcc_build/bin/gcc -o CMakeFiles/cmTC_13e2f.dir/testCCompiler.c.o -c /home/sbay/llvm_make/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTC_13e2f /home/sbay/cmake-3.8.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_13e2f.dir/link.txt --verbose=1 /home/sbay/gcc_build/bin/gcc CMakeFiles/cmTC_13e2f.dir/testCCompiler.c.o -o cmTC_13e2f /usr/bin/ld: crtbegin.o: No such file: No such file or directory collect2: error: ld returned 1 exit status gmake[1]: *** [cmTC_13e2f] Error 1 gmake[1]: Leaving directory `/home/sbay/llvm_make/CMakeFiles/CMakeTmp' gmake: *** [cmTC_13e2f/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:47 (project) -- Configuring incomplete, errors occurred! See also "/home/sbay/llvm_make/CMakeFiles/CMakeOutput.log". See also "/home/sbay/llvm_make/CMakeFiles/CMakeError.log".
I would highly appreciate any input.
-
SFbay007 almost 7 yearsThanks for your comment, so I added this --sysroot=/home/sbay/gcc-7.1.0 but got this error: ../cmake-3.8.2/bin/cmake ../llvm-4.0.0.src -DCMAKE_CXX_COMPILER=/home/sbay/gcc_build/bin/g++ -DCMAKE_C_COMPILER=/home/sbay/gcc_build/bin/gcc --sysroot=/home/sbay/gcc-7.1.0 CMake Error: The source directory "/home/sbay/llvm_make/--sysroot=/home/sbay/gcc-7.1.0" does not exist. Specify --help for usage, or press the help button on the CMake GUI
-
SFbay007 almost 7 yearsMy bad, I added -DCMAKE_SYSROOT=/home/sbay/gcc-7.1.0 instead and now the error is: /usr/bin/ld: this linker was not configured to use sysroots
-
LZ041 almost 7 yearsI guess you have to find other gcc version or build with sysroot enabled
-
SFbay007 almost 7 yearsI have downloaded binutils now and building it. Do you think me using a local version of ld would work? How to build with sysroot enabled? I already did ./configure;make. Was that the wrong approach?
-
LZ041 almost 7 years"Do you think me using a local version of ld would work?" If you have older version of local ld most probably it will not work. You have to add something like --with-sysroot to ./configure (check what options it has)