stdenv/cross-compilation: add section on avoiding cross-compiling GCC
This commit is contained in:
parent
4550d6596b
commit
251897b40d
|
@ -106,6 +106,13 @@ Many packages assume that an unprefixed binutils (`cc`/`ar`/`ld` etc.) is availa
|
|||
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
||||
```
|
||||
|
||||
#### How do I avoid compiling a GCC cross-compiler from source? {#cross-qa-avoid-compiling-gcc-cross-compiler}
|
||||
On less powerful machines, it can be inconvenient to cross-compile a package only to find out that GCC has to be compiled from source, which could take up to several hours. Nixpkgs maintains a limited [cross-related jobset on Hydra](https://hydra.nixos.org/jobset/nixpkgs/cross-trunk), which tests cross-compilation to various platforms from build platforms "x86\_64-darwin", "x86\_64-linux", and "aarch64-linux". See `pkgs/top-level/release-cross.nix` for the full list of target platforms and packages. For instance, the following invocation fetches the pre-built cross-compiled GCC for `armv6l-unknown-linux-gnueabihf` and builds GNU Hello from source.
|
||||
|
||||
```ShellSession
|
||||
$ nix-build '<nixpkgs>' -A pkgsCross.raspberryPi.hello
|
||||
```
|
||||
|
||||
#### What if my package's build system needs to build a C program to be run under the build environment? {#cross-qa-build-c-program-in-build-environment}
|
||||
Add the following to your `mkDerivation` invocation.
|
||||
```nix
|
||||
|
|
Loading…
Reference in New Issue