Skip to content

Cross compilation support #132

Open
Open
@lovesegfault

Description

@lovesegfault

I'm trying to use crate2nix to build my toy kernel but I'm unsure how to correctly cross compile with it. I'm following BlogOS and in chapters 1 and 2 they go over how to correctly build a freestanding Rust binary, with an important step being the writing of a custom target:

{
  "llvm-target": "x86_64-unknown-none",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "arch": "x86_64",
  "target-endian": "little",
  "target-pointer-width": "64",
  "target-c-int-width": "32",
  "os": "none",
  "executables": true,
  "linker-flavor": "ld.lld",
  "linker": "rust-lld",
  "panic-strategy": "abort",
  "disable-redzone": true,
  "features": "-mmx,-sse,+soft-float"
}

They then proceed to use cargo-xbuild to correctly rebuild core et al for the correct target. I think this should all be doable from within Nix though, but I don't really know how tell crate2nix to use the custom target, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions