I am trying to cross-compile Rust against a sysroot (SDK/ADK…) with a custom GCC toolchain(MontaVista GCC).
The compiler binary is called
Note that I need to cross-compile against a sysroot in order for the application to link to the same system libraries as those that are on the
To cross compile GCC against a sysroot is pretty simple, you call it’s configure script with –with-sysroot and all is taken care of.
I did manage to do it previously, about 5-7 months ago, but now I try again and I can’t manage to do it again.
Using Ogeon’s instructions I managed to cross-compile Rust and cross-compile with it a multi-threaded application which actually worked on my
target without any issues. I even made it talk with another cross-compiled C++/Qt application(by linking the Rust library).
What I think I did(I remember toying with all of these) back then in order to cross-compile against this toolchain:
- Created a folder with links to arm-montavista-linux-gnueabi-* called arm-unknown-linux-gnueabi-*
- Modified something in the configure script, I think around the lines where the switch case is for armv7l
- Changed the Makefiles to call gcc through gcc --sysroot=$MY_SYSROOT or made an alias
- Loaded the cross-compilation environment that sets the cross-compiler as the default compiler, then also sets default ar, linker, sysroot, everything…
What I tried currently:
- Load the cross-compilation environment: the configure script(I think) tries to compile a simple application and run it, to see if the compiler works, but obviously the binary is for ARM and it fails at that point.
For some reason, the flags don’t seem to be set for cross-compilation(I think it might be because it doesn’t know of arm-montavista-… and it fails there), even if I tell it build, host and target.
- arm-unknown-linux… and arm-linux-… links didn’t work either…
I did not try to set manually to call instead of gcc -> gcc --sysroot=, I remembered it just right now, writing thist post.
Any suggestions how I can reliably cross-compile against a custom toolchain + sysroot? May be there are some flags I don’t know of in the configure script?