Closed vi closed 4 months ago
This looks like it's an issue with libstd and various cfg options. I don't think it's a bug with Cargo's support here?
This isn't directly related to Cargo, but it is related to https://github.com/rust-lang/rust/pull/74033, with the intent of helping with build-std support. JSON spec support isn't in a great place right now, unfortunately.
This particular issue is due to the target-name sniffing done here. If you rename the JSON file to something like x86_64-unknown-linux-gnu.json
, this should work.
The intent is to fix the build scripts that inspect target
, just haven't gotten around to it, yet. There should probably be an issue somewhere to track that, I don't think there is, yet. This is as good a place as any, I think, even though this is an issue with the standard library.
Currently messing around trying to cross-compile a rust binary for QNX and I also hit this issue. I moved forward by just changing the name of my custom target to something its not, which did find these symbols.
Should we inspect the value of the llvm-target
instead of the target name itself? Not sure if there are any cases where the target name and llvm-target
name don't lineup intentionally
This should probably not use llvm-target
. I suspect it should instead use the CARGO_CFG_TARGET_*
variables, see https://doc.rust-lang.org/cargo/reference/environment-variables.html. Those values can be controlled from within the target spec json. In particular, using CARGO_CFG_TARGET_OS
should do the trick for the vast majority of those.
Closing as resolved by https://github.com/rust-lang/rust/pull/120232.
Building hello world for
x86_64-unknown-linux-gnu
works.But if I save
x86_64-unknown-linux-gnu
's target specification to json and build using that json, std fails to find socket-related things.I except building using custom target json that happens to be the same as built-in json to be exactly the same as building specifying built-in target directly.