Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bjc opened this issue Sep 11, 2019 · 1 comment

Comments

@bjc
Copy link
Contributor

bjc commented Sep 11, 2019

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.

@kwrooijen
Copy link
Owner

I honestly don't remember what the reason what to override default-directory. It could be that it had something to do with sub workspaces but I don't know.

I haven't used Rust in a long time and I myself am not using this Emacs package, so it's very hard for me to maintain it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants