Skip to content

Running cross and cargo builds for different targets breaks incremental compilation #551

@ryankurte

Description

@ryankurte

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 (via cargo 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 one cross target, I'm not sure there's a great option, maybe propagating sccache config / files into the cross container :-/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions