-
Notifications
You must be signed in to change notification settings - Fork 8
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
Target specification? #6
Comments
My personal opinion is that json is unsuited for hand written files of this sort, mainly due to the lack of comments. Looking at And it just seems oddly inconsistent when Rust otherwise uses toml. When I first saw the json spec files, I assumed that was a format handled by LLVM rather than Rust-specific, since it didn't really match the conventions of the Rust ecosystem. Keeping json wouldn't be the end of the world, but it does seem overall worse to me. And although not specifically related to std aware cargo, I personally would like it if |
Could you say more about this? What exactly is stable? (And so we’re likely stuck with) What unstable features are required? Is it "only" that custom targets do not have a standard library available, and the source code of libcore and libstd use unstable features? |
Correct. JSON targets are stable, but to use it you need a standard library. Or |
I believe this is not possible. Doing anything beyond exporting a So I think we can consider JSON targets to be de-facto unstable for now, and fair game for any breaking change?
👍 |
Cargo can treat the file as a black box and just hash it's contents in order to keep binaries for different platforms apart. There's no reason to force it's stabilization. |
If some version of std-aware cargo is stabilized, then it would as a consequence stabilize the format of the target file. That is, I'm not sure what the stability guarantees there are about Also, Cargo currently triggers off the file extension ( It may be possible that the current format is fine, and any enhancements will be done independently in the future in a backwards-compatible fashion. This issue is just to make that decision explicit. |
Nope!
All cargo needs to do is cache binaries, and pass the contents of that file to
That's a fair point, we could require a leading |
It sounds like you have a different idea of what “stable” means. A goal of the Rust project is to have every feature, API, or command-line argument be either stable with a promise not to make breaking changes, or unstable where it can’t be used on the Stable or Beta release channel. Anything else is considered a bug. Documentation is not enough to warn users that they should not rely on something not changing. |
I don't think that is in conflict. If we consider this de facto unstable we should make it de jure unstable in rustc. Now suppose Cargo stabilizes the flag as a black box as I say. The "end to end" interaction (what you correctly point is a core part of Rust's guarantee) is still unstable because rustc will complain about the use of the flag being unstable. |
Adding a tangentially related item here: The standard library currently isn't configured to support JSON files very well. In particular, in some cases, it looks at the TARGET name to determine what to do, instead of looking at cfg values. This sometimes requires naming the
|
So:
I suppose making progress on this will require a formal RFC and/or some experimentation with an implementation. The embedded workgroup and portability workgroup would likely also have interest in improvement here. Edit: Added last bullet point. |
@ids1024 Absolutely agree with using There also needs to be interaction withe Cargo's config. I've always found it really confusing that I can define target properties in An additional feature that I'd like targets to support is the version of the system's libc in use. This comes up with freebsd all the time (versions can be breaking) and even musl (with the change to 64-bit time in musl 1.20). Some libc's versions implicitly version the OS (freebsd, macos) and some don't (Linux + musl can have separate combinations). It would be nice to be able to specify this in a target, so it 'seeds' Features that might not belong in a target file but are needed for reproducible builds:-
These do, though, need to be linked to a target file but may differ by build platform, eg they'd be different on my mac and my linux box. |
Another feature I often need: The ability to bundle target json with other files, and reference those other files from within the target JSON in a relative way. For instance, to pass linker scripts to the linker. |
@roblabla For me, I'd like the whole build system to be relative. As someone's whose expended considerable time creating reproducible, cross-compiler toolchains, nothing is more valuable. Cargo's current design of searching upwards parent folders is insane - and a genuine security risk ( |
This issue is for tracking any possible work needed for custom target specifications.
The current target JSON specification was introduced in RFC 131, implemented in 16156, updated in 49019. Although it can be used on stable
rustc
, in practice you likely need nightly-only features to use it.It is unlikely that Cargo will need to add any special handling for the format (except if the extension changes). Cargo already supports JSON target files. However, when std-aware Cargo becomes stable, this suddenly offers an opportunity for the target specification to be more usable on stable. The teams will need to decide if they are comfortable with proceeding with the current format, or if stabilizing std-aware cargo should be gated on changing it.
There have been a few issues brought up with the current format:
Please leave any comments about ideas, possible changes, whether or not this should gate anything, or if the current ("stable") syntax is sufficient.
The text was updated successfully, but these errors were encountered: