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

Cross compiling forces a recompile for other architectures #280

Closed
timlyo opened this issue Jul 24, 2019 · 2 comments · Fixed by #947
Closed

Cross compiling forces a recompile for other architectures #280

timlyo opened this issue Jul 24, 2019 · 2 comments · Fixed by #947

Comments

@timlyo
Copy link

timlyo commented Jul 24, 2019

Running the following:

cargo build --release
cross build --release --target armv7-unknown-linux-musleabihf
cargo build --release
cross build --release --target armv7-unknown-linux-musleabihf

Results in 4 full recompiles. I'm building for two architectures simultaneously and this means my compile and run cycle take ~ 7 minutes rather than ~30s. Is there any way to cache the build for each architecture so that I'm only compiling my changes each time?

@massimiliano-mantione
Copy link

As a workaround --target-dir can be used to specify another target dir when building locally.
This does not invalidate the build cache.

Unfortunately --target-dir does not work for cross, only for cargo.

@Alexhuszagh
Copy link
Contributor

Duplicate of #551.

bors bot added a commit that referenced this issue Jul 16, 2022
947: Resolve symlinks for cargo and xargo home. r=Emilgardis a=Alexhuszagh

Resolve symlinks for the xargo and cargo home (as well as the Nix store) prior to mounting, since they are mounted at a fixed location anyway. This is because podman mounts symlinks as root by default. We always canonicalize the paths on the host, after creating them, to ensure that any symlinks are resolved.

Say we have `/path/to/home`, and `/path/to` is a symlink but `/path/to/home` doesn't exist yet. Trying to canonicalize `/path/to/home/.xargo` will fail, and will still be a symlink if we maybe canonicalize before. First creating the directories and canonicalizing them on the host should always work.

Change the mount points from `/cargo`, `/xargo`, and `/rust` to the same paths as on the host, which avoids unnecessary recompilation when `cargo` and `cross` are intermittently used.

Closes #280.
Closes #373.
Closes #551.

Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants