GCC error occurred in compiling freeom-u-sdk


(ZhuXuanlong) #1

This post was flagged by the community and is temporarily hidden.


(Jim Wilson) #2

You are trying to use an x86 gcc to compile RISC-V code, which won’t work. It isn’t clear what is wrong. A RISC-V compiler should have been built before building riscv-pk, and should have been used for the riscv-pk build. Exactly how this works depends on exactly which version of freedom-u-sdk you have. The current version builds a compiler via buildroot, and then uses it for the riscv-pk build. Your work/riscv-pk/Makefile should have a line
CC := riscv64-sifive-linux-gnu-gcc
and this compiler should be present in work/buildroot_initramfs/host/bin/, and the Makefile should put that on your path before starting the riscv-pk build.

It looks like you tried to set CFLAGS for your build. Don’t do that, as that can’t possibly work. Some of the binaries are x86 binaries and some of the binaries are RISC-V binaries, and your CFLAGS setting won’t work for both. Ideally we would have different make variables for host and target binaries, but we don’t. So don’t try to set CFLAGS as it won’t work. Maybe this caused your build failure some how.

There are ISA and ABI makefile variables you can try using. However, these are not tested, not supported, and unlikely to do anything useful unless you are willing to spend a lot of time fixing them. Such fixes may require linux kernel, glibc, qemu, etc work.

But rv64gc/lp64d is the default anyways, so not clear why you are trying to set CFLAGS.