https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109250
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Liu Aifu from comment #0) > I am trying to compile GCC v12.2.0 on the Kylin Desktop Operating System V10 > (SP1), with a loongson-3A5000 CPU. The current GCC version is v8.3, but I am > encountering errors during the compilation process. Can you please help me > take a look? > > Kernel: linux 5.4.18-28.23-bj-generic > > $lscpu > Architecture: loongarch64 > Byte Order: Little Endian > CPU(s): 4 > On-line CPU(s) list: 0-3 > Thread(s) per core: 1 > Core(s) per socket: 4 > Socket(s): 1 > NUMA node(s): 1 > CPU family: Loongson-64bit > Model name: Loongson-3A5000 > BogoMIPS: 5000.00 > L1d cache: 256 KiB > L1i cache: 256 KiB > L2 cache: 1 MiB > L3 cache: 16 MiB > NUMA node0 CPU(s): 0-3 > Flags: cpucfg lam ual fpu lsx lasx complex crypto lvz > > $gcc -v > Using built-in specs. > COLLECT_GCC=gcc > COLLECT_LTO_WRAPPER=/usr/lib/gcc/loongarch64-linux-gnu/8/lto-wrapper > Target: loongarch64-linux-gnu > Configured with: ../src/configure -v --with-pkgversion='Loongnix > 8.3.0-6.lnd.vec.24' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs > --enable-languages=c,c++,fortran --prefix=/usr --with-gcc-major-version-only > --program-suffix=-8 --program-prefix=loongarch64-linux-gnu- --enable-shared > --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext > --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu > --enable-libstdcxx-debug --enable-libstdcxx-time=yes > --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm > --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support > --enable-plugin --with-system-zlib --enable-multiarch --disable-werror > --with-arch=loongarch64 --with-abi=lp64 --enable-tls --enable-initfini-array > --enable-gnu-indirect-function --disable-host-shared --disable-emultls > --with-fix-loongson3-llsc --enable-checking=release > --build=loongarch64-linux-gnu --host=loongarch64-linux-gnu > --target=loongarch64-linux-gnu > Thread model: posix > gcc version 8.3.0 (Loongnix 8.3.0-6.lnd.vec.24) > > $./configure --enable-languages=c,c++ --prefix=/opt/gcc-12.2.0 Don't build in the source directory. https://gcc.gnu.org/wiki/FAQ#configure > --program-suffix=-8 --program-prefix=loongarch64-linux-gnu- --enable-shared > --enable-linker-build-id --without-included-gettext --enable-threads=posix > --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug > --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new > --enable-gnu-unique-object --disable-libitm --disable-libsanitizer > --disable-libquadmath --disable-libquadmath-support --enable-plugin > --with-system-zlib --enable-multiarch --disable-werror > --with-arch=loongarch64 --with-abi=lp64 --enable-tls --enable-initfini-array > --enable-gnu-indirect-function --disable-host-shared --disable-emultls > --with-fix-loongson3-llsc --enable-checking=release > --build=loongarch64-linux-gnu --host=loongarch64-linux-gnu > --target=loongarch64-linux-gnu Why are you including all these options, most of which are already implied by default? https://gcc.gnu.org/wiki/InstallingGCC "If your build fails and your configure command has lots of complicated options you should try removing options and keep it simple. Do not add lots of configure options you don't understand, they might be the reason your build fails." e.g. why do you want the suffix to be -8 when you're building gcc-12? Anyway, the error is in the gmp sub-directory, so you probably need a more recent version of gmp to get loongarch support.