【Linux operation 33】configure: error: no acceptable C compiler found in $PATH

1、SUSE升级gcc时出现异常

linux-1psk:/gcc/gcc-12.1.0/build # ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libphobos support... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/gcc/gcc-12.1.0/build':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

2、解决办法

gcc编译器不在你的 P A T H , 意 味 着 要 么 没 有 安 装 g c c , 要 么 不 在 PATH,意味着要么没有安装gcc,要么不在 PATHgccPATH变量中;

以root身份安装gcc

linux-1psk:/gcc/gcc-12.1.0/build # zypper install gcc
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 9 NEW packages are going to be installed:
  gcc gcc48 glibc-devel libasan0 libatomic1 libgomp1 libitm1 libtsan0 linux-glibc-devel

9 new packages to install.
Overall download size: 11.0 MiB. Already cached: 0 B. After the operation, additional 43.0 MiB will be used.
Continue? [y/n/...? shows all options] (y): y
Retrieving package linux-glibc-devel-4.12-3.3.1.noarch                                                                                                                                   (1/9),   1.2 MiB (  5.5 MiB unpacked)Retrieving package libasan0-4.8.5-31.20.1.x86_64                                                                                                                                         (2/9),  79.8 KiB (166.8 KiB unpacked)Retrieving package libatomic1-8.2.1+r264010-1.3.3.x86_64                                                                                                                                 (3/9),  16.1 KiB ( 26.1 KiB unpacked)Retrieving package libgomp1-8.2.1+r264010-1.3.3.x86_64                                                                                                                                   (4/9), 102.2 KiB (255.7 KiB unpacked)Retrieving package libitm1-8.2.1+r264010-1.3.3.x86_64                                                                                                                                    (5/9),  34.5 KiB (110.4 KiB unpacked)Retrieving package libtsan0-8.2.1+r264010-1.3.3.x86_64                                                                                                                                   (6/9), 280.9 KiB (929.1 KiB unpacked)Retrieving package glibc-devel-2.22-100.15.4.x86_64                                                                                                                                      (7/9), 665.3 KiB (  3.0 MiB unpacked)Retrieving package gcc48-4.8.5-31.20.1.x86_64                                                                                                                                            (8/9),   8.6 MiB ( 33.1 MiB unpacked)Retrieving package gcc-4.8-6.189.x86_64                                                                                                                                                  (9/9),   5.4 KiB (    0   B unpacked)
Checking for file conflicts: ...........................................................................................................................................................................................[done]
(1/9) Installing: linux-glibc-devel-4.12-3.3.1.noarch ..................................................................................................................................................................[done]
(2/9) Installing: libasan0-4.8.5-31.20.1.x86_64 ........................................................................................................................................................................[done]
(3/9) Installing: libatomic1-8.2.1+r264010-1.3.3.x86_64 ................................................................................................................................................................[done]
(4/9) Installing: libgomp1-8.2.1+r264010-1.3.3.x86_64 ..................................................................................................................................................................[done]
(5/9) Installing: libitm1-8.2.1+r264010-1.3.3.x86_64 ...................................................................................................................................................................[done]
(6/9) Installing: libtsan0-8.2.1+r264010-1.3.3.x86_64 ..................................................................................................................................................................[done]
(7/9) Installing: glibc-devel-2.22-100.15.4.x86_64 .....................................................................................................................................................................[done]
(8/9) Installing: gcc48-4.8.5-31.20.1.x86_64 ...........................................................................................................................................................................[done]
(9/9) Installing: gcc-4.8-6.189.x86_64 .................................................................................................................................................................................[done]

3、检查安装成功:

linux-1psk:/gcc/gcc-12.1.0/build # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 4.8.5 (SUSE Linux) 

猜你喜欢

转载自blog.csdn.net/qq_22938603/article/details/125440558