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

PowerPC support? #1573

Open
barracuda156 opened this issue Oct 7, 2022 · 17 comments
Open

PowerPC support? #1573

barracuda156 opened this issue Oct 7, 2022 · 17 comments

Comments

@barracuda156
Copy link

Does anyone know if some initial support for PowerPC exists with gccrs? Would be awesome to have it.
If any testing needed, I am eager to join in.

P. S. I am primarily interested in Darwin PPC, but if Linux, *BSD or AIX version exists, that can be at least some start to fix things for MacOS PPC.

@liushuyu
Copy link
Contributor

liushuyu commented Oct 8, 2022

Does anyone know if some initial support for PowerPC exists with gccrs? Would be awesome to have it.

I think it is! Although there are some unit-test failures, many fundamental parts should be working.

@barracuda156
Copy link
Author

Does anyone know if some initial support for PowerPC exists with gccrs? Would be awesome to have it.

I think it is! Although there are some unit-test failures, many fundamental parts should be working.

Thank you, sounds good.

@catap Looks like we should try this.

@barracuda156
Copy link
Author

@liushuyu @ibuclaw BTW if you are familiar with Macports, does gccrs need to install some components into libgcc or it uses standard libgcc (i.e. no extra dylibs etc.)?

(A bit of context: On my main system, 10.6 PPC, gcc11/gcc12 builds only inside Macports. On 10.5.8 standalone build works as well. But to test it on 10.6 PPC, I need to either add gccrs into gcc12 port or otherwise write a separate portfile for it – but the question re libgcc has to be solved, since Macports keeps runtime separately, making it shared across several gcc versions.)

@liushuyu
Copy link
Contributor

@liushuyu @ibuclaw BTW if you are familiar with Macports, does gccrs need to install some components into libgcc or it uses standard libgcc (i.e. no extra dylibs etc.)?

I only have very rudimentary understanding of Macports. But libgcc must be from GCC 13 since that's the version this frontend is based on.

(A bit of context: On my main system, 10.6 PPC, gcc11/gcc12 builds only inside Macports. On 10.5.8 standalone build works as well. But to test it on 10.6 PPC, I need to either add gccrs into gcc12 port or otherwise write a separate portfile for it – but the question re libgcc has to be solved, since Macports keeps runtime separately, making it shared across several gcc versions.)

GCC 12 may not work with the gccrs front end now since Rust GCC is currently preparing for the mainline merge into GCC 13.

@barracuda156
Copy link
Author

I only have very rudimentary understanding of Macports. But libgcc must be from GCC 13 since that's the version this frontend is based on.
GCC 12 may not work with the gccrs front end now since Rust GCC is currently preparing for the mainline merge into GCC 13.

Thank you. This should not be a problem in itself, we have GCC13 as gcc-devel port, and I am pretty sure it gonna build for powerpc*-apple-darwin, since the upstream supports Darwin PPC.

@liushuyu
Copy link
Contributor

I only have very rudimentary understanding of Macports. But libgcc must be from GCC 13 since that's the version this frontend is based on.
GCC 12 may not work with the gccrs front end now since Rust GCC is currently preparing for the mainline merge into GCC 13.

Thank you. This should not be a problem in itself, we have GCC13 as gcc-devel port, and I am pretty sure it gonna build for powerpc*-apple-darwin, since the upstream supports Darwin PPC.

You are very welcome to report your findings here.

Although, if you want to do something serious, you may still find rustc a better option.

@barracuda156
Copy link
Author

Although, if you want to do something serious, you may still find rustc a better option.

rustc does not build for PPC: https://trac.macports.org/ticket/65942
At least so far.

@barracuda156
Copy link
Author

@iains Just in case, have you tried this on 10.5.8? Judging from commits, it should at least build, including ppc64. See, for example: #1543

@liushuyu
Copy link
Contributor

rustc does not build for PPC: https://trac.macports.org/ticket/65942
At least so far.

Oh, I see you are trying to take the source build approach to bootstrap rustc from mrustc. In which case, that's going to be a dead-end for non-x86 or non-arm systems.

If you don't care about using foreign binaries, you may want to use the binaries from the Rust CI.

@ibuclaw
Copy link
Contributor

ibuclaw commented Oct 10, 2022

@iains Just in case, have you tried this on 10.5.8? Judging from commits, it should at least build, including ppc64. See, for example: #1543

(As I understand from in person conversation with Phil) gccrs doesn't require #1543 to build on darwin-ppc64. Even without, it should already be supported, but you just won't be able to get any target-specific information out of the compiler.

@barracuda156
Copy link
Author

Oh, I see you are trying to take the source build approach to bootstrap rustc from mrustc. In which case, that's going to be a dead-end for non-x86 or non-arm systems.

@liushuyu Why though? @catap has removed hard-coded x86: macports/macports-ports#16284
We do not have PPC yet (as you can see, bootstrap fails), but mrustc builds, in principle rustc should build too. What is that we do not know?

If you don't care about using foreign binaries, you may want to use the binaries from the Rust CI.

I would imagine no ready-made binaries for Darwin PPC exist.

@liushuyu
Copy link
Contributor

Oh, I see you are trying to take the source build approach to bootstrap rustc from mrustc. In which case, that's going to be a dead-end for non-x86 or non-arm systems.

@liushuyu Why though? @catap has removed hard-coded x86: macports/macports-ports#16284 We do not have PPC yet (as you can see, bootstrap fails), but mrustc builds, in principle rustc should build too. What is that we do not know?

If you don't care about using foreign binaries, you may want to use the binaries from the Rust CI.

I would imagine no ready-made binaries for Darwin PPC exist.

According to https://doc.rust-lang.org/beta/rustc/platform-support.html, PPC Darwin support does not seem to be mentioned. Maybe the page is outdated, you could try to find out yourself.

@CohenArthur
Copy link
Member

@barracuda156 have you looked into https://github.com/rust-lang/rustc_codegen_gcc ? gccrs is waaaay behind rustc_codegen_gcc, and that might help you getting Rust on your machines

@dkm
Copy link
Member

dkm commented Oct 10, 2022

If rustc can't be build for some reason, rustc_cg_gcc will probably have the same issue as the first req is to have rustc. If the issue is within the LLVM build (I doubt it), I'm not sure you can skip it... so.....

@barracuda156
Copy link
Author

If rustc can't be build for some reason, rustc_cg_gcc will probably have the same issue as the first req is to have rustc. If the issue is within the LLVM build (I doubt it), I'm not sure you can skip it... so.....

LLVM is broken for PPC. We can only use GCC reliably, and that too with libstdc++.

P. S. LLVM 7.1 is partially working: iains/darwin-toolchains-start-here#29 (reply in thread)
More here: iains/darwin-toolchains-start-here#31

@bjorn3
Copy link

bjorn3 commented Oct 10, 2022

According to https://doc.rust-lang.org/beta/rustc/platform-support.html, PPC Darwin support does not seem to be mentioned. Maybe the page is outdated, you could try to find out yourself.

Rustc only supports macOS targets that latest XCode can still compile for. If you need other targets, you can create a patch to add a target spec to rustc and add support for it to crates like libc. You will have to add support to crates like libc one way or another even if you use gccrs or mrustc.

@barracuda156
Copy link
Author

I can confirm that gccrs builds for ppc32 on macOS. This is in Rosetta (build takes forever), I will build natively in a couple of days.
gccrs

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

6 participants