Packaging/32bit Applications: Difference between revisions
mNo edit summary |
|||
| Line 9: | Line 9: | ||
Nixpkgs provides <code>multiStdenv.mkDerivation</code> that should be used instead <code>stdenv.mkDerivation</code>. | Nixpkgs provides <code>multiStdenv.mkDerivation</code> that should be used instead <code>stdenv.mkDerivation</code>. | ||
This is equivalent to using <code>gcc-multilib</code> in debian derivatives. | This is equivalent to using <code>gcc-multilib</code> in debian derivatives. | ||
=== Rust === | |||
<syntaxhighlight lang="nix"> | |||
env = { | |||
# Use multilib clang as linker for i686 target. | |||
# Required because Rust's bundled LLD doesn't know about Nix's multilib sysroot paths. | |||
# clang_multi has the correct 32-bit library paths (glibc_multi) baked into its driver. | |||
CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER = "${pkgs.clang_multi}/bin/clang"; | |||
}; | |||
packages = with pkgs; [ | |||
# clang with multilib support (both 32-bit and 64-bit) | |||
# This properly handles -m32 compilation with correct headers/libs | |||
clang_multi | |||
]; | |||
</syntaxhighlight>An example that will let you build with <code>cargo test --target i686-unknown-linux-gnu</code>. | |||
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. | |||
[[Category:Development]] | [[Category:Development]] | ||