Where is the cross toolchain?

I have built an image with Freedom U SDK and I guess there should be a cross-compile toolchain downloaded or compiled. I want to compile my hello world on my host now but I cannot find the toolchain. So where is it? or should I use riscv64-unknown-linux-gnu-gcc?

Actually I used riscv64-linux-gcc-10.2.0: symbolic link to toolchain-wrapper but it cannot work.

OpenEmbedded doesn’t build a user friendly cross compiler by default. It does build the pieces you need for a cross compiler.

Running “MACHINE=unmatched bitbake meta-toolchain” will build an installable cross toolchain image with a sysroot. Mostly this will just package together stuff you have already built. You can find it in build/tmp-glibc/deploy/sdk. Run the .sh script to install it, it will ask for an install dir. Then in the install dir source the environment file and it will set environment variables like CC and CLANGCC to point at the cross compiler. Looks like this only puts glibc in the sysroot.

You can also use “MACHINE=unmatched bitbake -c populate_sdk demo-coreip-xfce4” which might be better if you need more libraries in the sysroot.

If I try both meta-toolchain and -c populate_sdk I get an error saying I can’t overwrite the other toolchain, and have to delete or move it for the build to succeed.

meta-toolchain produces a 1.5GB toolchain. populate_sdk produces a 15GB toolchain.

I don’t have experience using this stuff. I would sugggest reading OE and/or Yocto docs. Here is one reference for instance
And maybe ask someplace where there are OE experts.

1 Like

Thank you very much and perhaps I’m not used to this OE. Besides, I get the correct compiler in riscv-gnu-toolchain repo.

A riscv-gnu-toolchain compiler won’t necessarily work. It may have the wrong kernel headers , the wrong glibc version, the wrong glibc configuration, the wrong gcc configuration, etc. A riscv-gnu-toolchain compiler is likely to work if you static link, and unlikely to work otherwise. It is best to use an actual OE cross compiler, which will have the right versions and configurations of everything.

yes, I find that riscv-gnu-toolchain has a version higher than OE. But trying to locate the toolchain in OE is quite a hard work, compared to git clone gnu-toolchain and compile it…:slight_smile: