gcc 构建错误

gcc 构建错误

当我配置 gcc 时,我收到一条错误消息,有人可以帮助我吗?请..

messages..
checking whether the C compiler works... no
configure: error: in `/home/kjs0625/gcc/gcc-13.1.0':
configure: error: C compiler cannot create executables

config.log
gcc (GCC) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4407: $? = 0
configure:4396: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/root --with-mpc=/root --with-mpfr=/root --with-gmp=/root --with-isl=/root --enable-languages=c,c++ --disable-multilib --with-static-standard-libraries
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (GCC)
configure:4407: $? = 0
configure:4396: gcc -V >&5
gcc: error: unrecognized command-line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4407: $? = 1
configure:4396: gcc -qversion >&5
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:4407: $? = 1
configure:4427: checking whether the C compiler works
configure:4449: gcc    conftest.c  >&5
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
configure:4453: $? = 1
configure:4491: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:4496: error: in `/home/kjs0625/gcc/gcc-13.1.0':
configure:4498: error: C compiler cannot create executables
See `config.log' for more details

请..有人帮助我TT

答案1

checking whether the C compiler works... no
configure: error: in `/home/kjs0625/gcc/gcc-13.1.0':
configure: error: C compiler cannot create executables

这是您需要首先解决的部分。如果您当前的 C 编译器无法生成可执行文件,您将永远无法创建一个可用的 gcc 编译器。

要测试 C 编译器是否可以生成可执行文件,可以使用一个简单的“Hello, world”程序,或者使用的代码configure。您可能还缺少一些库:

/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s

相关内容