Bugzilla – Bug 1139856
riscv64: GCC9 compiling failures
Last modified: 2021-07-26 15:59:02 UTC
Hi, I have tried riscv64-elf-gcc9 and riscv64-suse-linux-gcc9 packages and here is a summary: * Compiling U-Boot by riscv64-suse-linux-gcc9: Fail * Compiling kernel by riscv64-suse-linux-gcc9: Pass * Compiling U-Boot by riscv64-elf-gcc9: Pass * Compiling kernel by riscv64-elf-gcc9: Fail --> Maybe it's not a problem because the elf-gcc9 might not be configured mainly for linux? I also tried compiling a toolchain based on https://github.com/riscv/riscv-gnu-toolchain and its riscv64-linux-gnu can compile both uboot and kernel. But I haven't tried its riscv64-elf. Detailed compiling errors are as below: ---------------------------------------------- <Compiling U-Boot by riscv64-suse-linux-gcc9: Fail> LD lib/built-in.o CC examples/standalone/hello_world.o CC examples/standalone/stubs.o LD examples/standalone/libstubs.o LD examples/standalone/hello_world riscv64-suse-linux-ld.bfd: cannot find -lgcc make[2]: *** [examples/standalone/Makefile:62: examples/standalone/hello_world] Error 1 make[1]: *** [scripts/Makefile.build:432: examples/standalone] Error 2 make: *** [Makefile:1582: examples] Error 2 ---------------------------------------------- <Compiler information of riscv64-suse-linux-gcc9> chester@linux-8mug:~> riscv64-suse-linux-gcc -v Using built-in specs. COLLECT_GCC=riscv64-suse-linux-gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/riscv64-suse-linux/9/lto-wrapper Target: riscv64-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++ --disable-werror --with-gxx-include-dir=/usr/include/c++/9 --enable-ssp --disable-libssp --disable-libvtv --disable-cet --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-9 --program-prefix=riscv64-suse-linux- --target=riscv64-suse-linux --disable-nls --with-sysroot=/usr/riscv64-suse-linux --with-build-sysroot=/usr/riscv64-suse-linux --with-build-time-tools=/usr/riscv64-suse-linux/bin --disable-multilib --build=x86_64-suse-linux --host=x86_64-suse-linux Thread model: posix gcc version 9.1.1 20190611 [gcc-9-branch revision 272147] (SUSE Linux) ---------------------------------------------- <Compiling kernel by riscv64-elf-gcc9: Fail> CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h CC [M] fs/coda/psdev.o In file included from ./include/linux/coda.h:64, from fs/coda/psdev.c:45: ./include/uapi/linux/coda.h:221:2: error: unknown type name 'u_quad_t' 221 | u_quad_t va_size; /* file size in bytes */ | ^~~~~~~~ ./include/uapi/linux/coda.h:229:2: error: unknown type name 'u_quad_t' 229 | u_quad_t va_bytes; /* bytes of disk space held by file */ | ^~~~~~~~ ./include/uapi/linux/coda.h:230:2: error: unknown type name 'u_quad_t' 230 | u_quad_t va_filerev; /* file modification number */ | ^~~~~~~~ make[2]: *** [scripts/Makefile.build:276: fs/coda/psdev.o] Error 1 make[1]: *** [scripts/Makefile.build:486: fs/coda] Error 2 make: *** [Makefile:1051: fs] Error 2 chester@linux-8mug:~/workspace/build/riscv/linux> ---------------------------------------------- <Compiler information of riscv64-elf-gcc9> chester@linux-8mug:~/workspace/build/riscv/linux> riscv64-elf-gcc -v Using built-in specs. COLLECT_GCC=riscv64-elf-gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/riscv64-elf/9/lto-wrapper Target: riscv64-elf Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++ --disable-werror --with-gxx-include-dir=/usr/include/c++/9 --enable-ssp --disable-libssp --disable-libvtv --disable-cet --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-9 --program-prefix=riscv64-elf- --target=riscv64-elf --disable-nls --with-sysroot=/usr/riscv64-suse-linux/sys-root --with-build-sysroot=/usr/riscv64-suse-linux/sys-root --with-build-time-tools=/usr/riscv64-suse-linux/bin --with-newlib --disable-multilib --build=x86_64-suse-linux --host=x86_64-suse-linux Thread model: single gcc version 9.1.1 20190611 [gcc-9-branch revision 272147] (SUSE Linux) ---------------------------------------------- Zypper info: linux-8mug:~/riscv-pk/ub3 # zypper se -s "riscv64" | grep gcc9 i+ | cross-riscv64-elf-gcc9 | package | 9.1.1+r272147-1.1 | x86_64 | openSUSE-Tumbleweed-Oss v | cross-riscv64-elf-gcc9 | package | 9.1.1+r272147-1.1 | i586 | openSUSE-Tumbleweed-Oss | cross-riscv64-elf-gcc9-bootstrap | package | 9.1.1+r272147-1.1 | x86_64 | openSUSE-Tumbleweed-Oss | cross-riscv64-elf-gcc9-bootstrap | package | 9.1.1+r272147-1.1 | i586 | openSUSE-Tumbleweed-Oss i+ | cross-riscv64-gcc9 | package | 9.1.1+r272147-1.1 | x86_64 | openSUSE-Tumbleweed-Oss | cross-riscv64-gcc9-icecream-backend | package | 9.1.1+r272147-1.1 | x86_64 | openSUSE-Tumbleweed-Oss
Andreas added the crosses.
None of the cross packages contain libgcc.
cross-riscv64-elf-gcc9 contains static libgcc and uses newlib which you need to install as well, cross-riscv64-newlib-devel (doesn't seem we put in Requires). cross-riscv64-gcc9 is the usual crippled glibc based cross which can only be used to build the kernel because it lacks a glibc for building and we lack it for building glibc. The crosses are essentially unmaintained, the other Andreas added them. Setting up crosses for glibc based compilers properly will be hard, setting them up for targets where OBS has builders might work in the hackish way (package noarch cross-$arch-glibc-devel on native $arch by shuffling around files and then aggregating them across the OBS repos).