Bootstrapped Rust
After reading https://guix.gnu.org/blog/2018/bootstrapping-rust/ I have discovered a Rust compiler written in C++ - mrust. It only needed a few changes to make it work on Dyson. I have committed them to https://git.osdyson.ru/rust/mrust.
When building a few troubles raised, the most important is that it needs a lot of memory, A LOT :). At some step there was a C file of size 760 MiB. I could not build it on a server with 12 GiB RAM and 40GiB swap (!), the server just hung. Then I spun up a VirtualBox instance with about 18GiB RAM (on a 24 GiB RAM server) plus 20 GiB swap. It took a while to compile, but finally it succeeded.
Here is a screenshot of the process:
mrust currently builds Rust 1.29, I have to add extra patch to make Rust work on Dyson. It adds new target (x86_64-pc-solaris) which seems to appear in later Rust versions, and disables Rust version detection in the regex crate, because it fails to find the rust compiler for some reason.
What I have now:
root@dyson:~/mrust# cat ~/main.rs fn main () { println!("hello"); } root@dyson:~/mrust# run_rustc/output/prefix/bin/rustc --version rustc 1.29.0-stable-mrustc root@dyson:~/mrust# run_rustc/output/prefix/bin/rustc ~/main.rs -o /tmp/main root@dyson:~/mrust# ldd /tmp/main libsocket.so.1 => /lib/x86_64-illumos/libsocket.so.1 libresolv.so.2 => /lib/x86_64-illumos/libresolv.so.2 libgcc_s.so.1 => /lib/x86_64-illumos/libgcc_s.so.1 libc.so.1 => /lib/x86_64-illumos/libc.so.1 libm.so.2 => /lib/x86_64-illumos/libm.so.2 libnsl.so.1 => /lib/x86_64-illumos/libnsl.so.1 libmd.so.1 => /lib/x86_64-illumos/libmd.so.1 libmp.so.2 => /lib/x86_64-illumos/libmp.so.2 root@dyson:~/mrust# file /tmp/main /tmp/main: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/amd64/ld.so.1, BuildID[sha1]=2c927fc72b5c16174196c35914d80a1f0cc8a75b, not stripped root@dyson:~/mrust# /tmp/main hello
Comments