[WIP] mrustc: init #1

Closed
ophestra wants to merge 1 commits from wip-mrustc into master
Owner

This bootstraps rust toolchain for the chromium browser.

This bootstraps rust toolchain for the chromium browser.
Author
Owner

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 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 ```
cat force-pushed wip-mrustc from ed52019f35 to 81be6c3e4b 2026-07-19 03:57:37 +09:00 Compare
cat force-pushed wip-mrustc from 81be6c3e4b to c6378d7cc7 2026-07-19 05:39:44 +09:00 Compare
Author
Owner

Currently fails while compiling rustc:

Process was terminated with signal 11
FAILING COMMAND: /usr/src/mrustc/bin/mrustc rustc-1.90.0-src/vendor/crossbeam-epoch-0.9.18/src/lib.rs -o output-1.90.0/rustc-build/libcrossbeam_epoch-0_9_18_H43.rlib -C emit-depfile=output-1.90.0/rustc-build/libcrossbeam_epoch-0_9_18_H43.rlib.d --cfg debug_assertions -O -L output-1.90.0 -L output-1.90.0/rustc-build --cfg feature="std" --cfg feature="alloc" --cfg feature="crossbeam-utils" --cfg feature="dep:crossbeam-utils" --crate-name crossbeam_epoch --crate-type rlib --crate-tag 0_9_18_H43 --edition 2021 --extern crossbeam_utils=output-1.90.0/rustc-build/libcrossbeam_utils-0_8_21_H8.rlib
Env:  OUT_DIR=/usr/src/mrustc/output-1.90.0/rustc-build/build_crossbeam-epoch-0_9_18_H43 CARGO_CRATE_NAME=crossbeam_epoch CARGO_MANIFEST_DIR=/usr/src/mrustc/rustc-1.90.0-src/vendor/crossbeam-epoch-0.9.18 CARGO_PKG_NAME=crossbeam-epoch CARGO_PKG_VERSION=0.9.18 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=9 CARGO_PKG_VERSION_PATCH=18
Currently fails while compiling rustc: ``` Process was terminated with signal 11 FAILING COMMAND: /usr/src/mrustc/bin/mrustc rustc-1.90.0-src/vendor/crossbeam-epoch-0.9.18/src/lib.rs -o output-1.90.0/rustc-build/libcrossbeam_epoch-0_9_18_H43.rlib -C emit-depfile=output-1.90.0/rustc-build/libcrossbeam_epoch-0_9_18_H43.rlib.d --cfg debug_assertions -O -L output-1.90.0 -L output-1.90.0/rustc-build --cfg feature="std" --cfg feature="alloc" --cfg feature="crossbeam-utils" --cfg feature="dep:crossbeam-utils" --crate-name crossbeam_epoch --crate-type rlib --crate-tag 0_9_18_H43 --edition 2021 --extern crossbeam_utils=output-1.90.0/rustc-build/libcrossbeam_utils-0_8_21_H8.rlib Env: OUT_DIR=/usr/src/mrustc/output-1.90.0/rustc-build/build_crossbeam-epoch-0_9_18_H43 CARGO_CRATE_NAME=crossbeam_epoch CARGO_MANIFEST_DIR=/usr/src/mrustc/rustc-1.90.0-src/vendor/crossbeam-epoch-0.9.18 CARGO_PKG_NAME=crossbeam-epoch CARGO_PKG_VERSION=0.9.18 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=9 CARGO_PKG_VERSION_PATCH=18 ```
cat force-pushed wip-mrustc from c6378d7cc7 to 62e57ed98b 2026-07-19 06:36:10 +09:00 Compare
Author
Owner

No longer segfaulting after reverting 99d9bd0c788b0c72fc2f4fee6187a462ceb059f2.

Currently fails while compiling rustc_llvm:

error occurred in cc-rs: command did not execute successfully (status code exit status: 1): LC_ALL="C" "c++" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I/system/include" "-std=c++17" "-stdlib=libc++" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-fno-exceptions" "-DLLVM_COMPONENT_AARCH64" "-DLLVM_COMPONENT_AMDGPU" "-DLLVM_COMPONENT_ARM" "-DLLVM_COMPONENT_ASMPARSER" "-DLLVM_COMPONENT_AVR" "-DLLVM_COMPONENT_BITREADER" "-DLLVM_COMPONENT_BITWRITER" "-DLLVM_COMPONENT_BPF" "-DLLVM_COMPONENT_COVERAGE" "-DLLVM_COMPONENT_HEXAGON" "-DLLVM_COMPONENT_INSTRUMENTATION" "-DLLVM_COMPONENT_IPO" "-DLLVM_COMPONENT_LINKER" "-DLLVM_COMPONENT_LOONGARCH" "-DLLVM_COMPONENT_LTO" "-DLLVM_COMPONENT_MIPS" "-DLLVM_COMPONENT_MSP430" "-DLLVM_COMPONENT_NVPTX" "-DLLVM_COMPONENT_POWERPC" "-DLLVM_COMPONENT_RISCV" "-DLLVM_COMPONENT_SPARC" "-DLLVM_COMPONENT_SYSTEMZ" "-DLLVM_COMPONENT_WEBASSEMBLY" "-DLLVM_COMPONENT_X86" "-DNDEBUG" "-o" "/usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm/ef10e86dc40538c1-PassWrapper.o" "-c" "llvm-wrapper/PassWrapper.cpp"


Process exited with non-zero exit status 1
FAILING COMMAND: /usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm_run
Env:  OUT_DIR=/usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm CARGO_MANIFEST_DIR=/usr/src/mrustc/rustc-1.90.0-src/compiler/rustc_llvm CARGO_PKG_NAME=rustc_llvm CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 TARGET=x86_64-unknown-linux-musl HOST=x86_64-unknown-linux-musl NUM_JOBS=1 OPT_LEVEL=2 DEBUG=0 PROFILE=release RUSTC=/usr/src/mrustc/bin/mrustc MRUSTC_LIBDIR=/usr/src/mrustc/output-1.90.0 CARGO_CFG_TARGET_VENDOR= CARGO_CFG_TARGET_VENDOR=gnu CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_OS=linux CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=ptr CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=8 CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=64 CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=32 CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=16 CARGO_CFG_RUST_COMPILER=mrustc CARGO_CFG_TARGET_ABI=llvm CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=8 CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=ptr CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=64 CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=32 CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=16 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ARCH=x86_64 CARGO_CFG_TARGET_ENV=musl CARGO_CFG_TARGET_HAS_ATOMIC=8 CARGO_CFG_TARGET_HAS_ATOMIC=cas CARGO_CFG_TARGET_HAS_ATOMIC=ptr CARGO_CFG_TARGET_HAS_ATOMIC=64 CARGO_CFG_TARGET_HAS_ATOMIC=32 CARGO_CFG_TARGET_HAS_ATOMIC=16 CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_UNIX=1 CARGO_CFG_LINUX=1
Calling output-1.90.0/rustc-build/build_rustc_llvm_run failed (see output-1.90.0/rustc-build/build_rustc_llvm.txt_failed.txt for stdout)

output-1.90.0/rustc-build/build_rustc_llvm.txt_failed.txt:

cargo:rustc-check-cfg=cfg(llvm_component,values("ipo"))
cargo:rustc-check-cfg=cfg(llvm_component,values("bitreader"))
cargo:rustc-check-cfg=cfg(llvm_component,values("bitwriter"))
cargo:rustc-check-cfg=cfg(llvm_component,values("linker"))
cargo:rustc-check-cfg=cfg(llvm_component,values("asmparser"))
cargo:rustc-check-cfg=cfg(llvm_component,values("lto"))
cargo:rustc-check-cfg=cfg(llvm_component,values("coverage"))
cargo:rustc-check-cfg=cfg(llvm_component,values("instrumentation"))
cargo:rustc-check-cfg=cfg(llvm_component,values("x86"))
cargo:rustc-check-cfg=cfg(llvm_component,values("arm"))
cargo:rustc-check-cfg=cfg(llvm_component,values("aarch64"))
cargo:rustc-check-cfg=cfg(llvm_component,values("amdgpu"))
cargo:rustc-check-cfg=cfg(llvm_component,values("avr"))
cargo:rustc-check-cfg=cfg(llvm_component,values("loongarch"))
cargo:rustc-check-cfg=cfg(llvm_component,values("m68k"))
cargo:rustc-check-cfg=cfg(llvm_component,values("csky"))
cargo:rustc-check-cfg=cfg(llvm_component,values("mips"))
cargo:rustc-check-cfg=cfg(llvm_component,values("powerpc"))
cargo:rustc-check-cfg=cfg(llvm_component,values("systemz"))
cargo:rustc-check-cfg=cfg(llvm_component,values("jsbackend"))
cargo:rustc-check-cfg=cfg(llvm_component,values("webassembly"))
cargo:rustc-check-cfg=cfg(llvm_component,values("msp430"))
cargo:rustc-check-cfg=cfg(llvm_component,values("sparc"))
cargo:rustc-check-cfg=cfg(llvm_component,values("nvptx"))
cargo:rustc-check-cfg=cfg(llvm_component,values("hexagon"))
cargo:rustc-check-cfg=cfg(llvm_component,values("riscv"))
cargo:rustc-check-cfg=cfg(llvm_component,values("xtensa"))
cargo:rustc-check-cfg=cfg(llvm_component,values("bpf"))
cargo:rerun-if-env-changed=RUST_CHECK
cargo:rerun-if-env-changed=REAL_LIBRARY_PATH_VAR
cargo:rerun-if-env-changed=REAL_LIBRARY_PATH
cargo:rerun-if-env-changed=LLVM_CONFIG
cargo:rerun-if-changed=/system/bin/llvm-config
cargo:rustc-cfg=llvm_component="aarch64"
cargo:rustc-cfg=llvm_component="amdgpu"
cargo:rustc-cfg=llvm_component="arm"
cargo:rustc-cfg=llvm_component="asmparser"
cargo:rustc-cfg=llvm_component="avr"
cargo:rustc-cfg=llvm_component="bitreader"
cargo:rustc-cfg=llvm_component="bitwriter"
cargo:rustc-cfg=llvm_component="bpf"
cargo:rustc-cfg=llvm_component="coverage"
cargo:rustc-cfg=llvm_component="hexagon"
cargo:rustc-cfg=llvm_component="instrumentation"
cargo:rustc-cfg=llvm_component="ipo"
cargo:rustc-cfg=llvm_component="linker"
cargo:rustc-cfg=llvm_component="loongarch"
cargo:rustc-cfg=llvm_component="lto"
cargo:rustc-cfg=llvm_component="mips"
cargo:rustc-cfg=llvm_component="msp430"
cargo:rustc-cfg=llvm_component="nvptx"
cargo:rustc-cfg=llvm_component="powerpc"
cargo:rustc-cfg=llvm_component="riscv"
cargo:rustc-cfg=llvm_component="sparc"
cargo:rustc-cfg=llvm_component="systemz"
cargo:rustc-cfg=llvm_component="webassembly"
cargo:rustc-cfg=llvm_component="x86"
cargo:rerun-if-env-changed=LLVM_ENZYME
cargo:rerun-if-env-changed=LLVM_RUSTLLVM
cargo:rerun-if-env-changed=LLVM_ASSERTIONS
cargo:rerun-if-changed=llvm-wrapper/SuppressLLVMWarnings.h
cargo:rerun-if-changed=llvm-wrapper/LLVMWrapper.h
cargo:rerun-if-changed=llvm-wrapper/RustWrapper.cpp
cargo:rerun-if-changed=llvm-wrapper/ArchiveWrapper.cpp
cargo:rerun-if-changed=llvm-wrapper/.editorconfig
cargo:rerun-if-changed=llvm-wrapper/CoverageMappingWrapper.cpp
cargo:rerun-if-changed=llvm-wrapper/PassWrapper.cpp
cargo:rerun-if-changed=llvm-wrapper/Linker.cpp
cargo:rerun-if-changed=llvm-wrapper/SymbolWrapper.cpp
cargo:rerun-if-changed=llvm-wrapper/README
OUT_DIR = Some(/usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm)
OPT_LEVEL = Some(2)
TARGET = Some(x86_64-unknown-linux-musl)
HOST = Some(x86_64-unknown-linux-musl)
cargo:rerun-if-env-changed=CXX_x86_64-unknown-linux-musl
CXX_x86_64-unknown-linux-musl = None
cargo:rerun-if-env-changed=CXX_x86_64_unknown_linux_musl
CXX_x86_64_unknown_linux_musl = None
cargo:rerun-if-env-changed=HOST_CXX
HOST_CXX = None
cargo:rerun-if-env-changed=CXX
CXX = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(0)
CARGO_CFG_TARGET_FEATURE = None
cargo:rerun-if-env-changed=CXXFLAGS
CXXFLAGS = None
cargo:rerun-if-env-changed=HOST_CXXFLAGS
HOST_CXXFLAGS = None
cargo:rerun-if-env-changed=CXXFLAGS_x86_64_unknown_linux_musl
CXXFLAGS_x86_64_unknown_linux_musl = None
cargo:rerun-if-env-changed=CXXFLAGS_x86_64-unknown-linux-musl
CXXFLAGS_x86_64-unknown-linux-musl = None
CARGO_ENCODED_RUSTFLAGS = None
cargo:warning=c++: error: unrecognized command-line option '-stdlib=libc++'
No longer segfaulting after reverting `99d9bd0c788b0c72fc2f4fee6187a462ceb059f2`. Currently fails while compiling `rustc_llvm`: ``` error occurred in cc-rs: command did not execute successfully (status code exit status: 1): LC_ALL="C" "c++" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I/system/include" "-std=c++17" "-stdlib=libc++" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-fno-exceptions" "-DLLVM_COMPONENT_AARCH64" "-DLLVM_COMPONENT_AMDGPU" "-DLLVM_COMPONENT_ARM" "-DLLVM_COMPONENT_ASMPARSER" "-DLLVM_COMPONENT_AVR" "-DLLVM_COMPONENT_BITREADER" "-DLLVM_COMPONENT_BITWRITER" "-DLLVM_COMPONENT_BPF" "-DLLVM_COMPONENT_COVERAGE" "-DLLVM_COMPONENT_HEXAGON" "-DLLVM_COMPONENT_INSTRUMENTATION" "-DLLVM_COMPONENT_IPO" "-DLLVM_COMPONENT_LINKER" "-DLLVM_COMPONENT_LOONGARCH" "-DLLVM_COMPONENT_LTO" "-DLLVM_COMPONENT_MIPS" "-DLLVM_COMPONENT_MSP430" "-DLLVM_COMPONENT_NVPTX" "-DLLVM_COMPONENT_POWERPC" "-DLLVM_COMPONENT_RISCV" "-DLLVM_COMPONENT_SPARC" "-DLLVM_COMPONENT_SYSTEMZ" "-DLLVM_COMPONENT_WEBASSEMBLY" "-DLLVM_COMPONENT_X86" "-DNDEBUG" "-o" "/usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm/ef10e86dc40538c1-PassWrapper.o" "-c" "llvm-wrapper/PassWrapper.cpp" Process exited with non-zero exit status 1 FAILING COMMAND: /usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm_run Env: OUT_DIR=/usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm CARGO_MANIFEST_DIR=/usr/src/mrustc/rustc-1.90.0-src/compiler/rustc_llvm CARGO_PKG_NAME=rustc_llvm CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 TARGET=x86_64-unknown-linux-musl HOST=x86_64-unknown-linux-musl NUM_JOBS=1 OPT_LEVEL=2 DEBUG=0 PROFILE=release RUSTC=/usr/src/mrustc/bin/mrustc MRUSTC_LIBDIR=/usr/src/mrustc/output-1.90.0 CARGO_CFG_TARGET_VENDOR= CARGO_CFG_TARGET_VENDOR=gnu CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_OS=linux CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=ptr CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=8 CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=64 CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=32 CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=16 CARGO_CFG_RUST_COMPILER=mrustc CARGO_CFG_TARGET_ABI=llvm CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=8 CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=ptr CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=64 CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=32 CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=16 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ARCH=x86_64 CARGO_CFG_TARGET_ENV=musl CARGO_CFG_TARGET_HAS_ATOMIC=8 CARGO_CFG_TARGET_HAS_ATOMIC=cas CARGO_CFG_TARGET_HAS_ATOMIC=ptr CARGO_CFG_TARGET_HAS_ATOMIC=64 CARGO_CFG_TARGET_HAS_ATOMIC=32 CARGO_CFG_TARGET_HAS_ATOMIC=16 CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_UNIX=1 CARGO_CFG_LINUX=1 Calling output-1.90.0/rustc-build/build_rustc_llvm_run failed (see output-1.90.0/rustc-build/build_rustc_llvm.txt_failed.txt for stdout) ``` `output-1.90.0/rustc-build/build_rustc_llvm.txt_failed.txt`: ``` cargo:rustc-check-cfg=cfg(llvm_component,values("ipo")) cargo:rustc-check-cfg=cfg(llvm_component,values("bitreader")) cargo:rustc-check-cfg=cfg(llvm_component,values("bitwriter")) cargo:rustc-check-cfg=cfg(llvm_component,values("linker")) cargo:rustc-check-cfg=cfg(llvm_component,values("asmparser")) cargo:rustc-check-cfg=cfg(llvm_component,values("lto")) cargo:rustc-check-cfg=cfg(llvm_component,values("coverage")) cargo:rustc-check-cfg=cfg(llvm_component,values("instrumentation")) cargo:rustc-check-cfg=cfg(llvm_component,values("x86")) cargo:rustc-check-cfg=cfg(llvm_component,values("arm")) cargo:rustc-check-cfg=cfg(llvm_component,values("aarch64")) cargo:rustc-check-cfg=cfg(llvm_component,values("amdgpu")) cargo:rustc-check-cfg=cfg(llvm_component,values("avr")) cargo:rustc-check-cfg=cfg(llvm_component,values("loongarch")) cargo:rustc-check-cfg=cfg(llvm_component,values("m68k")) cargo:rustc-check-cfg=cfg(llvm_component,values("csky")) cargo:rustc-check-cfg=cfg(llvm_component,values("mips")) cargo:rustc-check-cfg=cfg(llvm_component,values("powerpc")) cargo:rustc-check-cfg=cfg(llvm_component,values("systemz")) cargo:rustc-check-cfg=cfg(llvm_component,values("jsbackend")) cargo:rustc-check-cfg=cfg(llvm_component,values("webassembly")) cargo:rustc-check-cfg=cfg(llvm_component,values("msp430")) cargo:rustc-check-cfg=cfg(llvm_component,values("sparc")) cargo:rustc-check-cfg=cfg(llvm_component,values("nvptx")) cargo:rustc-check-cfg=cfg(llvm_component,values("hexagon")) cargo:rustc-check-cfg=cfg(llvm_component,values("riscv")) cargo:rustc-check-cfg=cfg(llvm_component,values("xtensa")) cargo:rustc-check-cfg=cfg(llvm_component,values("bpf")) cargo:rerun-if-env-changed=RUST_CHECK cargo:rerun-if-env-changed=REAL_LIBRARY_PATH_VAR cargo:rerun-if-env-changed=REAL_LIBRARY_PATH cargo:rerun-if-env-changed=LLVM_CONFIG cargo:rerun-if-changed=/system/bin/llvm-config cargo:rustc-cfg=llvm_component="aarch64" cargo:rustc-cfg=llvm_component="amdgpu" cargo:rustc-cfg=llvm_component="arm" cargo:rustc-cfg=llvm_component="asmparser" cargo:rustc-cfg=llvm_component="avr" cargo:rustc-cfg=llvm_component="bitreader" cargo:rustc-cfg=llvm_component="bitwriter" cargo:rustc-cfg=llvm_component="bpf" cargo:rustc-cfg=llvm_component="coverage" cargo:rustc-cfg=llvm_component="hexagon" cargo:rustc-cfg=llvm_component="instrumentation" cargo:rustc-cfg=llvm_component="ipo" cargo:rustc-cfg=llvm_component="linker" cargo:rustc-cfg=llvm_component="loongarch" cargo:rustc-cfg=llvm_component="lto" cargo:rustc-cfg=llvm_component="mips" cargo:rustc-cfg=llvm_component="msp430" cargo:rustc-cfg=llvm_component="nvptx" cargo:rustc-cfg=llvm_component="powerpc" cargo:rustc-cfg=llvm_component="riscv" cargo:rustc-cfg=llvm_component="sparc" cargo:rustc-cfg=llvm_component="systemz" cargo:rustc-cfg=llvm_component="webassembly" cargo:rustc-cfg=llvm_component="x86" cargo:rerun-if-env-changed=LLVM_ENZYME cargo:rerun-if-env-changed=LLVM_RUSTLLVM cargo:rerun-if-env-changed=LLVM_ASSERTIONS cargo:rerun-if-changed=llvm-wrapper/SuppressLLVMWarnings.h cargo:rerun-if-changed=llvm-wrapper/LLVMWrapper.h cargo:rerun-if-changed=llvm-wrapper/RustWrapper.cpp cargo:rerun-if-changed=llvm-wrapper/ArchiveWrapper.cpp cargo:rerun-if-changed=llvm-wrapper/.editorconfig cargo:rerun-if-changed=llvm-wrapper/CoverageMappingWrapper.cpp cargo:rerun-if-changed=llvm-wrapper/PassWrapper.cpp cargo:rerun-if-changed=llvm-wrapper/Linker.cpp cargo:rerun-if-changed=llvm-wrapper/SymbolWrapper.cpp cargo:rerun-if-changed=llvm-wrapper/README OUT_DIR = Some(/usr/src/mrustc/output-1.90.0/rustc-build/build_rustc_llvm) OPT_LEVEL = Some(2) TARGET = Some(x86_64-unknown-linux-musl) HOST = Some(x86_64-unknown-linux-musl) cargo:rerun-if-env-changed=CXX_x86_64-unknown-linux-musl CXX_x86_64-unknown-linux-musl = None cargo:rerun-if-env-changed=CXX_x86_64_unknown_linux_musl CXX_x86_64_unknown_linux_musl = None cargo:rerun-if-env-changed=HOST_CXX HOST_CXX = None cargo:rerun-if-env-changed=CXX CXX = None cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT RUSTC_WRAPPER = None cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS CRATE_CC_NO_DEFAULTS = None DEBUG = Some(0) CARGO_CFG_TARGET_FEATURE = None cargo:rerun-if-env-changed=CXXFLAGS CXXFLAGS = None cargo:rerun-if-env-changed=HOST_CXXFLAGS HOST_CXXFLAGS = None cargo:rerun-if-env-changed=CXXFLAGS_x86_64_unknown_linux_musl CXXFLAGS_x86_64_unknown_linux_musl = None cargo:rerun-if-env-changed=CXXFLAGS_x86_64-unknown-linux-musl CXXFLAGS_x86_64-unknown-linux-musl = None CARGO_ENCODED_RUSTFLAGS = None cargo:warning=c++: error: unrecognized command-line option '-stdlib=libc++' ```
cat force-pushed wip-mrustc from 62e57ed98b to cc55369b54 2026-07-19 09:04:57 +09:00 Compare
Author
Owner

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 ```
cat force-pushed wip-mrustc from cc55369b54 to 60e0030e9b 2026-07-19 13:56:22 +09:00 Compare
cat force-pushed wip-mrustc from 60e0030e9b to 1ff440e936 2026-07-19 15:17:17 +09:00 Compare
Author
Owner

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 ```
cat force-pushed wip-mrustc from 1ff440e936 to 37b07b121f 2026-07-21 17:58:25 +09:00 Compare
Author
Owner

Current initial stage of rustc/cargo works, run_rustc still requires some work due to the complete failure of rust's pretend hermetic build system.

Current initial stage of rustc/cargo works, `run_rustc` still requires some work due to the complete failure of rust's pretend hermetic build system.
ophestra marked the pull request as work in progress 2026-07-23 00:11:04 +09:00
cat added 1 commit 2026-07-23 00:50:40 +09:00
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>
cat force-pushed wip-mrustc from 37b07b121f to ce971c7651 2026-07-23 00:50:40 +09:00 Compare
Author
Owner

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.
ophestra closed this pull request 2026-07-23 00:57:25 +09:00
ophestra added the
Kind
Enhancement
Priority
Low
Status
Abandoned
labels 2026-08-06 18:21:04 +09:00

Pull request closed

Please reopen this pull request to perform a merge.
This pull request is marked as a work in progress.
Sign in to join this conversation.