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

cc 1.0.86 changes placement of .a files in an incompatible manner, but only when used in cargo install #959

Open
scouten-adobe opened this issue Feb 21, 2024 · 3 comments

Comments

@scouten-adobe
Copy link

Discovered that a public crate I maintain (https://github.com/adobe/xmp-toolkit-rs) that uses cc suddenly stopped building today, but only when it is used by a downstream crate and then only when the downstream crate is built using cargo install.

I've confirmed that pinning the cc release to 1.0.83 "fixes" the problem and am working on an emergency release.

Some additional info here (adobe/xmp-toolkit-rs#194 (comment)). If needed, I can work on building a repro case in a day or two if that would be helpful.

A quick bit of context before I have to sign off. xmp-toolkit-rs has a rather complicated build process that assembles object files from three different libraries, each with wildly different requirements for C vs C++ build flags and then links them together. It depends on the location of the intermediate .o files as part of the build process and those files appear to have moved (again, only in the downstream cargo install case) between 1.0.83 and 1.0.86.

The error surfaced in this part of the build.rs code for xml-toolkit-rs: https://github.com/adobe/xmp-toolkit-rs/blob/76ba3ba32a46e9e2b6262c8b457449f422cda7b9/build.rs#L171-L199

@NobodyXu
Copy link
Collaborator

NobodyXu commented Feb 21, 2024

It's probably related #914 , it changes the object filename to always include hash of the dirname.

It used to only include hash if file.has_root() or if file contains .. in components.

@NobodyXu
Copy link
Collaborator

NobodyXu commented Feb 21, 2024

It depends on the location of the intermediate .o files as part of the build process and those files appear to have moved (again, only in the downstream cargo install case) between 1.0.83 and 1.0.86.

Honestly it is not a good idea to depend on filename within object file.

Not even a good idea before #914 is merged, since we use std::collections::hash_map::DefaultHasher, which does not guarantee a stable hash result since it is initialised with a random state, and it also does not provide any guarantee on the hash algorithm it uses between different rustc/stdlib version.

@NobodyXu
Copy link
Collaborator

Ideally you probably don't want to depend on object name in the archive.

If you have to do so, then you could add a new API to cc, to specify the function cc::Build uses to generate the object name.

aliddell added a commit to acquire-project/acquire-python that referenced this issue Feb 21, 2024
- Pin cc dependency to 1.0.83 ([possible
issue](rust-lang/cc-rs#959)).
- Remove erroneously specified [target triple
](https://docs.rs/cmake/latest/cmake/struct.Config.html#method.target)
in build script.
- Consolidate build jobs between target platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants