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

Build failure with Cargo workspaces #171

Closed
gfx opened this issue Nov 20, 2020 · 2 comments · Fixed by #172
Closed

Build failure with Cargo workspaces #171

gfx opened this issue Nov 20, 2020 · 2 comments · Fixed by #172
Labels
bug Something isn't working

Comments

@gfx
Copy link
Member

gfx commented Nov 20, 2020

Version

$ fastly version
Fastly CLI version 0.19.0 (98cb4ff)
Built with go version unknown

What happened

Build failure with a project using Cargo workspaces.

A minimum project to reproduce this problem: https://github.com/fastly/ecp-workspace-example

You can see the following error messages by make build.

(cd app && fastly compute build)
✓ Initializing...
✓ Verifying package manifest...
✓ Verifying local rust toolchain...
✗ Building package using rust toolchain...

ERROR: copying wasm binary: cannot read source file: /Users/goro-fuji/ghq/github.com/fastly/ecp-workspace-example/app/target/wasm32-wasi/release/fastly-template-rust-default.wasm.

If you believe this error is the result of a bug, please file an issue: https://github.com/fastly/cli/issues/new?labels=bug&template=bug_report.md

I'm using Cargo workspaces to test the core logic in my local machine, but it seems that fastly compute build cannot recognize the workspace project.

Good news: cargo test -p core works! 🎉

@gfx gfx added the bug Something isn't working label Nov 20, 2020
@Integralist
Copy link
Collaborator

Thanks @gfx

We'll take a look into this and report back once we've identified the cause of the problem.

@pchickey
Copy link

The cli is currently looking for a target/ inside the package directory, and using cargo's workspaces feature breaks this assumption. Per @alexcrichton there are two ways to go about fixing this:

  1. use cargo metadata --format-version 1 and parse out the target_directory field (e.g. | jq .target_directory). The downside is this can sometimes take ~100ms or so.
  2. build with cargo build --message-format=json and parse the file paths out of the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants