c++ -/usr/bin/ld : crtbegin. o: 没有那个文件: 没有那个文件或目录

标签 c++ gcc g++ clang llvm

我想安装 llvm-clang 但在工作时没有 root 权限。我们的许多软件包都已过时,因此我将所有内容都本地安装在我的主目录下。

我安装了 cmake 和 gcc,但现在在安装 llvm 时出现错误。

我的主目录结构如下:

~/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)

这是我的命令:

    [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

但是我收到了这个错误:

[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".

如果有任何意见,我将不胜感激。

最佳答案

您可以尝试添加 --sysroot= 选项 例如--sysroot=/home/lz/olimex/gcc-4.3.3/

关于c++ -/usr/bin/ld : crtbegin. o: 没有那个文件: 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44528465/

相关文章:

c - 链接器报告 undefined reference ,但代码编译正常

c++ - G++ 编译器对非交换操作的优化程度

C++ "Could not convert ' 类实例'从 'Class (*)()' 到 'Class' ”

c++ - 使用 vector 查找数组中的频率

android - 如何在两个轴上旋转 QQuaternion

c++ - Eclipse C++ 安装程序,未设置可执行文件的路径

c++ - 如何使GCC(C++)停止简化算术表达式?

c++ - 编码(marshal) C++ 锯齿状数组给出 "Invalid managed/unmanaged type combination"错误

linux - 如何通知 GCC 不使用特定寄存器

c++ - 为什么 gcc 7.3 在静态定义中接受 'this'?