sifive / freedom-tools

Tools for SiFive's Freedom Platform
217 stars 52 forks source link

Cannot compile in Ubuntu 20 x86_64 #74

Closed amnesia13 closed 1 year ago

amnesia13 commented 3 years ago

Dear all,

I tried to compile the freedom-tools on a HP Probook 650 G1 running Ubuntu 20 x86_64 with i386 support. After launching make, I get the following error message:

make -C obj/x86_64-linux-ubuntu14/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/ all-gcc &>obj/x86_64-linux-ubuntu14/build/riscv-gnu-toolchain/build-gcc-newlib-stage1//make-build.log make: *** [Makefile:527 : obj/x86_64-linux-ubuntu14/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp] Erreur 2

Some clues can be found in the obj/x86_64-linux-ubuntu14/build/riscv-gnu-toolchain/build-gcc-newlib-stage1//make-build.log file:

checking for CET support... configure: error: in `......freedom-tools/obj/x86_64-linux-ubuntu14/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/lto-plugin': configure: error: cannot run test program while cross compiling

Any idea bout the way to fix this ?

Regards

jim-wilson commented 3 years ago

This is a bug in the upstream FSF GCC sources. It looks like this was fixed via https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94998

The bug doesn't show up on the systems we use for testing because the native gcc doesn't support the -fcf-protection option so we never try to compile and run the testcase. I was able to reproduce this on Ubuntu 20 though.which has gcc-9 as the system compiler.

amnesia13 commented 3 years ago

Dear Jim,

Thanks for the link and I am going to check if this solves the problem.

Regards

jim-wilson commented 3 years ago

I was able to build ubuntu64-toolchain with that patch. I had to do a make clean first as the build system copies the source files into the build tree, and I didn't know offhand how to force that to be redone, so I just did a make clean. I ran into the problem documented in issue #65 which I worked around by deleting the ubuntu64 --with-python options.

The windows build failed in libusb. Apparently Ubuntu 20 has a mingw32 pkg-config program that doesn't work with the build. Ubuntu 18 doesn't have this program, or at least my Ubuntu 18 machine doesn't have it installed. But I didn't care enough about the windows build to look at that problem.

amnesia13 commented 3 years ago

Dear Jim,

1st of all, a happy new year to you and your family. Following the advice, I installed GCC 10 on my Ubuntu 20 workstation and apparently I have a working release 10.2. Now I need to point to this GCC version and likely setup some env variables to make it.

Regards

lindemer commented 3 years ago

Hi all, was this issue ever resolved? I ran into the same problem.

jim-wilson commented 3 years ago

Probably not fixed yet, but there are workarounds above to get the linux hosted toolchain built. I don't have a workaround for the windows hosted toolchain as I didn't care enough.