Author Topic: Compiling OpenJDK  (Read 29702 times)

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #45 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

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #46 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.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #47 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...
« Last Edit: April 12, 2023, 06:37:25 am by Paul Smedley »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4754
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling OpenJDK
« Reply #48 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
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #49 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.

Mentore

  • Full Member
  • ***
  • Posts: 165
  • Karma: +6/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #50 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

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #51 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..

David McKenna

  • Hero Member
  • *****
  • Posts: 751
  • Karma: +24/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #52 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,

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #53 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
« Last Edit: April 14, 2023, 11:07:44 pm by Paul Smedley »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4754
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling OpenJDK
« Reply #54 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
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4808
  • Karma: +100/-1
    • View Profile
Re: Compiling OpenJDK
« Reply #55 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.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #56 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 :(

Mentore

  • Full Member
  • ***
  • Posts: 165
  • Karma: +6/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #57 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

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2095
  • Karma: +160/-0
    • View Profile
Re: Compiling OpenJDK
« Reply #58 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.