-
Notifications
You must be signed in to change notification settings - Fork 459
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-compilation to Yocto breaks after #1225 (1.1.32) #1297
Comments
I'm not familiar with neither Yocto nor Poky, but if the above is not enough to get it to work, then we can add special support for this target (or, ideally, add upstream support in |
Thank you for the quick response! That sorts it, I'll remove the |
that doesn't really seem correct though? the comment says:
in my case:
i.e. it is definitely a target rustc knows (the distro rust is aware of the custom vendor triples), but yet:
(that calls it seems incorrect to me to fail on the default TARGET that cargo itself is setting in build.rs, and only working with e.g. the -unknown- triples that are hardcoded from a pregenerated list (since 290a629). downstream projects do actually set these values like in https://github.com/helix-editor/helix/blob/f305c7299d8471957eaa66bb83a4c9a70cfc57a9/helix-loader/src/grammar.rs#L437 , and i don't see what they are supposed to do if using cargo's own information from build.rs ( |
Then things should just work in build scripts (at least after #1299).
But if you're using this outside a build script, then we're in a tough situation, since To fix this, I'd strongly prefer that you upstreamed those special target triples to Other options that I'm less in favour of (and which could be pursued in the meantime anyhow):
|
We could do that in build-script, the problem with that cc-rs now has to pull in a json parser, which is usually large and something I really want to avoid |
i have no idea how to do that, but it wouldn't be of much use since changing the vendor part of the triple is not a rare thing for a distro to do; it would be quite weird for every -linux-musl distro to upstream the same thing but with one part of a string changed, just to fix things that use a hardcoded list (since everything else doesn't care that much)
(which has the same issue as the above; it's a cat and mouse game since this field is not that special, or at least downstreams treat it that way since for C compilers it definitely means pretty much nothing and gets changed in every downstream)
for *-linux-musl distros in general (alpine also has a changed vendor field), at least one change is to change the default for that maybe it's possible to somehow make rustc smarter and not require downstreams to patch such small things and for every *-linux-musl distro to not need a change in the triple (a change as significant as changing the default linkage type does seem to warrant at least changing the vendor section to ease surprises..), but i don't think that would happen anytime soon. of course, this also used to work before #1225 , but i guess that was deemed a necessary change. since this only breaks when used outside build.rs i guess in practice very few programs will end up breaking on unrecognised triples (i only know of helix, since it can build grammars both at build time and via a command, so the logic is outside the build.rs script), so i guess it can be left as is. sorry for the noise |
Perhaps we can fix it for non-build-script use case, by translating it to a |
as far as detection, i can't think of why that wouldn't work (after all, it did before where as far as i know this was mostly ignored via the old parsing), as long as it doesn't have any weird implementation gotchas for you. but if that edited triple is then passed to cc, i.e. before:
after:
...then that specifically can definitely have observable effects since the compiler driver can be taught different linkage based on the vendor, like how clang does actually pass different final ldflags based on the vendor (some of those are even upstream; like iirc -redhat- is treated specially, -alpine- and a few others default to -z,-now and friends, etc) if what you mean is to grab the rust triple, replace the maybe merely using target-lexicon removes all these issues (and instead adds the issue of it adding to compile times which is why it was avoided in the first place, after reading the merge request). or maybe going back to the old fallback when |
Yeah it sounds like we'd have to use something like this. It'd be great for rust to support this, because technically they use different flags for compilation. |
The reason All that said, I'd be fine with the workaround you propose yourself, i.e. basically do:
It's ugly, but that's how it is when working around vendors that don't upstream their modifications to |
I noticed that after #1225 as part of 1.1.32, cross-compilation of the Rust Skia bindings fails when targeting a Yocto environment (say Poky, but could be any distro name / vendor name).
Slightly more concretely, the skia build uses cc to compile some
.cpp
bindings code and callscc_build.target(target_str)
eventually, wheretarget_str
isarm-poky-linux-gnueabi
. That's technically the correct target for the gcc Yocto configured/built. The rust target on the other hand isarmv7-unknown-linux-gnueabihf
.Should the rust skia bindings build avoid calling
set_target()
, now that cc also tries to figure out the target from the cargo environment? I'm slightly hesitant here as the rust target is not the same as the one gcc is configured for. Or should cc be extended to parse this triplet?The text was updated successfully, but these errors were encountered: