Packaging/32bit Applications: Difference between revisions

From NixOS Wiki
imported>Makefu
m Makefu moved page Cross Compiling to Packaging/32bit Applications: not really cross-compiling
imported>Mic92
multilib remark
Line 3: Line 3:
'''Question''':  I'm invoking gcc with -m32 and it fails to find <code>`gnu/stubs-32.h`</code><br/>
'''Question''':  I'm invoking gcc with -m32 and it fails to find <code>`gnu/stubs-32.h`</code><br/>
'''Answer (clever)''': you want to use <code>pkgsi686Linux</code> instead of pkgs, so things like <code>pkgsi686Linux.stdenv.mkDerivation </code> or <code>pkgsi686Linux.callPackage</code> then nix will give you 32bit everything<ref>[https://logs.nix.samueldr.com/nixos/2018-03-19#1521474071-1521474422; clever, #nixos 2018-03-19]</ref>
'''Answer (clever)''': you want to use <code>pkgsi686Linux</code> instead of pkgs, so things like <code>pkgsi686Linux.stdenv.mkDerivation </code> or <code>pkgsi686Linux.callPackage</code> then nix will give you 32bit everything<ref>[https://logs.nix.samueldr.com/nixos/2018-03-19#1521474071-1521474422; clever, #nixos 2018-03-19]</ref>
== Building multilib software ==
If a packages wants to compile both 32/64-bit executable, you need a compiler with multilib support.
In nixpkgs provides `multiStdenv.mkDerivation` that should be used instead `stdenv.mkDerivation`.
This is equivalent to using <code>gcc-multilib</code> in debian derivatives.

Revision as of 17:50, 19 March 2018

Building software with 32bit gcc

Question: I'm invoking gcc with -m32 and it fails to find `gnu/stubs-32.h`
Answer (clever): you want to use pkgsi686Linux instead of pkgs, so things like pkgsi686Linux.stdenv.mkDerivation or pkgsi686Linux.callPackage then nix will give you 32bit everything[1]

Building multilib software

If a packages wants to compile both 32/64-bit executable, you need a compiler with multilib support. In nixpkgs provides `multiStdenv.mkDerivation` that should be used instead `stdenv.mkDerivation`. This is equivalent to using gcc-multilib in debian derivatives.