Subject: Re: Rust building

From: Sergey Matveev <[email-masked]>
Date: Sat, 11 Jun 2022 00:24:08 +0300

*** John Goerzen [2022-06-10 15:46]:
>rustc is written in Rust, as the Go compiler is written in Go.

But the huge difference is that Go's documentation explicitly tells that
you only have to build Go 1.4 with C-compiler and then use it for any
other further versions. Clear, "non-secret" way to build it using native
C-compiler from C-sources and then from Go-sources. 10min and you will
get modern Go compiler.

>https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html

Tried it now. It went downloading
https://static.rust-lang.org/dist/2022-05-20/rust-std-beta-x86_64-unknown-freebsd.tar.xz
without any questions or warnings, trying to run it after. No
information how you can build that binary by self. I know that Rust 1.23
is built using 1.22, that was built with 1.21, and so on. If there were
any clear path how you can make all that path to the code you can build
from native OS'es C-compiler, then it will be ok. But there is no
official information how to do that. Just binaries downloaded from the
Internet. Like I am visiting some modern website sending me yet another
JS/WASM application my computer has to run. Authors just hardcoded
"download and run the binary". No way I can accept that behaviour.

Just out of curiosity I tried to build mrustc now. And it gives many
errors:

    src/hir_conv/constant_evaluation.cpp:2003:41: error: use of undeclared identifier 'v'
                                    return (v >> 8) | (v << 8);

    src/hir_conv/constant_evaluation.cpp:2002:45: error: unknown type name '__builtin_constant_p'
                                static uint16_t bswap16(uint16_t v) {

    src/hir_conv/constant_evaluation.cpp:2021:42: error: expected unqualified-id
                                rv = U128(H::bswap16(val.truncate_u64()));

I succeeded several years ago building it on Devuan only by taking the
notes and steps from GNU Guix'es ports, where they used mrustc to
bootstrap Rust building. It was not trivial task too, because many
things were slightly broken, some things required some cargo packages
downloading of some exact versions and patches, and so on. Maybe I could
cross-build Rust for FreeBSD from that Devuan's installation? No
information about that and FreeBSD is not officially claimed to be
supported by mrustc.

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF