Skip to content

Cannot build crates in workspace environment where sub-crates have different architectures. #92

Open
@bjc

Description

@bjc

Arguably this is a problem with cargo itself, but you can work around it easily in the shell.

Setup

  1. create a cargo workspace
  2. add a subworkspace
  3. in the subworkspace, create a .cargo/config with, eg
    [build] target = "thumbv6-none-eabi"
  4. try to build the subworkspace in emacs.

Results

You'll get a bunch of linker errors. I realize the setup is pretty vague, but you can find a sample project that has this problem here

Investigation

The reason this happens is because the various cargo commands, spawned from cargo-process--start specify default-directory as (or (cargo-process--workspace-root) default-directory), where the latter default-directory points to the sub-workspace root.

If the let binding on default-directory is removed from the subsequent compilation-start call (thus pointing default-directory at the result of cargo-process--project-root), the sub-workspaces will compile correctly.

I assume there's a reason for overriding default-directory before calling compilation-start, but I don't know what it is, as everything appears to work correctly without it, with the added bonus that the problem described above goes away.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions