crossdirect: support rust
Right now, the rust compiler rustc is running in qemu. This is frustratingly slow, and hangs forever for @minlexx as reported in https://gitlab.com/postmarketOS/pmaports/merge_requests/841#note_265824821. So I looked into adding support to crossdirect.
Two hours later, I have a proof of concept. I can't compile squeekboard right now, because of an unrelated libdrm conflict (will try to figure that one out after posting this issue and related MRs), but it does cross compile a hello-world program successfully.
How it works:
-
pmbootstrap build --arch=armhf
runs the build in thebuildroot_armhf
chroot and mounts/native
to point atbuildroot_native
, then runs the build with/native/usr/lib/crossdirect/armhf
infront of PATH (as usually with crossdirect) -
rustc
is installed inbuildroot_native
, if the package has rust in its build depends -
cargo
runs in thebuildroot_armhf
- a new
/native/usr/lib/crossdirect/armhf/rustc
shell script wrapper calls/native/usr/bin/rustc
with options to make it cross compile to armhf - one of the options sets the Clinker to point at another wrapper script, which calls gcc from the foreign arch chroot. This is necessary until #233 is resolved.
TODO:
-
proof of concept, that works with hello-world-rust -
crosscompile squeekboard successfully for all supported archesstill failing later in the build process, but having crossdirect support in rust (and proper caching of the rust dirs, see pmbootstrap MR) is already improving the situation, so I'm wrapping this up. I'll create a separate issue regarding squeekboard as soon as I find time; we should probably start splitting up the dependencies in own packages etc, and try to do the phosh upgrade first without the squeekboard upgrade if possible. -> #407 -
merge pmaports MR (https://gitlab.com/postmarketOS/pmaports/merge_requests/845) -
add pmbootstrap test case (set up buildroot_armhf, replace /usr/bin/rustc with /bin/false, build hello-world-rust) -
merge pmbootstrap MR (!1850 (merged))
CC: @zhuowei
Edited by Administrator