deltachat / deltachat-node

Email-based instant messaging for Node.js.
GNU General Public License v3.0
45 stars 11 forks source link

set lto=on when calling cargo #475

Open r10s opened 4 years ago

r10s commented 4 years ago

in deltachat-core-rust, lto is no longer set, however it is possible to set that bit using RUSTFLAGS, see see https://github.com/deltachat/deltachat-android/pull/1512 and https://github.com/deltachat/deltachat-ios/pull/885 for details.

Simon-Laux commented 4 years ago

LTO via rustflags seems to be something different than when specifing lto=true inside of deltachat-core's cargo.toml. It throws an error when using it with rustflags (atleast on macOS and linux).

to reproduce the error:

RUSTFLAGS="-C lto=on -C embed-bitcode=yes" cargo build --release --features vendored -p deltachat_ffi
link2xt commented 2 years ago

Linking is done by node-gyp against libdeltachat.a, this is where LTO should be enabled. For cargo LTO is already enabled in release profile, but it does not matter because cargo does not start the linker.