Skip to content

Cross compiling to x86_64-darwin from aarch64-darwin seems broken #180771

@lf-

Description

@lf-

Describe the bug

It's currently seemingly impossible to cross compile for x86_64-darwin from aarch64-darwin, since the darwin SDK for x86_64 is old. #176661 provides some way to hack the stdenv to use the correct toolchain, but I have no idea how to integrate it with Rust.

I am testing against master, which should have that patch.

Specifically, I'm trying to build a Rust hello world for x86_64, which is trivial with cargo build --target x86_64-apple-darwin but I can't figure out how to get nixpkgs to generate that invocation with the cargoBuildHook. I've tried pkgsCross.myPackage, but that's maybe the wrong approach?

Steps To Reproduce

Steps to reproduce the behavior:

nix-build --show-trace -A pkgsCross.x86_64-darwin.cargo
error: don't yet have a `targetPackages.darwin.LibsystemCross for x86_64-apple-darwin

Expected behavior

Can build rust programs for x86_64-darwin

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

@reckenrode
@thefloweringash

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

dev/nixpkgs - [master●] » nix-shell -p nix-info --run "nix-info -m"

 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.5.0, macOS 12.4`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.9.1`
 - channels(root): `"nixpkgs"`
 - channels(jade): `""`
 - nixpkgs: `/nix/store/laymyq0d4724hm86igwdbsv0vl1hxfgz-nixpkgs-src`

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: cross-compilationBuilding packages on a different platform than they will be used on6.topic: darwinRunning or building packages on Darwin6.topic: rustGeneral-purpose programming language emphasizing performance, type safety, and concurrency.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions