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

[BUG] Cargo build fails in a vscode devcontainer running on MacOS (x64) with Docker VirtuoFS #111

Closed
nacidai opened this issue Apr 4, 2023 · 1 comment · Fixed by #154
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Milestone

Comments

@nacidai
Copy link

nacidai commented Apr 4, 2023

Running "cargo build -p chariott" fails in a vscode devcontainer running on MacOS (x64) with Docker VirtuoFS.

Expected Behavior

Cargo build should complete with success

Current Behavior

Build fails printing various inconsistent error messages typically complaining not being able to locate artifacts in the target folder:

... = note: /usr/bin/ld: cannot find /workspaces/chariott/target/debug/build/chariott-proto-081e3239d3e38e03/build_script_build-081e3239d3e38e03.376i4vsos7gxedbo.rcgu.o: No such file or directory /usr/bin/ld: cannot find /workspaces/chariott/target/debug/build/chariott-proto-081e3239d3e38e03/build_script_build-081e3239d3e38e03.ybchmlo3fea63ob.rcgu.o: No such file or directory collect2: error: ld returned 1 exit status

error: could not compile chariott-proto due to previous error

Steps to Reproduce

  1. Clone charriot repository from github
  2. Launch vscode remote devcontainer
  3. cargo build -p chariott

Build fails

Context (Environment)

  • Running with vscode ( 1.76.2)
  • devcontainer (0.2888)
  • Docker Desktop v4.16.2 (with VirtuoFS enabled)
  • MacBook Pro (i9 Intel) macos Ventura 13.2.1.

Additional Information

This is not a bug report but a request to extend the README documentation for mac users. After quite a bit trial and error and searching similar problems with rust in devcontainers, the following Stack Overflow solution provided the correct diagnosis and a workaround solution.

I am not sure this needs to be a fix in this repository or chariott but I decided to log it as an issue that should probably be a part of the README file to help others using a Macbook to build charriot.

Docker Desktop provides a fast VirtuoFS implementation on a mac but rust build process breaks in devcontainers if VirtuoFS is enabled. The solution is not disabling the VirtuoFS, because this significantly slows down the I/O operations in the containers.

The workaround is to create a target folder outside the chariott workspace and set the environment variable to the new target folder. The following sequence works in the dev container:

vscode ➜ /workspaces/chariott (main) $ sudo mkdir ../target
vscode ➜ /workspaces/chariott (main) $ sudo chown vscode:vscode ../target
vscode ➜ /workspaces/chariott (main) $ CARGO_TARGET_DIR=../target cargo build -p cargo
vscode ➜ /workspaces/chariott (main) $ CARGO_TARGET_DIR=../target cargo run -p chariott
@nacidai nacidai added the bug Something isn't working label Apr 4, 2023
@ladatz
Copy link
Contributor

ladatz commented Apr 5, 2023

Thank you for the investigation and suggestion! We welcome you to create a pull request which adds this information to the top-level README.md (maybe a section below "Build all binaries and run tests" for "Build on MacOS with Docker VirtuoFS" and the steps you have provided). We would be happy to review your PR contribution.

For more information on how to create a PR for a GitHub repo if you don't have write access, please see: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request?platform=mac#:~:text=If%20you%20want%20to%20create%20a%20new%20branch%20for%20your%20pull%20request%20and%20do%20not%20have%20write%20permissions%20to%20the%20repository%2C%20you%20can%20fork%20the%20repository%20first.%20For%20more%20information%2C%20see%20%22Creating%20a%20pull%20request%20from%20a%20fork%22%20and%20%22About%20forks.%22

@ladatz ladatz added documentation Improvements or additions to documentation good first issue Good for newcomers and removed bug Something isn't working labels Apr 27, 2023
@ladatz ladatz added this to the Backlog milestone May 24, 2023
@ladatz ladatz self-assigned this Jun 7, 2023
@ladatz ladatz mentioned this issue Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants