Closed SUPERCILEX closed 1 year ago
This repros, and mustang has the same problem. Plain Origin support LTO, but when it's c-scape/c-gull providing lots of C symbols to satisfy std's symbol references, I don't know of a way to tell LTO what's going on.
Also does not seem to be compatible with -Zbuild-std
, preventing experiments with compact min-sized-rust-style executables.
error[E0464]: multiple candidates for `rlib` dependency `std` found
|
= note: candidate #1: /mnt/fluff/rust-targets/udpexchange/x86_64-unknown-linux-gnu/release/deps/libstd-3fb54c1424513f2d.rlib
= note: candidate #2: /mnt/fluff/rust-targets/udpexchange/x86_64-unknown-linux-gnu/release/deps/libeyra-70919b49f0ae59df.rlib
error: `#[panic_handler]` function required, but not found
@vi Ah, that's a conflict with the new std = { package = "eyra", version = "..." }
trick. If you switch Cargo.toml to eyra = "..."
and add extern crate eyra;
to your code it should work.
Also, on the topic of min-sized-rust, if you don't need std
or libc
, you can get much smaller by omitting Eyra/c-scape/etc. and using Origin directly. This example shows how to produce quite small executables.
I've now added a mention to the README that LTO is not supported. If anyone has any ideas about how to fix it, please post them!
I've now found the problem blocking LTO; it was c-scape's use of #![no_builtins]
, which the Rust compiler interprets to mean the library should be excluded from LTO. That's now fixed in Eyra 0.16.1, so LTO is now working!
Hell yeah, that's awesome!
@vi Ah, that's a conflict with the new
std = { package = "eyra", version = "..." }
trick. If you switch Cargo.toml toeyra = "..."
and addextern crate eyra;
to your code it should work.
Shall this be documented in the README?
@vi Sure. I've now added it in #12.
I get a bunch of linker errors. Let me know if this doesn't repro and I'll add more details.