/system/x86_64-rosa-linux-musl/bin/ld: output-1.54.0/libstd.rlib.o: in function `ZRG3cD18std0_0_0_H384000003sys4unix5cvt_r2gCfG1c_AH18closureI_open_c_840g':
libstd.rlib.c:(.text.ZRG3cD18std0_0_0_H384000003sys4unix5cvt_r2gCfG1c_AH18closureI_open_c_840g+0x2e): undefined reference to `open64'
/system/x86_64-rosa-linux-musl/bin/ld: output-1.54.0/libstd.rlib.o: in function `ZRG4cD18std0_0_0_H384000003sys4unix2fs5lstat0g':
libstd.rlib.c:(.text.ZRG4cD18std0_0_0_H384000003sys4unix2fs5lstat0g+0x92): undefined reference to `lstat64'
collect2: error: ld returned 1 exit status
Currently fails on glibc-ism:
```
/system/x86_64-rosa-linux-musl/bin/ld: output-1.54.0/libstd.rlib.o: in function `ZRG3cD18std0_0_0_H384000003sys4unix5cvt_r2gCfG1c_AH18closureI_open_c_840g':
libstd.rlib.c:(.text.ZRG3cD18std0_0_0_H384000003sys4unix5cvt_r2gCfG1c_AH18closureI_open_c_840g+0x2e): undefined reference to `open64'
/system/x86_64-rosa-linux-musl/bin/ld: output-1.54.0/libstd.rlib.o: in function `ZRG4cD18std0_0_0_H384000003sys4unix2fs5lstat0g':
libstd.rlib.c:(.text.ZRG4cD18std0_0_0_H384000003sys4unix2fs5lstat0g+0x92): undefined reference to `lstat64'
collect2: error: ld returned 1 exit status
```
Currently rustc and cargo works, make -C run_rustc fails with:
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type
fatal runtime error: out of TLS keys, aborting
Process was terminated with signal 6
FAILING COMMAND: /usr/src/mrustc/run_rustc/output-1.90.0/prefix-s/bin/rustc /usr/src/mrustc/rustc-1.90.0-src/library/core/src/lib.rs -o output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib --emit link,dep-info -C debug-assertions -Z force-unstable-if-unmarked -O -L output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib --crate-name core --crate-type rlib -C metadata=0_0_0 --edition 2024
Env: OUT_DIR=/usr/src/mrustc/run_rustc/output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/build_core CARGO_CRATE_NAME=core CARGO_MANIFEST_DIR=/usr/src/mrustc/rustc-1.90.0-src/library/core CARGO_PKG_NAME=core CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0
Currently `rustc` and `cargo` works, `make -C run_rustc` fails with:
```
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type
fatal runtime error: out of TLS keys, aborting
Process was terminated with signal 6
FAILING COMMAND: /usr/src/mrustc/run_rustc/output-1.90.0/prefix-s/bin/rustc /usr/src/mrustc/rustc-1.90.0-src/library/core/src/lib.rs -o output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib --emit link,dep-info -C debug-assertions -Z force-unstable-if-unmarked -O -L output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib --crate-name core --crate-type rlib -C metadata=0_0_0 --edition 2024
Env: OUT_DIR=/usr/src/mrustc/run_rustc/output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/build_core CARGO_CRATE_NAME=core CARGO_MANIFEST_DIR=/usr/src/mrustc/rustc-1.90.0-src/library/core CARGO_PKG_NAME=core CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0
```
Revert fixed TLS crash. Currently fails on glibc-ism again:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/rustcB2U6jL/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libpanic_unwind,libstd,librustc_demangle-*_1_25_H6,libstd_detect-*_1_5_H58,libhashbrown-*_15_4_H1880d,librustc_std_workspace_alloc-*_99_0,libunwind,libcfg_if-*_0_1_H3,liblibc-*_2_174_H19,librustc_std_workspace_core-*_99_0,liballoc,libcore,libcompiler_builtins-*_1_160_H104}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcB2U6jL/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "output-1.90.0/prefix-s/bin/hello_world" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /system/bin/ld: /usr/src/rustc-bootstrap/run_rustc/output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib(libstd.std.a7109f025fc14769-cgu.12.rcgu.o): in function `std::sys::pal::unix::stack_overflow::imp::make_handler':
std.a7109f025fc14769-cgu.12:(.text._ZN3std3sys3pal4unix14stack_overflow3imp12make_handler17hee2153c551dccab9E+0x18f): undefined reference to `mmap64'
/system/bin/ld: /usr/src/rustc-bootstrap/run_rustc/output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib(libstd.std.a7109f025fc14769-cgu.14.rcgu.o): in function `std::sys::pal::unix::init':
std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0xb7): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0xf3): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0x146): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0x16c): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0x192): undefined reference to `open64'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
Revert fixed TLS crash. Currently fails on glibc-ism again:
```
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/rustcB2U6jL/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libpanic_unwind,libstd,librustc_demangle-*_1_25_H6,libstd_detect-*_1_5_H58,libhashbrown-*_15_4_H1880d,librustc_std_workspace_alloc-*_99_0,libunwind,libcfg_if-*_0_1_H3,liblibc-*_2_174_H19,librustc_std_workspace_core-*_99_0,liballoc,libcore,libcompiler_builtins-*_1_160_H104}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcB2U6jL/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "output-1.90.0/prefix-s/bin/hello_world" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /system/bin/ld: /usr/src/rustc-bootstrap/run_rustc/output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib(libstd.std.a7109f025fc14769-cgu.12.rcgu.o): in function `std::sys::pal::unix::stack_overflow::imp::make_handler':
std.a7109f025fc14769-cgu.12:(.text._ZN3std3sys3pal4unix14stack_overflow3imp12make_handler17hee2153c551dccab9E+0x18f): undefined reference to `mmap64'
/system/bin/ld: /usr/src/rustc-bootstrap/run_rustc/output-1.90.0/prefix-s/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib(libstd.std.a7109f025fc14769-cgu.14.rcgu.o): in function `std::sys::pal::unix::init':
std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0xb7): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0xf3): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0x146): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0x16c): undefined reference to `open64'
/system/bin/ld: std.a7109f025fc14769-cgu.14:(.text._ZN3std3sys3pal4unix4init17he09eb8b2417461ebE+0x192): undefined reference to `open64'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
```
This bootstraps rustc via the mrustc alternative compiler. The build
process is extraordinarily ugly because rustc maintainers cargo culted
target triple strings without understanding what they are, and
completely mishandles them. They also appear to lack fundamental system
understanding and assume musl can only be used for static linking. The
build process also fails to populate their so called self-contained
library directory, so it is manually put together here.
This setup uses the vendored LLVM for multiple reasons: the fact that
rustc maintainers manage to fuck up so badly they simultaneously pass
GCC-only and Clang-only flags when using an LLVM configured to use
libc++ instead of GNU slop, and the immense maintenance burden to keep
this up to date enough to use Rosa OS LLVM. For now, time and effort
saved from trying to mutilate this pile of garbage into working with a
proper LLVM build more than compensates for the wasted CPU time.
GCC libraries are included in the output because despite the utter
reluctance to do dynamic linking correctly on musl, it seems that rustc
is also incapable of passing the correct linker flags to produce static
executables, and the miserable mrustc Makefiles make it impossible to
specify custom linker flags. From my previous experience producing a
static virtiofsd build, it would require multiple arguments per library,
all of them in rustc's fucked up custom syntax, and I am not ready to
deal with that. To avoid contaminating future stages with gcc, this
package includes only libraries required at runtime.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Turns out it is not possible to get rustc to compile at all without extensive patching. The rustc maintainers are somehow clueless enough to assume musl does not support dynamic linking. The patch is unmaintainable due to the way rustc maintainers cargo culted target triples: instead of being a 3 or 4 component string with some flexible internal representation, it is simply a hardcoded list requiring exact matches, with each one implemented in its own rust file. This approach completely misunderstands what target triples are meant to do, and makes it so to add our own target, we need a rust file for every single supported architecture, and we need to maintain this file for every step of the bootstrap path and for each toolchain bump.
For now we have a working first stage rustc and cargo. I am abandoning this effort. If anyone wishes to continue this work, please submit a new ticket for your patch set.
Turns out it is not possible to get rustc to compile at all without extensive patching. The rustc maintainers are somehow clueless enough to assume musl does not support dynamic linking. The patch is unmaintainable due to the way rustc maintainers cargo culted target triples: instead of being a 3 or 4 component string with some flexible internal representation, it is simply a hardcoded list requiring exact matches, with each one implemented in its own rust file. This approach completely misunderstands what target triples are meant to do, and makes it so to add our own target, we need a rust file for every single supported architecture, and we need to maintain this file for every step of the bootstrap path and for each toolchain bump.
For now we have a working first stage rustc and cargo. I am abandoning this effort. If anyone wishes to continue this work, please submit a new ticket for your patch set.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This bootstraps rust toolchain for the chromium browser.
Currently fails on glibc-ism:
ed52019f35to81be6c3e4b81be6c3e4btoc6378d7cc7Currently fails while compiling rustc:
c6378d7cc7to62e57ed98bNo longer segfaulting after reverting
99d9bd0c788b0c72fc2f4fee6187a462ceb059f2.Currently fails while compiling
rustc_llvm:output-1.90.0/rustc-build/build_rustc_llvm.txt_failed.txt:62e57ed98btocc55369b54Currently
rustcandcargoworks,make -C run_rustcfails with:cc55369b54to60e0030e9b60e0030e9bto1ff440e936Revert fixed TLS crash. Currently fails on glibc-ism again:
1ff440e936to37b07b121fCurrent initial stage of rustc/cargo works,
run_rustcstill requires some work due to the complete failure of rust's pretend hermetic build system.37b07b121ftoce971c7651Turns out it is not possible to get rustc to compile at all without extensive patching. The rustc maintainers are somehow clueless enough to assume musl does not support dynamic linking. The patch is unmaintainable due to the way rustc maintainers cargo culted target triples: instead of being a 3 or 4 component string with some flexible internal representation, it is simply a hardcoded list requiring exact matches, with each one implemented in its own rust file. This approach completely misunderstands what target triples are meant to do, and makes it so to add our own target, we need a rust file for every single supported architecture, and we need to maintain this file for every step of the bootstrap path and for each toolchain bump.
For now we have a working first stage rustc and cargo. I am abandoning this effort. If anyone wishes to continue this work, please submit a new ticket for your patch set.
Pull request closed