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

"error occurred: unknown target" when trying to add a new target #135271

Open
0x0nyx98 opened this issue Jan 8, 2025 · 10 comments
Open

"error occurred: unknown target" when trying to add a new target #135271

0x0nyx98 opened this issue Jan 8, 2025 · 10 comments
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@0x0nyx98
Copy link

0x0nyx98 commented Jan 8, 2025

when forking the rust-lang/rust repo and attempting to add support for a new target triple, x will fail to recognise the new target when trying to build the cross compiling rustc

this happens when exactly following the directions laid out by "adding a new target" on the rustc dev guide, so either x has an issue with building the new rustc, or the documentation needs updating!

i've added the target triple to the supported targets macro, included it in the stage0 missing targets array, and (not entirely sure if this is necessary but still did it) supplied a json file with a rough specification of the target platform

the exact error given by x (presumably coming from the rustc used for building) is: error occurred: unknown target 'my-target-triple'

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 8, 2025
@0x0nyx98
Copy link
Author

0x0nyx98 commented Jan 8, 2025

reproduced on nixos and debian by the way!

@jieyouxu
Copy link
Member

jieyouxu commented Jan 8, 2025

Please include more specific repro steps. Best if you have some changes that we can checkout to try to repro locally or look at. The description as is is kinda vague ngl.

@jieyouxu jieyouxu added S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) requires-custom-config This issue requires custom config/build for rustc in some way labels Jan 8, 2025
@0x0nyx98
Copy link
Author

0x0nyx98 commented Jan 8, 2025

oh the repo im using is on my profile!
https://github.com/0x0nyx98/dostogo-rustc-target
it has a silly name i know >w<

i havent actually done any porting of the std/pal stuff yet because i am first trying to take care of this error
it really seems like it is on x's side , unless theres something missing from the docs ,,,, i dunno..

but the repro steps are really just following the docs on how to add a target -w- and setting up the usual information pertaining to one

@workingjubilee
Copy link
Member

error occurred: unknown target `i686-unknown-msdos6`

the ` is not a ', unfortunately

@0x0nyx98
Copy link
Author

0x0nyx98 commented Jan 8, 2025

oh , is that important , o////o sorry ,,,

@ChrisDenton
Copy link
Member

Maybe this is related: https://github.com/rust-lang/cc-rs/blob/b886474a357ef5238848a42a1f9b2bccb6d45ee4/src/target.rs#L66-L73?

@jieyouxu jieyouxu added the A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself label Jan 8, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Jan 8, 2025

AFAICT this is emitted from cc, you may need to temporarily fork cc to add your custom target, but this seems not ideal

@jieyouxu jieyouxu changed the title x fails to build for a custom target triple "error occurred: unknown target" when trying to add a new target Jan 8, 2025
@0x0nyx98
Copy link
Author

0x0nyx98 commented Jan 8, 2025

oh !
thank you all for replying so fast i was not expecting this >w< , it is very much appreciated
i should probably mention just because it might be relevant , but , i am not making a target with intent to like , actually add it to rust! its just a hobby project that will stay on my little personal fork

i will look into forking cc! unless another solution pops up before i get to that
thank you :3

@workingjubilee
Copy link
Member

oh , is that important , o////o sorry ,,,

not enormously, I was just noting for posterity's sake

seems rust-lang/cc-rs#1317

@jieyouxu
Copy link
Member

jieyouxu commented Jan 8, 2025

Yeah, so:

@jieyouxu jieyouxu added C-bug Category: This is a bug. C-external-bug Category: issue that is caused by bugs in software beyond our control and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. requires-custom-config This issue requires custom config/build for rustc in some way C-external-bug Category: issue that is caused by bugs in software beyond our control labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

5 participants