-
Notifications
You must be signed in to change notification settings - Fork 409
Running cross and cargo builds for different targets breaks incremental compilation #551
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
Comments
Another workaround is to use custom target directory ( |
Note this only affects images with build scripts, I believe. I've tried compiling in the two following cases: $ git clone https://github.com/cross-rs/rust-cpp-hello-word
$ cd rust-cpp-hello-word
$ cross run --target x86_64-unknown-linux-gnu
Compiling cc v1.0.73
Compiling hellopp v0.1.0 (/project)
Finished dev [unoptimized + debuginfo] target(s) in 2.48s
Running `/linux-runner x86_64 /target/x86_64-unknown-linux-gnu/debug/hellopp`
Hello, world!
$ cross run --target armv7-unknown-linux-gnueabihf
Compiling hellopp v0.1.0 (/project)
Finished dev [unoptimized + debuginfo] target(s) in 0.51s
Running `/linux-runner armv7 /target/armv7-unknown-linux-gnueabihf/debug/hellopp`
Hello, world!
$ cargo run
Compiling cc v1.0.73
Compiling hellopp v0.1.0 (/home/ahuszagh/Desktop/cross/rust-cpp-hello-word)
Finished dev [unoptimized + debuginfo] target(s) in 2.71s
Running `target/debug/hellopp`
Hello, world!
$ cross run --target armv7-unknown-linux-gnueabihf
Compiling cc v1.0.73
Compiling hellopp v0.1.0 (/project)
Finished dev [unoptimized + debuginfo] target(s) in 2.07s
Running `/linux-runner armv7 /target/armv7-unknown-linux-gnueabihf/debug/hellopp`
Hello, world!
$ cross run --target x86_64-unknown-linux-gnu
Compiling hellopp v0.1.0 (/project)
error: failed to run custom build command for `hellopp v0.1.0 (/project)`
Caused by:
process didn't exit successfully: `/target/debug/build/hellopp-3a1e8134447a8a4c/build-script-build` (exit status: 1)
--- stderr
/target/debug/build/hellopp-3a1e8134447a8a4c/build-script-build: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /target/debug/build/hellopp-3a1e8134447a8a4c/build-script-build)
$ cross run --target armv7-unknown-linux-gnueabihf
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `/linux-runner armv7 /target/armv7-unknown-linux-gnueabihf/debug/hellopp`
Hello, world! Meanwhile, Note that with a |
FYI: we've added documentation for sccache support, so this is at least done. |
This seems to happen only with build scripts, and it seems that the hash is partially based on the path of the toolchain and Update: Ensuring the host and mount paths are the same works perfectly, even on WSL2 where the mount paths need to be converted to a WSL path. This is linked to rust-lang/cargo#4961. |
Hey everyone, when is this expected to be released? It would help me clean up some scripts! |
There's no plan for a For now, consider using cross from the shouldn't be too hard |
When building a project for a couple of different targets, one within cross and one outside, swapping targets seems to cause the whole project to rebuild. I'm not entirely sure of the mechanism, but, suspect it is either related to changes in the profile (per rust-lang/cargo#4961) or different compiler versions. This would seem to imply the profile is project-global rather than per-target and I haven't dug into this at all.
In case anyone else runs into this, if you only have one target under
cross
you can work around the issue by placing the project in a workspace then building natively (viacargo build
) from the workspace folder and via cross in the project folder (as the docker container cannot see up to the workspace directory) so that the target directories are split, in which case incremental builds work properly. If you need more than onecross
target, I'm not sure there's a great option, maybe propagatingsccache
config / files into thecross
container :-/The text was updated successfully, but these errors were encountered: