Search code examples
linuxgcccmakeriscvbuildroot

can't link double-float modules with soft-float modules riscv compiler


I am building a program with the riscv compiler and, when the linking process start, I have the following problem:

/home/luna/noelv-buildroot/output/images/riscv64-buildroot-linux-musl_sdk-buildroot/bin/../lib/gcc/riscv64-buildroot-linux-musl/8.3.0/../../../../riscv64-buildroot-linux-musl/bin/ld: /home/luna/noelv-buildroot/output/images/riscv64-buildroot-linux-musl_sdk-buildroot/bin/../lib/gcc/riscv64-buildroot-linux-musl/8.3.0/libgcc.a(_clzsi2.o): can't link double-float modules with soft-float modules

I am using the compiler to compile and linker my code. This is my compiler:

$ riscv64-linux-gcc --verbose 
COLLECT_GCC=/home/luna/noelv-buildroot/output/images/riscv64-buildroot-linux-musl_sdk-buildroot/bin/riscv64-linux-gcc.br_real
COLLECT_LTO_WRAPPER=/home/luna/noelv-buildroot/output/images/riscv64-buildroot-linux-musl_sdk-buildroot/bin/../libexec/gcc/riscv64-buildroot-linux-musl/8.3.0/lto-wrapper
Configured with ./configure --prefix=/home/luna/noelv-buildroot/output/host --sysconfdir=/home/luna/noelv-buildroot/output/host/etc --enable-static --target=riscv64-buildroot-linux-musl --with-sysroot=/home/luna/noelv-buildroot/output/host/riscv64-buildroot-linux-musl/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --with-gmp=/home/luna/noelv-buildroot/output/host --with-mpc=/home/luna/noelv-buildroot/output/host --with-mpfr=/home/luna/noelv-buildroot/output/host --with-pkgversion='Buildroot 2020.02' --with-bugurl=http://bugs.buildroot.net/ --disable-libmpx --disable-libquadmath --disable-libsanitizer --enable-tls --enable-threads --without-isl --without-cloog --with-arch=rv64imafd --with-abi=lp64d --enable-languages=c,c++ --with-build-time-tools=/home/luna/noelv-buildroot/output/host/riscv64-buildroot-linux-musl/bin --enable-shared --disable-libgomp
Modelo de hilos: posix
gcc version 8.3.0 (Buildroot 2020.02) 

Solution

  • Your compiler was build with disable-multilib and for rv64imafd arch. So basically all the libraries provided with the compiler are compiled for this arch.

    If you try to compile some code with an other arch , you will not be able to link against it by default. Also, if you provide a library, you will need to be sure it was compiled for this arch to use it in the same time with the libraries provided by the tool chain.

    You can see the exact arch and abi of your library with readelf -h.