Packaging/32bit Applications: Difference between revisions
Added Rust and LTO Cross Compile Notes |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 24: | Line 24: | ||
clang_multi | clang_multi | ||
]; | ]; | ||
</syntaxhighlight>An example that will let you build with <code>cargo test --target i686-unknown-linux-gnu</code>. | </syntaxhighlight>An example that will let you build with <code>cargo test --target i686-unknown-linux-gnu</code> from an x86_64 machine. | ||
You will want something similar to the following in your <code>flake.nix</code>, <code>devenv.sh</code> , or whatever you're using as your entry point. | You will want something similar to the following in your <code>flake.nix</code>, <code>devenv.sh</code> , or whatever you're using as your entry point. | ||
==== Rust LTO & cargo bench ==== | |||
If you are using LTO and are having trouble building benchmarks (<code>cargo bench</code>) you may need to disable it at the build step until someone documents a better workaround here.<syntaxhighlight lang="nix"> | |||
env = { | |||
# Disable LTO for C/C++ code compiled by the `cc` crate for i686. | |||
# Some crates (like `alloca`) add -flto when CC=clang, but binutils ld can't | |||
# process LLVM IR bitcode. Using -fno-lto ensures native object files. | |||
CFLAGS_i686_unknown_linux_gnu = "-fno-lto"; | |||
CXXFLAGS_i686_unknown_linux_gnu = "-fno-lto"; | |||
}; | |||
</syntaxhighlight> | |||
[[Category:Development]] | [[Category:Development]] | ||