-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
gcc6: restore gcj #18486
gcc6: restore gcj #18486
Conversation
It was thrown away from Macports gcc6 prematurely at some early version for no good reason (ppc version did not build, on x86 something did not work, and instead of fixing it was simply removed). |
Oh, there was a very good reason it was dumped back then. There were all kinds of assembler errors that were not resolved for months in the java subdirectory of gcc, which was preventing us from updating to gcc6. And as java support was dumped from gcc in gcc7 anyway, we just disabled it seven long long years ago to get things moving along. https://trac.macports.org/ticket/51388 gcc5 supplied gcj that was good enough to build pdftk, the only port we had that needed gcj anyway. But if years and years have gone by, and someone finally fixed these assembler errors, and gcj now builds on all systems Tiger PPC -> wherever, then sure, no big deal to allow it again. |
Well, that was 6.2.0. But anyway, point is we need gcj6 for IcedTea, which in turn can enable building OpenJDK 8, which is otherwise broken (builds with some extra fixes up to AWT libs and then crashes). |
@kencu Maybe you could try the build on Intel? That would be helpful. (If you get time, of course, I remember you were busy recently.) |
An alternative road to have bootstrap JDK might be https://github.com/ikvmnet/ikvm which runs on mono and which seems declare PowerPC as supported architecture: https://www.mono-project.com/docs/about-mono/supported-platforms/powerpc/ @barracuda156 any chance that you have tried to run mono? |
@catap Do we have a port for P. S. If you have a suitable machine, could you try gcj6 on Intel? |
https://ports.macports.org/port/mono/details/
Ok, I'll try to build it. |
@catap It is broken: https://trac.macports.org/ticket/61151 |
Rebased against master, as the CI logs have aged out. It will only build on macOS 10.10 and earlier anyway, but just to ensure all is well... |
Currently attempting to build port for Intel, on 10.5, 10.6, and 10.7. |
@mascguy Thank you! |
For 10.5,
The 10.6 build for
10.7 successfully built Full build logs:
|
|
I am not really sure. 64-bit is x86_64 here? Maybe @catap knows, I never ran Leopard on Intel at all.
I recall that is/was a very typical error with some gcc versions, and it was disabled in portfiles, at least for some systems. Not sure which exactly were those. Perhaps disable it for this port, either unconditionally or for < 10.7? |
Update: Builds were successful for 10.9 and 10.10 too. Next up is 10.8, plus another try on 10.6 with bootstrap comparison disabled. So far, so good... |
For 10.6, I disabled bootstrap comparison via the following logic:
With that in place, @kencu and @catap, can you folks confirm whether my solution is correct/complete? |
@mascguy as far as I recall you simple skip bootstrapping comparison. |
The 10.8 builds for Also, the change to disable bootstrap comparison for 10.6 and earlier, was added via a separate commit. Now that all of that is done, I need to sanity-test the binaries. Will try to tackle that over the next few days. |
Testing of First off, the Java test class. As simple as can be:
Verifying that all is well with that class, and that it runs as expected:
Now the
And the
Haven't dug into it more than that, though. Are there some required environment variables that need to be set, before using these tools? Or do we simply have more work to do on this port? |
Note that there is someone with an objective to re-integrate Java with GCC - but that is a slowly moving (maybe stalled) project too. TBH, if the use-case is bootstrapping a couple of Java tools - you might well find much less work by sticking with GCC-5 (of course, it would be nice to make everything work - but ENOMORETIME). |
I think that was @Zopolis4? See: https://github.com/Zopolis4/gcj |
@cooljeanius Yes, exactly. I am not sure of the current state of things there though. (It would certainly be nice to have it reintegrated and drop ugly |
I doubt that it's going to happen one day. It is something like JDK 1.4 or 1.5 which quite outdated with comparing with JDK 21. It requires a lot of work to support JDK 1.8 with all changes inside javalib, and they can't use Apache Harmony because it isn't under GPL. For example scala.js and scala-native uses Apache Harmony as base line and used a lot of undergraduates (phd?) in EPFL to migrate tons of So, they should stay with OpenJDK :) And to support modern OpenJDK's javalib someone should implement things starting from generic and goes to stream, lambda and tons of different things. Really tons of. |
@catap We should either fix building openjdk8 then with openjdk7 or find some alternative: pretty much everything needs at least openjdk8, and what we got on PowerPC (not sure about i386) is openjdk7… |
Agreed - the GCC Java implementation (as it is) is a possible mechanism to bootstrap a more modern one - probably via an intermediate step on Darwin9.
There are library imports in GCC that are not under GPL, so long as the license is compatible and the steering committee agrees to the import. So this is not necessarily a "never can do".
Yeah, unless a miracle occurs and we suddenly gain 10 full-time compiler engineers who want to work on legacy support, the best we can hope for is a bootstrap implementation of something in the region of 1.4..1.6. |
That's me! That project is on hold at the moment, but I do intend to return to it at some point in the future. |
@Zopolis4 Could you sum up for us what is its state at the moment? (Iain may be aware, others are likely not.) |
Right now, it's ~8 months out of sync with the gcc tree. It builds successfully, at least the main compiler executable does, but none of the compiled java programs work. It seems like there's only a couple relatively minor issues preventing it from compiling basic executables successfully. Once all of that is resolved, it'll still be in the same shape it was when it was removed: partial support up to Java 1.6 with a incomplete JDK implementation. |
I made some hacks (on that 8 month old version) that got further with building and starting - but the VM still does not start so we do not get too far. It's (as with all this) a question of time and priorities.... |
Honestly, I think it might be better just to start from scratch. |
From scratch, as in, from current GCC, or from the last commit to GCC that still contained Java? The latter was r7-3447-g37b204de605563, for reference: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=37b204de605563e7932e26099d28ea8c86cb1935 Edit: might as well list all (or at least some) of the relevant commits here:
|
As in, to implement a new Java compiler from the ground up in current GCC, rather than trying to make the old one work and then improving it. |
Hm. Well, I'd kind of prefer the latter myself, personally, but if someone wants to try the former instead, well, I guess that's fine, too... |
As an expert in having almost-unattainable goals .. I'd say that is quite an undertaking. The old one was never a Java (Front End) compiler - it was a Java byte-code compiler and, more importantly, a VM that could be built with that byte-code compiler. The actual Java FE compiler was then the "ecj.tar" that could be hosted on the VM built from the .class files .... A more modern byte-code compiler capable of building a more modern VM which, in turn, could host a more modern Java Front end would be the equivalent (although a pure Java Source FE would be cool , we'd still need to be able to generate byte code - and there are existing FEs out there, it's a question of effort, of course). it would be cleaner possibly, but considerably more work. reworking the old compiler does have the merit that we know it used to work .... |
I'm talking about implementing a new Java frontend compiler, rather than the previous setup of a bytecode compiler, VM and JDK implementation. |
So the idea there would be to be able to compile a suitable VM / JDK directly from Java source (and not expecting to use the GNU class path)? (although it remains that the byte-code intermediate would still be a required output, so that starting by reimplementing the byte-code compiler could still be a good first step). |
I think the similar idea is testing right now by GraalVM project and it team has dozen (or two?) full-time employe who are working on it for last couple of years. And they haven't archived their goal (yet?) for 5 year of work. |
aw man... |
@cooljeanius I will keep the branch, you could borrow the code if there is interest to work on this. |
I have working 8.5, 10.5 and 11.4 branches based partially on @Zopolis4 's work, partially upon a revised forward-port and partially upon reworked in-tree use of bdwgc (I need to complete the testing for the merge with the Darwin back ports). Hopefully those branches will be available in a week or two. More work is need to bring them forward to trunk and currently they do not work on Sonoma at least (there seems to be some issue with the libffi Java integration there). |
I also fixed a handful of bugs on the 6.5 branch and that can be made to work on 64b Darwin with the in-tree use of an updated bdwgc. https://github.com/iains/gcc-6-branch/tree/gcc-6-5-0-java https://github.com/iains/bdwgc (needs to be checked out at the top source level for gcc). https://github.com/iains/gcc-6-branch (experimental cobination - ) |
FYI:
Both related to Darwin and maybe you have some ideas / advice? |
Description
@catap This may be useful for our work on JDK :)
P. S. I have added this patch, looks like it is relevant: e9f48ba
Type(s)
Tested on
macOS 10.6
Xcode 3.2
Verification
Have you
port lint --nitpick
?sudo port test
?sudo port -vst install
?