Skip to content

cross-compilation: native derivations and stdenv.cross #14965

@vcunat

Description

@vcunat

The problem is closely related to #10874. We've developed a habit to test stdenv.cross to find if we're cross-compiling or not. However, that does not work for native build inputs, i.e. they see the same stdenv arguments as the cross derivations.

What's worse, I don't think this is easily fixable. We call stdenv.mkDerivation with some arguments, and inside this call we call the original and modified mkDerivation to produce nativeDrv and crossDrv. Those arguments have no possibility to differentiate among the two cases during evaluation time. We can still use crossAttrs, but that's rather inconvenient if we only want to slightly tweak a substring of a phase or drop a build input.

(Attributes like stdenv.isLinux also evaluate the same always, but the problem there is reversed, as discussed in #10874: it shows properties of the build system even though users typically mean the host system.)

TODO by @Ericson2314

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: cross-compilationBuilding packages on a different platform than they will be used on9.needs: documentationThis needs to be documented well.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions