OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Paul Smedley on April 02, 2023, 12:13:03 am

Title: Compiling OpenJDK
Post by: Paul Smedley on April 02, 2023, 12:13:03 am
Hey All,

Wondering if anyone has ever (other than Dmik!) been able to compile OpenJDK on OS/2? ie https://trac.netlabs.org/java

I haven't tried for some time, but had previously attemped to follow the instructions a https://trac.netlabs.org/java/browser/tags/ga5/README and not gotten very far.

It would be nice to at least get the current code compiling, which could then form a basis for how feasible it is to use this code to updated to a newer openjdk version.

Cheers,

Paul
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 02, 2023, 02:20:45 am
Doesn't look simple, in particular finding "The contents of the j2sdk-image directory of the Windows build of OpenJDK6"
I think to go any newer would take more fixes in Odin. Wouldn't be surprised if newer GCC's have problems, just compiling Mozilla and getting a working optimized binary was quite a challenge with luckily lots of hints in Bugzilla for newer Firefox's.
I might give it a try at some point.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 02, 2023, 02:27:50 am
Well if nothing else, there is a b49 at https://github.com/openjdk/jdk6 (vs our current b27)

Edit: https://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-windows-i586.exe might help for the j2sdk-image directory
Title: Re: Compiling OpenJDK
Post by: Martin Iturbide on April 08, 2023, 06:49:28 pm
Hi Paul

I completely support the idea to see what can it be done with OpenJDK, but I don't know if it will be too much to this and the Qt 6 port at the same time.

Check if something can be done, and let us know how can we support you.

Regards
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 08, 2023, 08:03:12 pm
Well if nothing else, there is a b49 at https://github.com/openjdk/jdk6 (vs our current b27)

Edit: https://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-windows-i586.exe might help for the j2sdk-image directory

I see Oracle wants a login to download that :( Anyone all ready have one?
Title: Re: Compiling OpenJDK
Post by: Ibrahim Hakeem on April 08, 2023, 08:52:56 pm
Well if nothing else, there is a b49 at https://github.com/openjdk/jdk6 (vs our current b27)

Edit: https://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-windows-i586.exe might help for the j2sdk-image directory

I see Oracle wants a login to download that :( Anyone all ready have one?

Dave, I have sent you a PM.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 08, 2023, 10:20:06 pm
Well if nothing else, there is a b49 at https://github.com/openjdk/jdk6 (vs our current b27)

Edit: https://download.oracle.com/otn/java/jdk/6u45-b06/jdk-6u45-windows-i586.exe might help for the j2sdk-image directory

I see Oracle wants a login to download that :( Anyone all ready have one?
It was free to create an account...
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 09, 2023, 01:12:44 am
Yes, I prefer not to create too many accounts, lose track of them and often results in spam. Anyways have it now.
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 09, 2023, 09:15:17 pm
Next problem is pulling odin/trunk. After messing around, this works, svn co https://svn.netlabs.org/repos/odin32/ (http://svn co https://svn.netlabs.org/repos/odin32/) sorta until,
Code: [Select]
A    odin32/tags/0.8.9/src/kernel32/directory.h
A    odin32/tags/0.8.9/src/riched32
svn: E175002: REPORT request on '/repos/odin32/!svn/me' failed
and checks out everything, trying for trunk to begin with results in a bad URL error, trunk is something else or such. Continuing on after cleaning the repository with svn up till the same error. Repeat for every tag.
Title: Re: Compiling OpenJDK
Post by: Andy Willis on April 09, 2023, 09:37:47 pm
Next problem is pulling odin/trunk. After messing around, this works, svn co https://svn.netlabs.org/repos/odin32/ (http://svn co https://svn.netlabs.org/repos/odin32/) sorta until,
Code: [Select]
A    odin32/tags/0.8.9/src/kernel32/directory.h
A    odin32/tags/0.8.9/src/riched32
svn: E175002: REPORT request on '/repos/odin32/!svn/me' failed
and checks out everything, trying for trunk to begin with results in a bad URL error, trunk is something else or such. Continuing on after cleaning the repository with svn up till the same error. Repeat for every tag.
svn co https://svn.netlabs.org/repos/odin32/trunk/
worked here
edit:
you can do svn co https://svn.netlabs.org/repos/odin32/trunk/ .
the dot puts everthing in the current directory, without the dot, it puts it into a directory under the current directory - trunk.
Title: Re: Compiling OpenJDK
Post by: Martin Iturbide on April 09, 2023, 09:45:35 pm
FYI: If you want to create the Odin and OpenJDK github repositories, you can do it under the Netlabsorg organization.
https://github.com/netlabsorg

I think you have access the create new repos now.

Regards
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 12:02:16 am
Yes, my problem was already having a trunk directory.
Building Odin, I have no experience with. The Java Port readme says to configure with configure.cmd --use-oldlib. Guess run kmk -f Config.kmk and see what happens and how to set up the environment.
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 01:21:14 am
Hmm, build of Odin dies with lots of errors like,
Code: [Select]
K:/work/odin/trunk/src/kernel32/console.cpp:1627:1: error: narrowing conversion
of '144' from 'int' to 'char' [-Wnarrowing]
K:/work/odin/trunk/src/kernel32/console.cpp:1627:1: error: narrowing conversion
of '128' from 'int' to 'char' [-Wnarrowing]

Thought CHAR was defined as 0..255, not 0..127. Use UCHAR? Or uCHAR?
Title: Re: Compiling OpenJDK
Post by: Andy Willis on April 10, 2023, 01:47:50 am
Hmm, build of Odin dies with lots of errors like,
Code: [Select]
K:/work/odin/trunk/src/kernel32/console.cpp:1627:1: error: narrowing conversion
of '144' from 'int' to 'char' [-Wnarrowing]
K:/work/odin/trunk/src/kernel32/console.cpp:1627:1: error: narrowing conversion
of '128' from 'int' to 'char' [-Wnarrowing]

Thought CHAR was defined as 0..255, not 0..127. Use UCHAR? Or uCHAR?

Probably a change in GCC since 4.9.2 where warnings are now errors.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 10, 2023, 02:46:01 am
FYI: If you want to create the Odin and OpenJDK github repositories, you can do it under the Netlabsorg organization.
https://github.com/netlabsorg

I think you have access the create new repos now.

I set an import going to https://github.com/netlabsorg/odin32 - looks like it's going to take a while.....
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 04:22:04 am
Hmm, build of Odin dies with lots of errors like,
Code: [Select]
K:/work/odin/trunk/src/kernel32/console.cpp:1627:1: error: narrowing conversion
of '144' from 'int' to 'char' [-Wnarrowing]
K:/work/odin/trunk/src/kernel32/console.cpp:1627:1: error: narrowing conversion
of '128' from 'int' to 'char' [-Wnarrowing]

Thought CHAR was defined as 0..255, not 0..127. Use UCHAR? Or uCHAR?

Probably a change in GCC since 4.9.2 where warnings are now errors.

Probably, adding -Wno-narrowing to TEMPLATE_OdinCxx_CXXFLAGS seems to have fixed it.
Now I'm getting
Code: [Select]
K:/work/odin/trunk/src/kernel32/kernel32.cpp: In function 'void _GlobalMemoryStatus(MEMORYSTATUS*)':
K:/work/odin/trunk/src/kernel32/kernel32.cpp:250:33: error: 'max' was not declared in this scope
  250 |     lpMemStat->dwTotalVirtual = max(lpMemStat->dwTotalPageFile, sys[3]);
      |                                 ^~~
K:/work/odin/trunk/src/kernel32/kernel32.cpp:251:33: error: 'min' was not declared in this scope
  251 |     lpMemStat->dwAvailVirtual = min(lpMemStat->dwAvailPageFile, sys[3]);
      | 

Which I thought were declared in math.h but grepping doesn't show them.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 10, 2023, 04:46:06 am
The example app at https://www.codingninjas.com/codestudio/library/min-and-max-function-in-cpp includes <iostream> and <algorithm> and works...
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 05:10:17 am
The example app at https://www.codingninjas.com/codestudio/library/min-and-max-function-in-cpp includes <iostream> and <algorithm> and works...

OK, stupid errors continue with mismatched types galore. I think I should try using an older GCC/G++, if it compiles, can think about adding some casts, or changing the types after.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 10, 2023, 05:17:41 am
Depending how far you get, I'll have a crack at building it with gcc 12 tomorrow. I'll also post here once the GitHub import completes.

https://github.com/netlabsorg/odin32 is now complete I tried to match up the author's I knew to their GitHub profiles.
Title: Re: Compiling OpenJDK
Post by: Ibrahim Hakeem on April 10, 2023, 06:08:27 am
Apologies if this sounds silly, but has the possibility of porting a Linux release of OpenJDK been considered?
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 06:17:15 am
Apologies if this sounds silly, but has the possibility of porting a Linux release of OpenJDK been considered?

I'd guess Bitwise considered it. Not sure what widget set it uses but likely GTK, which would be a large job to port
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 07:30:38 am
Using GCC 4.5.2, it mostly just built, needed an import lib for pmkbdhk.dll and currently adding LDFLAGS=-lpmkbdhk to the kmk line. Now it's dying here.
Code: [Select]
kBuild: Linking kernel32
g++.exe: K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/conbuffer.o: No such file or directory
g++.exe: K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/stubs.o: No such file or directory
kBuild: Linking ntdll
kmk: *** [/@unixroot/usr/share/kbuild/footer-pass2-compiling-targets.kmk:779: K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/kernel32.dll] Error 255
The failing command:
@ K:/work/odin/trunk/tools/bin/runmapsym.cmd K:/work/odin/trunk/tools/bin/wmapsym.cmd K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/kernel32.map K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/kernel32.sym 1>nul
kmk: *** [K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/kernel32.dll] Deleting file 'K:/work/odin/trunk/out/os2.x86/release/obj/kernel32/kernel32.rsp'
kmk: *** Waiting for unfinished jobs....
weakld: error: Unresolved symbol (UNDEF) '_interlocked_cmpxchg64'.
weakld: info: The symbol is referenced by:
    K:\work\odin\trunk\out\os2.x86\release\obj\ntdll\rtl.o
Ignoring unresolved externals reported from weak prelinker.

Looks like some Makefiles need adjusting. Bedtime here, so tomorrow
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 10, 2023, 08:15:11 am
Looks like you got further than me - I'm dying with a REXX error:
Code: [Select]
kBuild: Compiling unicode - U:/dev/odin32/lib/unicode/casemap.c
     1 +++   ??signal on novalue name NoValueHandler??if RxFuncQuery('SysLoadFuncs') = 1 then?do? call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
REX0013: Error 13 running U:\dev\odin32\tools\bin\BldLevelInf.cmd, line 1:
Invalid character in program
kmk: *** [Config.kmk:163: U:/dev/odin32/out/os2.x86/release/obj/impdef/ImpDef.bldlevel.def] Error 65523
The failing command:
@cmd /c 'set BUILD_QUIET=1 && U:/dev/odin32/tools/bin/BldLevelInf.cmd U:/dev/odin32/tools/impdef/ImpDef.def U:/dev/odin32/out/os2.x86/release/obj/impdef/ImpDef.bldlevel.def -R"U:/dev/odin32/tools/impdef/ImpDef.def" -V"#define=ODIN32_VERSION,U:/dev/odin32/include/odinbuild.h" -M"#define=ODIN32_BUILD_NR,U:/dev/odin32/include/odinbuild.h"'
kmk: *** Waiting for unfinished jobs....

Easy fix - just had to run dos2unix on the cmd file.....
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 10, 2023, 11:45:40 am
OK - so not saying this is merge worthy at all - but WIP patches that compile/link with GCC 12 are at https://github.com/netlabsorg/odin32/tree/gcc12

Zip at https://smedley.id.au/tmp/odin32-20230410.zip is not tested at all

I don't know why i had to define a bunch of things with extern "C" when I had __USE_EMX defined to I would have thought those functions should have been seen <shrug>

Same, I don't get why I had to #define __USE_EMX in some source files with I had it in the compiler line.

A (hopefully) good nights sleep might help this in the morning...
Title: Re: Compiling OpenJDK
Post by: Martin Iturbide on April 10, 2023, 05:53:55 pm
Hi

Zip at https://smedley.id.au/tmp/odin32-20230410.zip is not tested at all

First of all, thanks for taking care on compiling Odin.

My question is, what is the suggested way for someone to test this Odin build?
I already had Odin32 on C:\usr\bin, I don't know which technique will be good to disable old odin, and point to the new compiled one.  Or maybe I just has to take a backup of the VM and replace all odin file with the new ones?

Regards
Title: Re: Compiling OpenJDK
Post by: Joop on April 10, 2023, 08:54:48 pm
I already had Odin32 on C:\usr\bin, I don't know which technique will be good to disable old odin, and point to the new compiled one.  Or maybe I just has to take a backup of the VM and replace all odin file with the new ones?
There is not one way to start programs in OS/2. So you are going to make new directories for Odin, make your own choice in naming. Delete Odin in C:\usr\bin, place it in your new directories. Mind you also have to delete it everywhere where there is a reference to C:\usr\bin. Make  command files for starting your program. In it you refer to the new directory with that particular version of Odin before you call the program. Drawback is that two ore more versions might fight each other when active in memory and you need more memory, the latter is a worry because  OS/2 doesn't have that much and with today's applications you need more and more memory. There are also some programs which do something similar like with FF.       
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 10, 2023, 09:22:56 pm
Hey Martin,

It should be sufficient to add the new Odin directory to path/libpath ahead in C:\usr\bin
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 10, 2023, 10:39:24 pm
Hey Martin,

It should be sufficient to add the new Odin directory to path/libpath ahead in C:\usr\bin

And maybe start out by running odininst. And run Odininst again when reverting to the RPM versions. It sets up the registry.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 01:27:50 am
OK - so not saying this is merge worthy at all - but WIP patches that compile/link with GCC 12 are at https://github.com/netlabsorg/odin32/tree/gcc12

Zip at https://smedley.id.au/tmp/odin32-20230410.zip is not tested at all

I don't know why i had to define a bunch of things with extern "C" when I had __USE_EMX defined to I would have thought those functions should have been seen <shrug>

Same, I don't get why I had to #define __USE_EMX in some source files with I had it in the compiler line.

A (hopefully) good nights sleep might help this in the morning...

Updated patches committed. Now going to try and work through some warnings....

It would be good if someone else can try build this - preferably with the RPM gcc...
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 11, 2023, 02:48:09 am
You need a .gitattributes file containing at the minimal,
Code: [Select]
# CRLF is crucial for OS/2 REXX files (also fine for Windows .cmd)
*.cmd eol=crlf

Compiling...
Edit: Finished compiling with GCC  9.2.0 (RPM version), seems fine.
Lots more warnings then with GCC 4.52
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 04:16:10 am
Working on the warnings now - another commit coming in the next few hours.
Title: Re: Compiling OpenJDK
Post by: Martin Iturbide on April 11, 2023, 04:25:28 am
Zip at https://smedley.id.au/tmp/odin32-20230410.zip is not tested at all
Hi

I went the easy way. I cloned the VM and replaced the .exe on C:\usr\bin and the rest files on C:\usr\lib.
Rebooted just in case.

Java keeps working, I quickly tested PixelEditor and worked.

Regards

Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 07:37:52 am
Updated build - https://smedley.id.au/tmp/odin32-20230411.zip

I committed a bunch more changes to the gcc12 branch. There are still some warnings remaining, but I'm not sure how best to address them...
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 08:46:43 am
Anyone else's google foo better than mine?

Trying to track down:
Code: [Select]
3b. JAXB 2.1 (http://jaxb.java.net/2.1/JAXB2_20061211.jar,
    install it with java -jar JAXB2_20061211.jar)
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 09:43:43 am
Meanwhile, openjdk doesn't want to find gcc... ERROR: The Compiler version is undefined.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 10:48:02 am
Anyone else's google foo better than mine?

Trying to track down:
Code: [Select]
3b. JAXB 2.1 (http://jaxb.java.net/2.1/JAXB2_20061211.jar,
    install it with java -jar JAXB2_20061211.jar)

I'm hoping https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl/2.1 is close enough...
Title: Re: Compiling OpenJDK
Post by: Tom on April 11, 2023, 12:06:47 pm
Anyone else's google foo better than mine?

Trying to track down:
Code: [Select]
3b. JAXB 2.1 (http://jaxb.java.net/2.1/JAXB2_20061211.jar,
    install it with java -jar JAXB2_20061211.jar)

I found a reference at https://trac.netlabs.org/java/ticket/6 , but cannot find it there. Perhaps dmik knows where it is stored?
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 01:06:36 pm
Meanwhile, openjdk doesn't want to find gcc... ERROR: The Compiler version is undefined.

I hacked some files and changed this from an ERROR to a WARNING....

It's doing *something* now....
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 01:57:29 pm
Anyone else's google foo better than mine?

Trying to track down:
Code: [Select]
3b. JAXB 2.1 (http://jaxb.java.net/2.1/JAXB2_20061211.jar,
    install it with java -jar JAXB2_20061211.jar)

I found a reference at https://trac.netlabs.org/java/ticket/6 , but cannot find it there. Perhaps dmik knows where it is stored?

I was trying to avoid pestering dmik but I've sent him an email.

Cheers,

Paul
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 02:00:58 pm
Will investigate tomorrow, but getting the following:
Code: [Select]
-jaxp_src-url-bundle:
     [echo] Downloading from http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip
      [get] Getting: http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip
      [get] To: U:\DEV\openjdk\openjdk\build\os2-i586\jaxp\drop\bundles\jaxp144_04.zip.temp
      [get] http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip permanently moved to https://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip
      [get] Error getting http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip to U:\DEV\openjdk\openjdk\build\os2-i586\jaxp\drop\bundles\jaxp144_04.zip.temp

BUILD FAILED
U:\DEV\openjdk\openjdk\build\os2-i586\jaxp\build\xml_generated\build-drop-jaxp_src.xml:96: javax.net.ssl.SSLException: Received fatal alert: protocol_version

Java SSL certs out of date?
Title: Re: Compiling OpenJDK
Post by: Joop on April 11, 2023, 07:08:47 pm
Anyone else's google foo better than mine?

Trying to track down:
Code: [Select]
3b. JAXB 2.1 (http://jaxb.java.net/2.1/JAXB2_20061211.jar,
    install it with java -jar JAXB2_20061211.jar)

I found a reference at https://trac.netlabs.org/java/ticket/6 , but cannot find it there. Perhaps dmik knows where it is stored?
I was trying to avoid pestering dmik but I've sent him an email.

Cheers,

Paul
Is this the same? http://www.java2s.com/Code/Jar/j/Downloadjaxbapi21jar.htm
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 10:58:51 pm
Anyone else's google foo better than mine?

Trying to track down:
Code: [Select]
3b. JAXB 2.1 (http://jaxb.java.net/2.1/JAXB2_20061211.jar,
    install it with java -jar JAXB2_20061211.jar)

I found a reference at https://trac.netlabs.org/java/ticket/6 , but cannot find it there. Perhaps dmik knows where it is stored?
I was trying to avoid pestering dmik but I've sent him an email.
Is this the same? http://www.java2s.com/Code/Jar/j/Downloadjaxbapi21jar.htm

I tried installing it and got:
Code: [Select]
Failed to load Main-Class manifest attribute from
jaxb-api-2.1.jar
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 11, 2023, 11:35:51 pm
Will investigate tomorrow, but getting the following:
Code: [Select]
-jaxp_src-url-bundle:
     [echo] Downloading from http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip
      [get] Getting: http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip
      [get] To: U:\DEV\openjdk\openjdk\build\os2-i586\jaxp\drop\bundles\jaxp144_04.zip.temp
      [get] http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip permanently moved to https://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip
      [get] Error getting http://download.java.net/jaxp/openjdk/jdk6/jaxp144_04.zip to U:\DEV\openjdk\openjdk\build\os2-i586\jaxp\drop\bundles\jaxp144_04.zip.temp

BUILD FAILED
U:\DEV\openjdk\openjdk\build\os2-i586\jaxp\build\xml_generated\build-drop-jaxp_src.xml:96: javax.net.ssl.SSLException: Received fatal alert: protocol_version

Java SSL certs out of date?

Nope - seems to be jdk6 not supporting modern SSL protocols.....

edit: https://stackoverflow.com/questions/33364100/how-to-use-tls-1-2-in-java-6 might be the solution
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 12, 2023, 01:11:26 am
Updated build - https://smedley.id.au/tmp/odin32-20230411.zip

I committed a bunch more changes to the gcc12 branch. There are still some warnings remaining, but I'm not sure how best to address them...

These never showed up at Github, gcc12 branch still only has the first 2 commits
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 12, 2023, 03:32:14 am
Updated build - https://smedley.id.au/tmp/odin32-20230411.zip

I committed a bunch more changes to the gcc12 branch. There are still some warnings remaining, but I'm not sure how best to address them...

These never showed up at Github, gcc12 branch still only has the first 2 commits

Apparenty you have to 'push' the changes :P sorry about that...
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 12, 2023, 03:38:44 am
Nope - seems to be jdk6 not supporting modern SSL protocols.....

edit: https://stackoverflow.com/questions/33364100/how-to-use-tls-1-2-in-java-6 might be the solution

OK - the solution seems to be:
1) Copy:
  https://www.bouncycastle.org/download/bcprov-jdk15to18-173.jar
  https://www.bouncycastle.org/download/bcutil-jdk15to18-173.jar
  https://www.bouncycastle.org/download/bctls-jdk15to18-173.jar

  Into: ${JAVA_HOME}/jre/lib/ext

2) Download https://www.oracle.com/java/technologies/jce-6-download.html and replace the files in ${JAVA_HOME}/jre/lib/security

3) Replace ${JAVA_HOME}/jre/lib/security per Netlabs ticket https://trac.netlabs.org/java/ticket/238

4) Make the suggested changes to ${JAVA_HOME}/jre/lib/security/java.security per the Stack Overflow Article:
Code: [Select]
# Original security providers (just comment it)
    # security.provider.1=sun.security.provider.Sun
    # security.provider.2=sun.security.rsa.SunRsaSign
    # security.provider.3=com.sun.net.ssl.internal.ssl.Provider
    # security.provider.4=com.sun.crypto.provider.SunJCE
    # security.provider.5=sun.security.jgss.SunProvider
    # security.provider.6=com.sun.security.sasl.Provider
    # security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
    # security.provider.8=sun.security.smartcardio.SunPCSC

    # Add the Bouncy Castle security providers with higher priority
    security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider
    security.provider.2=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
   
    # Original security providers with different priorities
    security.provider.3=sun.security.provider.Sun
    security.provider.4=sun.security.rsa.SunRsaSign
    security.provider.5=com.sun.net.ssl.internal.ssl.Provider
    security.provider.6=com.sun.crypto.provider.SunJCE
    security.provider.7=sun.security.jgss.SunProvider
    security.provider.8=com.sun.security.sasl.Provider
    security.provider.9=org.jcp.xml.dsig.internal.dom.XMLDSigRI
    security.provider.10=sun.security.smartcardio.SunPCSC

    # Here we are changing the default SSLSocketFactory implementation
    ssl.SocketFactory.provider=org.bouncycastle.jsse.provider.SSLSocketFactoryImpl
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 12, 2023, 04:44:30 am
Died now with:
Code: [Select]
-jaf_src-url-bundle:
     [echo] Downloading from https://java.net/downloads/jax-ws/OpenJDK6/jdk6-jaf-b20.zip
      [get] Getting: https://java.net/downloads/jax-ws/OpenJDK6/jdk6-jaf-b20.zip
      [get] To: U:\DEV\openjdk\openjdk\build\os2-i586\jaxws\drop\bundles\jdk6-jaf-b20.zip.temp
      [get] Error getting https://java.net/downloads/jax-ws/OpenJDK6/jdk6-jaf-b20.zip to U:\DEV\openjdk\openjdk\build\os2-i586\jaxws\drop\bundles\jdk6-jaf-b20.zip.temp

BUILD FAILED
U:\DEV\openjdk\openjdk\build\os2-i586\jaxws\build\xml_generated\build-drop-jaf_src.xml:96: java.io.IOException: HTTPS hostname wrong:  should be <java.net>

This is due to java.net closing - so I'll need to find an alternative download site and update the relevant xml file with the new URL.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 12, 2023, 05:51:59 am
Finally got to compiling some c++ code :)
Code: [Select]
g++ -I'../generated' -I'U:/dev/openjdk/openjdk/hotspot/src/share/vm/' -I'U:/dev/openjdk/openjdk/hotspot/src/os/windows/vm' -I'U:/dev/openjdk/openjdk/hotspot/src/cpu/x86/vm' -Zomf -march=i486 -mtune=generic -Wno-sign-compare -Wno-write-strings -g -DIA32 -DTARGET_OS_FAMILY_windows -DTARGET_ARCH_x86 -DTARGET_ARCH_MODEL_x86_32 -DTARGET_OS_ARCH_windows_x86 -DTARGET_OS_ARCH_MODEL_windows_x86_32 -DTARGET_COMPILER_gcc -DTARGET_OS_FAMILY_os2 -MMD -MP -MF main.obj.d -D__WIN32OS2__ -D__i386__ -DSTRICT -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112 -D_EMX_SOURCE -D_XOPEN_SOURCE=600 -D_SVID_SOURCE -DOS2EMX_PLAIN_CHAR -Iu:/dev/odin32/include/Win -Iu:/dev/odin32/include -DASSERT -fno-rtti -fno-exceptions -fcheck-new -c U:/dev/openjdk/openjdk/hotspot/src/share/vm/adlc/main.cpp -o main.obj
In file included from C:/usr/local1220/include/c++/12/system_error:39,
                 from C:/usr/local1220/include/c++/12/bits/ios_base.h:46,
                 from C:/usr/local1220/include/c++/12/ios:42,
                 from C:/usr/local1220/include/c++/12/ostream:38,
                 from C:/usr/local1220/include/c++/12/iostream:39,
                 from U:/dev/openjdk/openjdk/hotspot/src/share/vm/adlc/adlc.hpp:35,
                 from U:/dev/openjdk/openjdk/hotspot/src/share/vm/adlc/main.cpp:26:
C:/usr/local1220/include/c++/12/i686-pc-os2-emx/bits/error_constants.h:42:49: error: 'EAFNOSUPPORT' was not declared in this scope
   42 |       address_family_not_supported =            EAFNOSUPPORT,
      |                                                 ^~~~~~~~~~~~
C:/usr/local1220/include/c++/12/i686-pc-os2-emx/bits/error_constants.h:43:49: error: 'EADDRINUSE' was not declared in this scope
   43 |       address_in_use =                          EADDRINUSE,
      |                                                 ^~~~~~~~~~
C:/usr/local1220/include/c++/12/i686-pc-os2-emx/bits/error_constants.h:44:49: error: 'EADDRNOTAVAIL' was not declared in this scope
   44 |       address_not_available =                   EADDRNOTAVAIL,

Edit: Same source compiles under linux with GCC 12. Same error in g++ on OS/2 with GCC 9 and 12.

Edit: the -D_POSIX_SOURCE is the cause of this...
Title: Re: Compiling OpenJDK
Post by: Martin Iturbide on April 13, 2023, 02:08:08 am
Quote
https://smedley.id.au/tmp/odin32-20230411.zip

Hi Paul.
It seems to be working here with OpenJDK. I did a very quick text with Pixelitor

Regards
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 13, 2023, 02:27:05 am
Thanks for testing Martin, hopefully soon-ish I'll have a rebuild of openjdk to test too.
Title: Re: Compiling OpenJDK
Post by: Mentore on April 13, 2023, 10:45:12 am
Thanks for testing Martin, hopefully soon-ish I'll have a rebuild of openjdk to test too.

Well, I hope you'll be added to the list of Odin contributors if it's not already done! Great job Paul. Hope I'll have soon the time to update my ArcaOS distro on Virtualbox.
Mentore
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 13, 2023, 11:16:05 pm
hmm I keep drying during the openjdk build, with errors like:
Code: [Select]
sh.exe: 1: Cannot fork (Connection timed out)
The system definitely gets flaky after a couple build attempts - guessing something is leaking memory....

Not sure how to proceed now..
Title: Re: Compiling OpenJDK
Post by: David McKenna on April 14, 2023, 10:39:03 pm
Hi Paul,

  I finally got some time to test your latest ODIN build (odin32-20230411.zip) and it is a mixed bag. I tested a bunch of Java apps - some work and some don't (all of which work with the Bitwise build):

Works:
NightVision
Cademia
GeneologyJ
jPhotoBrush
jEdit
ImageJ (with the exception it cannot update because no 'OK' or 'Cancel' buttons - works with Bitwise)

Doesn't Work:
FreePlane - won't start, get a POPUPLOG
ProjectLibre - won't start, get a POPUPLOG
Art of Illusion - won't start, get a POPUPLOG
jAlbum - won't start, get a POPUPLOG

 I didn't test all functions, just basic ones. Unfortunately, there are no exceptq reports generated. I'll attach a sampling of the POPUPLOG...

Regards,
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 14, 2023, 11:05:08 pm
Thanks David - not all bad :) Could be a result ofsome of the remaining warnings, or due to stuff I 'fixed'. Bit hard without an exceptq report. Let's wait until we see if I can finish compiling openjdk.

So on that, I had a few learnings. I know what's happening but I don't yet know why.

I've attached a build.log.

Towards the end of the log, we start seeing messages like:
Code: [Select]
sh.exe: 1: sed: Not enough memory (line 3301)

For some reason, the makefile is looping. Note that just below this, we have:
Code: [Select]
make.exe[48]: Leaving directory 'U:/dev/openjdk/openjdk/jdk/make/java/hpi/windows'
  Timing: 00001 seconds or 1s for make-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-java-hpi-windows


Note how many times 'java' is listed.

At line 1409, we have:
Code: [Select]
make.exe[5]: Leaving directory 'U:/dev/openjdk/openjdk/jdk/make/java/hpi/windows'
  Timing: 00000 seconds or 0s for make-java-hpi-windows

So we've looped around however many times til we run out of something and crash. Now to work out why it keeps looping...

FWIW we do have a few DLL:
Code: [Select]
./build/os2-i586/bin/client/jvm.dll
./build/os2-i586/bin/jhpi.dll
./build/os2-i586/bin/jverify.dll
./build/os2-i586/bin/server/jvm.dll
./build/os2-i586/hotspot/import/jre/bin/client/jvm.dll
./build/os2-i586/hotspot/import/jre/bin/kernel/jvm.dll
./build/os2-i586/hotspot/import/jre/bin/server/jvm.dll
./build/os2-i586/hotspot/outputdir/os2_i486_compiler1/product/jvm.dll
./build/os2-i586/hotspot/outputdir/os2_i486_compiler2/product/jvm.dll
./build/os2-i586/hotspot/outputdir/os2_i486_kernel/product/jvm.dll
Title: Re: Compiling OpenJDK
Post by: Martin Iturbide on April 15, 2023, 01:52:13 am
Doesn't Work:
FreePlane - won't start, get a POPUPLOG
ProjectLibre - won't start, get a POPUPLOG
Art of Illusion - won't start, get a POPUPLOG
jAlbum - won't start, get a POPUPLOG

Thanks David for this further testing.

I confirm that...
- ProjectLibre
- JAlbum
- Art of Illusion
Does not work also on my side.

Code: [Select]

------------------------------------------------------------

04-14-2023  18:48:41  SYS3171  PID 005d  TID 0012  Slot 0087
C:\PROGRAMS\OPENJDK\BIN\JAVA.EXE
c0000005
1ffca4ec
P1=00000001  P2=04190004  P3=XXXXXXXX  P4=XXXXXXXX 
EAX=042e0250  EBX=042e022c  ECX=042e002c  EDX=00000000
ESI=00000000  EDI=00000001 
DS=0053  DSACC=d0f3  DSLIM=9fffffff 
ES=0053  ESACC=d0f3  ESLIM=9fffffff 
FS=150b  FSACC=00f3  FSLIM=00000030
GS=0000  GSACC=****  GSLIM=********
CS:EIP=005b:1c40403a  CSACC=d0df  CSLIM=9fffffff
SS:ESP=0053:042dfff0  SSACC=d0f3  SSLIM=9fffffff
EBP=042e0068  FLG=00010246

DOSCALL1.DLL 0002:0000a4ec

------------------------------------------------------------

04-14-2023  18:49:12  SYS3175  PID 0060  TID 0001  Slot 009b
C:\PROGRAMS\OPENJDK\BIN\JAVA.EXE
c0000005
0080f852
P1=00000002  P2=00000000  P3=XXXXXXXX  P4=XXXXXXXX 
EAX=00000000  EBX=006e0061  ECX=00000000  EDX=02dca64c
ESI=00650067  EDI=00700020 
DS=0069  DSACC=d0f3  DSLIM=9fffffff 
ES=0053  ESACC=d0f3  ESLIM=9fffffff 
FS=150b  FSACC=00f3  FSLIM=00000030
GS=0000  GSACC=****  GSLIM=********
CS:EIP=005b:0080f852  CSACC=d0df  CSLIM=9fffffff
SS:ESP=0053:0086ea80  SSACC=d0f3  SSLIM=9fffffff
EBP=006c006f  FLG=00010212

JAVA.EXE 0004:007cf852

------------------------------------------------------------

04-14-2023  18:49:19  SYS3175  PID 0062  TID 0001  Slot 009b
C:\PROGRAMS\OPENJDK\BIN\JAVAW.EXE
c0000005
0080f842
P1=00000002  P2=00000000  P3=XXXXXXXX  P4=XXXXXXXX 
EAX=00000000  EBX=006e0061  ECX=00000000  EDX=02dca28c
ESI=00650067  EDI=00700020 
DS=0069  DSACC=d0f3  DSLIM=9fffffff 
ES=0053  ESACC=d0f3  ESLIM=9fffffff 
FS=150b  FSACC=00f3  FSLIM=00000030
GS=0000  GSACC=****  GSLIM=********
CS:EIP=005b:0080f842  CSACC=d0df  CSLIM=9fffffff
SS:ESP=0053:0086ea81  SSACC=d0f3  SSLIM=9fffffff
EBP=006c006f  FLG=00010292

JAVAW.EXE 0004:007cf842


Regards
Title: Re: Compiling OpenJDK
Post by: Dave Yeo on April 15, 2023, 01:54:52 am
Looking at David's popuplog, I see one I haven't seen,
Code: [Select]
04-14-2023  16:01:47  SYS3186  PID 0056  TID 0001  Slot 00ae
C:\PROGRAMS\JAVA6\BIN\JAVAW.EXE
c000009d
0080f7b0
EAX=02e4a7ac  EBX=006e0061  ECX=00000000  EDX=02e4a72c
ESI=00650063  EDI=00700020 
DS=0069  DSACC=d0f3  DSLIM=bfffffff 
ES=0053  ESACC=d0f3  ESLIM=bfffffff 
FS=150b  FSACC=00f3  FSLIM=00000030
GS=0000  GSACC=****  GSLIM=********
CS:EIP=005b:0080f7b0  CSACC=d0df  CSLIM=bfffffff
SS:ESP=0053:0086ea84  SSACC=d0f3  SSLIM=bfffffff
EBP=006c006f  FLG=00010282

JAVAW.EXE 0004:007cf7b0

A sys3186 is caused by try to execute a privileged instruction.

Code: [Select]
SYS3186: A program in this session encountered a problem and cannot
continue.

EXPLANATION: A privileged instruction exception was generated when an
attempt was made to execute an instruction whose operation is not
allowed in the current machine mode.  For example, an attempt was made
to execute an instruction in user mode that is only allowed in kernel
mode.

ACTION: If you purchased this program, contact the supplier of the
program.  If you are the developer of this program, refer to the
information in the register.
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 15, 2023, 04:13:14 am
I hacked around the looping make by commenting out part of a makefile, but now I get a bunch of errors like:
Code: [Select]
..\..\src\share\classes\java\nio\charset\Charset.java:28: cannot find symbol
symbol  : class ByteBuffer
location: package java.nio
import java.nio.ByteBuffer;
               ^
..\..\src\share\classes\java\nio\charset\Charset.java:29: cannot find symbol
symbol  : class CharBuffer
location: package java.nio
import java.nio.CharBuffer;
               ^
..\..\src\share\classes\java\nio\charset\Charset.java:46: cannot find symbol
symbol  : class StandardCharsets
location: package sun.nio.cs
import sun.nio.cs.StandardCharsets;

No idea why or how to proceed :(
Title: Re: Compiling OpenJDK
Post by: Mentore on April 18, 2023, 08:18:09 am
I hacked around the looping make by commenting out part of a makefile, but now I get a bunch of errors like:
Code: [Select]
..\..\src\share\classes\java\nio\charset\Charset.java:28: cannot find symbol
symbol  : class ByteBuffer
location: package java.nio
import java.nio.ByteBuffer;
               ^
..\..\src\share\classes\java\nio\charset\Charset.java:29: cannot find symbol
symbol  : class CharBuffer
location: package java.nio
import java.nio.CharBuffer;
               ^
..\..\src\share\classes\java\nio\charset\Charset.java:46: cannot find symbol
symbol  : class StandardCharsets
location: package sun.nio.cs
import sun.nio.cs.StandardCharsets;

No idea why or how to proceed :(

Now this is weird.
https://en.wikipedia.org/wiki/Non-blocking_I/O_(Java)

It seems Java NIO is included in Java since 1.4 SE, so we OS/2 users should already have it...

Mentore
Title: Re: Compiling OpenJDK
Post by: Paul Smedley on April 18, 2023, 09:41:22 am
Yeah it's bizarre - and that command is (I think) using the bootstrap jdk so it's not even like it's something I've compiled that's causing the error - pretty sure it's using the old odin DLLs too.