Skip to content

Cross compiling a project with proc-macros #397

@IamTheCarl

Description

@IamTheCarl

Hello, I am trying to build firmware for a microcontroller using crate2nix.
I've gotten it working using the basic buildRustPackage but I'd like to get it working with crate2nix for more crate-level control and faster iteration when deploying firmware to an MCU attached to a remote system. (Long story short, this is one of the last pieces for a project I've been working on to deploy software to robots)

I have referenced the following issues while trying to make this work:
#362
#132

This is my current attempt at making this work.

The project currently fails with all the proc-macro crates and their dependencies failing to access the standard library, because the Rust toolchain for thumbv7em-none-eabihf doesn't have the standard library available to it. (even if it did compile, my x86 desktop is not going to natively run ARM instructions) Clearly I'm setting something up wrong but I'm a bit new to Nix so I'm unsure how to correct this. Is there a way to mark some crates as needing to be compiled with the host toolchain?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions