Closed alexzanderr closed 1 year ago
this is the output of the test.sh:
This is failure in test.sh
is a known issue: https://github.com/bjorn3/rustc_codegen_cranelift/issues/1303 I believe the glibc version determines if this issue shows up or not. Ubuntu 20.04 doesn't have issues, but Ubuntu 22.04 does. Same for Debian 11 working fine and the upcoming Debian 12 not working. It only shows up for this specific jit mode test and not any of the other tests. You aren't using jit mode, so this shouldn't give any issues.
Did you use ./y.rs build
or ./test.sh
? If you used ./test.sh
try ./y.rs build
to see if that solves the issue. The above issue probably caused ./test.sh
to fail before building the standard library.
i used ./y.rs prepare
&& ./y.rs build
first, in this order
ok now its working ... what ?
i've rerun ./y.rs build
and everything was building again (shouldnt because i didnt change anything, except meanwhile i switched to mold linker) and:
anyway, something is wrong, because i've set my linker to be mold
and i dont see all of my cores running when linking (so its not using mold, cuz mold is multi-threaded and uses all cores)
i also have the mold linker defined globally inside ~/.cargo/config.toml
, but cranelift doesnt seem to use it
ok now its working ... what ?
Weird.
i also have the mold linker defined globally inside ~/.cargo/config.toml, but cranelift doesnt seem to use it
How did you specify the linker? Did you use the rustflags
key in ~/.cargo/config.toml
? If so I think the RUSTFLAGS
env var set by cargo-clif overrides it. If you set the linker using the RUSTFLAGS
env var, cargo-clif should append it's own rustflags to it rather than override it. I'm not quite sure how to make cargo-clif append the rustflags when using the rustflags
key in ~/.cargo/config.toml
too without copying the entire logic cargo uses to determine the value to use for rustflags.
❱ cat ~/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"]
well for sure cargo-clif ignores my global rustflags
because linking is faster without cranelift
so cranelift doesnt use mold from settings.
how do i specify to cranelift to use the mold linker?
can i use linker arguments within the build.rs script of my project like this for cranelift to know about external linker?
println!("cargo:rustc-link-arg= ... ");
i think i found one possible working solution: to pass rustflags as env variable to cargo-clif process:
RUSTFLAGS="-C link-arg=-fuse-ld=/usr/bin/mold" \
./rustc_codegen_cranelift/dist/cargo-clif build
this seems to work, how do i know?
Happy to hear that it works now. Can this issue be closed?
sure i have 1 question before closing, to not open a new issue for that.
can cranelift be used for android
, ios
, and wasm32
platforms/targert_os'es ?
Cranelift doesn't yet support compiling for Webassembly. It also doesn't yet support AArch64 + Mach-O, so ios won't work. I would expect android to work though, but I never tried it.
sure, thanks for everything!
stdlib is not included when building a project with cranelift
hello
im trying to build my project with cranelift
i've followed the instructions in the readme:
git clone https://github.com/bjorn3/rustc_codegen_cranelift && cd rustc_codegen_cranelift
in my project./y.rs prepare
./y.rs build
ortest.sh
./rustc_codegen_cranelift/dist/cargo-clif run
from my project seems to workbut the problem is that when im running
cargo-clif run
goes through the process of building and the rust standard library is not found.error i got:
basic stuff from
std
likeVec, String, Err, Some, etc ...
are missingwhat am i missing? what is the problem?
i saw that rust-toolchain was present and the script did its stuff with custom toolchain, so i didnt have any influence on the build.
this is the output of the
test.sh
:exit code is 1, the output doesnt seem to be something wrong, but about the exit code i dont have a good feeling.
note: prepare and build was successful
extra note: i saw that the other deps were built and
serde
must have std:so i dont know
thanks in advance!