Bug 237208 - java/openjdk11: port to powerpc64
Summary: java/openjdk11: port to powerpc64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: powerpc Any
: --- Affects Some People
Assignee: freebsd-java mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-11 17:08 UTC by mikael.urankar
Modified: 2019-08-25 20:40 UTC (History)
10 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
patch (3.27 KB, patch)
2019-04-11 17:08 UTC, mikael.urankar
no flags Details | Diff
patch (3.98 KB, patch)
2019-04-14 13:28 UTC, mikael.urankar
no flags Details | Diff
log1 (25.10 KB, text/plain)
2019-04-15 14:47 UTC, Piotr Kubaj
no flags Details
log2 (31.88 KB, text/plain)
2019-04-15 14:48 UTC, Piotr Kubaj
no flags Details
log3 (36.12 KB, text/plain)
2019-04-15 14:48 UTC, Piotr Kubaj
no flags Details
patch (3.80 KB, patch)
2019-05-01 09:42 UTC, mikael.urankar
no flags Details | Diff
build log 02.05.2019 07:37 AM (115.05 KB, text/plain)
2019-05-02 06:37 UTC, Francis Little
no flags Details
Patch to fix not defined "INCLUDE_RTM_OPT" (351 bytes, patch)
2019-05-03 12:31 UTC, Curtis Hamilton
no flags Details | Diff
patch (3.03 KB, patch)
2019-05-17 09:51 UTC, mikael.urankar
no flags Details | Diff
Changes for openjdk11/Makefile (1.77 KB, patch)
2019-05-29 06:17 UTC, Greg Lewis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Piotr Kubaj freebsd_committer 2019-04-14 10:59:16 UTC
Testing now.
Comment 2 Piotr Kubaj freebsd_committer 2019-04-14 11:21:02 UTC
When compiling the port, I get:
root@talos:$/usr/ports/java/openjdk11$ make
===>   openjdk11-11.0.2.9.4 depends on executable: zip - found
===>   openjdk11-11.0.2.9.4 depends on package: autoconf>0 - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/include/cups/cups.h - found
===>   openjdk11-11.0.2.9.4 depends on executable: bash - found
===>   openjdk11-11.0.2.9.4 depends on executable: gmake - found
===>   openjdk11-11.0.2.9.4 depends on package: libiconv>=1.14_11 - found
===>   openjdk11-11.0.2.9.4 depends on package: pkgconf>=1.3.0_1 - found
===>   openjdk11-11.0.2.9.4 depends on executable: gcc8 - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/bin/as - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/libdata/pkgconfig/xext.pc - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/libdata/pkgconfig/xi.pc - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/libdata/pkgconfig/xrender.pc - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/libdata/pkgconfig/xt.pc - found
===>   openjdk11-11.0.2.9.4 depends on file: /usr/local/libdata/pkgconfig/xtst.pc - found
===>   openjdk11-11.0.2.9.4 depends on shared library: libasound.so - found (/usr/local/lib/libasound.so)
===>   openjdk11-11.0.2.9.4 depends on shared library: libfontconfig.so - found (/usr/local/lib/libfontconfig.so)
===>   openjdk11-11.0.2.9.4 depends on shared library: libfreetype.so - found (/usr/local/lib/libfreetype.so)
===>   openjdk11-11.0.2.9.4 depends on shared library: libgif.so - found (/usr/local/lib/libgif.so)
===>   openjdk11-11.0.2.9.4 depends on shared library: liblcms2.so - found (/usr/local/lib/liblcms2.so)
===>   openjdk11-11.0.2.9.4 depends on shared library: libpng16.so - found (/usr/local/lib/libpng16.so)
===>   openjdk11-11.0.2.9.4 depends on shared library: libjpeg.so - found (/usr/local/lib/libjpeg.so)
===>  Configuring for openjdk11-11.0.2.9.4
env: ./configure: No such file or directory
===>  Script "configure" failed unexpectedly.
Please report the problem to java@FreeBSD.org [maintainer] and attach the
"/usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/config.log"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make: stopped in /usr/local/poudriere/ports/default/java/openjdk11
Comment 3 mikael.urankar 2019-04-14 13:28:23 UTC
Created attachment 203672 [details]
patch

Can you try this patch instead?
Comment 4 Piotr Kubaj freebsd_committer 2019-04-15 14:47:26 UTC
(In reply to mikael.urankar from comment #3)
Now:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000000819df229c, pid=79124, tid=102195
#
# JRE version: OpenJDK Runtime Environment (11.0.2+9) (build 11.0.2+9-4)
# Java VM: OpenJDK 64-Bit Server VM (11.0.2+9-4, mixed mode, tiered, compressed oops, serial gc, bsd-ppc64)
# Problematic frame:
# v  ~StubRoutines::jbyte_disjoint_arraycopy
#
# Core dump will be written. Default location: /usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/make/javac.core
#
# An error report file with more information is saved as:
# /usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/make/hs_err_pid79124.log
Compiled method (c1)    7468  131       1       java.util.Arrays::copyOfRange (63 bytes)
 total in heap  [0x000000081a970a90,0x000000081a9717e8] = 3416
 relocation     [0x000000081a970bf0,0x000000081a970cd0] = 224
 constants      [0x000000081a970d00,0x000000081a970d80] = 128
 main code      [0x000000081a970d80,0x000000081a971300] = 1408
 stub code      [0x000000081a971300,0x000000081a971530] = 560
 oops           [0x000000081a971530,0x000000081a971538] = 8
 metadata       [0x000000081a971538,0x000000081a9715c8] = 144
 scopes data    [0x000000081a9715c8,0x000000081a9716c0] = 248
 scopes pcs     [0x000000081a9716c0,0x000000081a9717d0] = 272
 dependencies   [0x000000081a9717d0,0x000000081a9717d8] = 8
 nul chk table  [0x000000081a9717d8,0x000000081a9717e8] = 16
Compiled method (nm)    7483  236     n 0       java.lang.Class::isArray (native)
 total in heap  [0x000000081a98ce10,0x000000081a98d160] = 848
 relocation     [0x000000081a98cf70,0x000000081a98cf78] = 8
 main code      [0x000000081a98cf80,0x000000081a98d160] = 480
Could not load hsdis-ppc64.so; library not loadable; PrintAssembly is disabled
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000000819df291c, pid=79308, tid=101052
#
# JRE version: OpenJDK Runtime Environment (11.0.2+9) (build 11.0.2+9-4)
# Java VM: OpenJDK 64-Bit Server VM (11.0.2+9-4, mixed mode, tiered, compressed oops, g1 gc, bsd-ppc64)
# Problematic frame:
# v  ~StubRoutines::jbyte_disjoint_arraycopy
#
# Core dump will be written. Default location: /usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/make/hotspot/javac.core
#
# An error report file with more information is saved as:
# /usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/make/hotspot/hs_err_pid79308.log
Compiled method (c2)   15848  437       4       java.lang.AbstractStringBuilder::append (45 bytes)
 total in heap  [0x0000000842175e10,0x0000000842176c50] = 3648
 relocation     [0x0000000842175f70,0x0000000842176000] = 144
 constants      [0x0000000842176000,0x0000000842176100] = 256
 main code      [0x0000000842176100,0x0000000842176800] = 1792
 stub code      [0x0000000842176800,0x0000000842176928] = 296
 metadata       [0x0000000842176928,0x0000000842176968] = 64
 scopes data    [0x0000000842176968,0x0000000842176b20] = 440
 scopes pcs     [0x0000000842176b20,0x0000000842176c00] = 224
 dependencies   [0x0000000842176c00,0x0000000842176c08] = 8
 handler table  [0x0000000842176c08,0x0000000842176c20] = 24
 nul chk table  [0x0000000842176c20,0x0000000842176c50] = 48
Compiled method (c2)   15859  437       4       java.lang.AbstractStringBuilder::append (45 bytes)
 total in heap  [0x0000000842175e10,0x0000000842176c50] = 3648
 relocation     [0x0000000842175f70,0x0000000842176000] = 144
 constants      [0x0000000842176000,0x0000000842176100] = 256
 main code      [0x0000000842176100,0x0000000842176800] = 1792
 stub code      [0x0000000842176800,0x0000000842176928] = 296
 metadata       [0x0000000842176928,0x0000000842176968] = 64
 scopes data    [0x0000000842176968,0x0000000842176b20] = 440
 scopes pcs     [0x0000000842176b20,0x0000000842176c00] = 224
 dependencies   [0x0000000842176c00,0x0000000842176c08] = 8
 handler table  [0x0000000842176c08,0x0000000842176c20] = 24
 nul chk table  [0x0000000842176c20,0x0000000842176c50] = 48
Could not load hsdis-ppc64.so; library not loadable; PrintAssembly is disabled
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000000819df2f6c, pid=79364, tid=102206
#
# JRE version: OpenJDK Runtime Environment (11.0.2+9) (build 11.0.2+9-4)
# Java VM: OpenJDK 64-Bit Server VM (11.0.2+9-4, mixed mode, tiered, compressed oops, g1 gc, bsd-ppc64)
# Problematic frame:
# v  ~StubRoutines::arrayof_jbyte_disjoint_arraycopy
#
# Core dump will be written. Default location: /usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/make/hotspot/javac.core
#
# An error report file with more information is saved as:
# /usr/local/poudriere/ports/default/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/make/hotspot/hs_err_pid79364.log
Compiled method (c1)   19895  515       3       jdk.internal.org.objectweb.asm.ByteVector::enlarge (51 bytes)
 total in heap  [0x000000081a5de910,0x000000081a5df0d8] = 1992
 relocation     [0x000000081a5dea70,0x000000081a5deaa0] = 48
 constants      [0x000000081a5deb00,0x000000081a5deb80] = 128
 main code      [0x000000081a5deb80,0x000000081a5def80] = 1024
 stub code      [0x000000081a5def80,0x000000081a5deff0] = 112
 metadata       [0x000000081a5deff0,0x000000081a5df010] = 32
 scopes data    [0x000000081a5df010,0x000000081a5df060] = 80
 scopes pcs     [0x000000081a5df060,0x000000081a5df0c0] = 96
 dependencies   [0x000000081a5df0c0,0x000000081a5df0c8] = 8
 nul chk table  [0x000000081a5df0c8,0x000000081a5df0d8] = 16
Compiled method (c1)   19996  515       3       jdk.internal.org.objectweb.asm.ByteVector::enlarge (51 bytes)
 total in heap  [0x000000081a5de910,0x000000081a5df0d8] = 1992
 relocation     [0x000000081a5dea70,0x000000081a5deaa0] = 48
 constants      [0x000000081a5deb00,0x000000081a5deb80] = 128
 main code      [0x000000081a5deb80,0x000000081a5def80] = 1024
 stub code      [0x000000081a5def80,0x000000081a5deff0] = 112
 metadata       [0x000000081a5deff0,0x000000081a5df010] = 32
 scopes data    [0x000000081a5df010,0x000000081a5df060] = 80
 scopes pcs     [0x000000081a5df060,0x000000081a5df0c0] = 96
 dependencies   [0x000000081a5df0c0,0x000000081a5df0c8] = 8
 nul chk table  [0x000000081a5df0c8,0x000000081a5df0d8] = 16
Compiled method (c1)   20003  263       3       jdk.internal.org.objectweb.asm.ClassWriter::newUTF8 (70 bytes)
 total in heap  [0x000000081a54e890,0x000000081a54f310] = 2688
 relocation     [0x000000081a54e9f0,0x000000081a54ea88] = 152
 constants      [0x000000081a54eb00,0x000000081a54eb80] = 128
 main code      [0x000000081a54eb80,0x000000081a54ef80] = 1024
 stub code      [0x000000081a54ef80,0x000000081a54f130] = 432
 metadata       [0x000000081a54f130,0x000000081a54f188] = 88
 scopes data    [0x000000081a54f188,0x000000081a54f200] = 120
 scopes pcs     [0x000000081a54f200,0x000000081a54f2e0] = 224
 dependencies   [0x000000081a54f2e0,0x000000081a54f2e8] = 8
 nul chk table  [0x000000081a54f2e8,0x000000081a54f310] = 40
Compiled method (c1)   20033  363       3       jdk.internal.org.objectweb.asm.ClassWriter::newStringishItem (68 bytes)
 total in heap  [0x000000081a57cb10,0x000000081a57d568] = 2648
 relocation     [0x000000081a57cc70,0x000000081a57cd08] = 152
 constants      [0x000000081a57cd80,0x000000081a57ce00] = 128
 main code      [0x000000081a57ce00,0x000000081a57d200] = 1024
 stub code      [0x000000081a57d200,0x000000081a57d3b0] = 432
 metadata       [0x000000081a57d3b0,0x000000081a57d408] = 88
 scopes data    [0x000000081a57d408,0x000000081a57d488] = 128
 scopes pcs     [0x000000081a57d488,0x000000081a57d548] = 192
 dependencies   [0x000000081a57d548,0x000000081a57d550] = 8
 nul chk table  [0x000000081a57d550,0x000000081a57d568] = 24
Could not load hsdis-ppc64.so; library not loadable; PrintAssembly is disabled
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

Logs are attached.
Comment 5 Piotr Kubaj freebsd_committer 2019-04-15 14:47:45 UTC
Created attachment 203697 [details]
log1
Comment 6 Piotr Kubaj freebsd_committer 2019-04-15 14:48:03 UTC
Created attachment 203698 [details]
log2
Comment 7 Piotr Kubaj freebsd_committer 2019-04-15 14:48:27 UTC
Created attachment 203699 [details]
log3
Comment 8 mikael.urankar 2019-04-16 10:01:31 UTC
(In reply to Piotr Kubaj from comment #4)
I can't reproduce on my G5 :/

It builds fine on 11.2 and 12.0:
http://mikael.urankar.free.fr/FreeBSD/powerpc64/openjdk11-11.0.2.9.4_120ppc64.log
http://mikael.urankar.free.fr/FreeBSD/powerpc64/openjdk11-11.0.2.9.4.log
Comment 9 Gustavo Romero 2019-04-17 14:41:06 UTC
(In reply to Piotr Kubaj from comment #4)

Hi Piotr and Mikael,

Is the SIGILL JVM crash still happening?

Piotr, the illegal instruction executed in the arraycopy stubs looks to be a 'mtdscr', i.e. an instruction used to adjust the depth of the data prefetch prior to the bulk copy.

However I can't make sense of that yet because availability of m{t,f}dscr is proved at runtime before the emission by the compiler.

Logs show that m{t,f}dscr is not available indeed: 

CPU:total 16 (initial active 16) ppc64 fsqrt isel lxarxeh cmpb popcntb popcntw fcfids vand lqarx aes vpmsumb mfdscr vsx ldbrx stdbrx sha darn

That JVM on POWER9 reports it has VSX and DARN support but not DSCR? The instruction that caused the crash in question is also using DSCR SPR number 3, which is not privileged either.

Does:

int main()
{
 asm("mtspr 3, 0;");
}


crashes with a SIGILL?
Comment 10 Gustavo Romero 2019-04-17 14:57:43 UTC
(In reply to Gustavo Romero from comment #9)
Logs show that m{t,f}dscr is not available indeed: 

CPU:total 16 (initial active 16) ppc64 fsqrt isel lxarxeh cmpb popcntb popcntw fcfids vand lqarx aes vpmsumb mfdscr vsx ldbrx stdbrx sha darn

Sorry, mfdscr IS available. I'm blind... heh

Still odd tho.
Comment 11 Piotr Kubaj freebsd_committer 2019-04-18 06:52:44 UTC
(In reply to Gustavo Romero from comment #10)
Looks ok.
root@talos:$~$ cat test.c
int main()
{
 asm("mtspr 3, 0;");
}
root@talos:$~$ cc test.c
root@talos:$~$ ./a.out
root@talos:$~$ echo $?
1
Comment 12 Gustavo Romero 2019-04-24 00:11:04 UTC
(In reply to Piotr Kubaj from comment #11)

Hi Piotr,

I'm able to build fine the openjdk version found in the FreeBSD ports as you pointed out, on a P9 VM with the patcheset provided by Mikael. It also runs fine and I get no SIGILL. However I also noticed that DSCR is disabled on that P9 VM machine, hence the example I provided you that executes 'mfdscr' does not work and dies with SIGILL. The JVM, as I said, will detect DSCR at runtime, so DSCR enable or disabled in the system should not be a problem to the JVM.

Either way I'm still wondering how you got DSCR enable on your Talos.

Could I have access to the machine you got the JVM SIGILL?

Are you able to reproduce the SIGILL consistently, every time you ran java or java -Xcomp -help, for instance?

Thank you.
Comment 13 Brandon Bergren 2019-04-24 00:35:21 UTC
Found it.

The FSCR is slightly divergent between the BSP and the APs on the Talos II.

```
root@fledgling-bmc:~# pdbg -a getspr 153
Couldn't open debugfs
Couldn't open debugfs
p0:c23:t3:spr153: 0x0000000000000184
p0:c23:t2:spr153: 0x0000000000000184
p0:c23:t1:spr153: 0x0000000000000184
p0:c23:t0:spr153: 0x0000000000000184
p0:c22:t3:spr153: 0x0000000000000184
p0:c22:t2:spr153: 0x0000000000000184
p0:c22:t1:spr153: 0x0000000000000184
p0:c22:t0:spr153: 0x0000000000000184
p0:c19:t3:spr153: 0x0000000000000184
p0:c19:t2:spr153: 0x0000000000000184
p0:c19:t1:spr153: 0x0000000000000184
p0:c19:t0:spr153: 0x0000000000000184
p0:c18:t3:spr153: 0x0000000000000184
p0:c18:t2:spr153: 0x0000000000000184
p0:c18:t1:spr153: 0x0000000000000184
p0:c18:t0:spr153: 0x0000000000000184
p0:c17:t3:spr153: 0x0000000000000184
p0:c17:t2:spr153: 0x0000000000000184
p0:c17:t1:spr153: 0x0000000000000184
p0:c17:t0:spr153: 0x0000000000000184
p0:c16:t3:spr153: 0x0000000000000184
p0:c16:t2:spr153: 0x0000000000000184
p0:c16:t1:spr153: 0x0000000000000184
p0:c16:t0:spr153: 0x0000000000000184
p0:c13:t3:spr153: 0x0000000000000184
p0:c13:t2:spr153: 0x0000000000000184
p0:c13:t1:spr153: 0x0000000000000184
p0:c13:t0:spr153: 0x0000000000000184
p0:c12:t3:spr153: 0x0000000000000184
p0:c12:t2:spr153: 0x0000000000000184
p0:c12:t1:spr153: 0x0000000000000184
p0:c12:t0:spr153: 0x0000000000000184
p0:c11:t3:spr153: 0x0000000000000184
p0:c11:t2:spr153: 0x0000000000000184
p0:c11:t1:spr153: 0x0000000000000184
p0:c11:t0:spr153: 0x0000000000000184
p0:c10:t3:spr153: 0x0000000000000184
p0:c10:t2:spr153: 0x0000000000000184
p0:c10:t1:spr153: 0x0000000000000184
p0:c10:t0:spr153: 0x0000000000000184
p0:c9:t3:spr153: 0x0000000000000184
p0:c9:t2:spr153: 0x0000000000000184
p0:c9:t1:spr153: 0x0000000000000184
p0:c9:t0:spr153: 0x0000000000000184
p0:c8:t3:spr153: 0x0000000000000184
p0:c8:t2:spr153: 0x0000000000000184
p0:c8:t1:spr153: 0x0000000000000184
p0:c8:t0:spr153: 0x0000000000000184
p0:c7:t3:spr153: 0x0000000000000184
p0:c7:t2:spr153: 0x0000000000000184
p0:c7:t1:spr153: 0x0000000000000184
p0:c7:t0:spr153: 0x0000000000000184
p0:c5:t3:spr153: 0x0000000000000184
p0:c5:t2:spr153: 0x0000000000000184
p0:c5:t1:spr153: 0x0000000000000184
p0:c5:t0:spr153: 0x0000000000000184
p0:c4:t3:spr153: 0x0000000000000184
p0:c4:t2:spr153: 0x0000000000000184
p0:c4:t1:spr153: 0x0000000000000184
p0:c4:t0:spr153: 0x0000000000000184
p0:c2:t3:spr153: 0x0000000000000184
p0:c2:t2:spr153: 0x0000000000000184
p0:c2:t1:spr153: 0x0000000000000184
p0:c2:t0:spr153: 0x0000000000000184
p0:c1:t3:spr153: 0x0000000000000184
p0:c1:t2:spr153: 0x0000000000000184
p0:c1:t1:spr153: 0x0000000000000184
p0:c1:t0:spr153: 0x0000000000000184
p0:c0:t3:spr153: 0x0000000000000184
p0:c0:t2:spr153: 0x0000000000000184
p0:c0:t1:spr153: 0x0000000000000184
p0:c0:t0:spr153: 0x0000000000000180
```

So, if a process is created on anything but cpu0 it will detect the DSCR as being available. If it later migrates to cpu0, it will cause a facility unavailable trap if it tries to mess with the DSCR, and the kernel handles this by SIGILL.
Comment 14 Brandon Bergren 2019-04-24 00:50:01 UTC
<Bdragon> root@fledgling:~ # cpuset -l 0 ./foo
<Bdragon> Illegal instruction (core dumped)
<Bdragon> root@fledgling:~ # cpuset -l 1 ./foo
<Bdragon> root@fledgling:~ # 
<Bdragon> and if I patch the FSCR from the bmc...
<Bdragon> like so:
<Bdragon> root@fledgling-bmc:~# pdbg -a stop 
<Bdragon> root@fledgling-bmc:~# pdbg -p0 -c0 -t0 putspr 153 0x0000000000000184
<Bdragon> root@fledgling-bmc:~# pdbg -a start     
<Bdragon> tada:
<Bdragon> root@fledgling:~ # cpuset -l 0 ./foo
<Bdragon> root@fledgling:~ #
Comment 15 commit-hook freebsd_committer 2019-04-26 03:19:08 UTC
A commit references this bug:

Author: jhibbits
Date: Fri Apr 26 03:18:50 UTC 2019
New revision: 346730
URL: https://svnweb.freebsd.org/changeset/base/346730

Log:
  powerpc64: Clear FSCR SPR, so that it's in a known state

  This now turns any access to the DSCR SPR into a SIGILL.  Later commits will
  make DCSR work correctly on POWER8 and POWER9.

  PR:		237208

Changes:
  head/sys/powerpc/aim/mp_cpudep.c
  head/sys/powerpc/powerpc/cpu.c
Comment 16 Piotr Kubaj freebsd_committer 2019-04-29 05:22:21 UTC
Now a missing include:
In file included from /tmp/usr/ports/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.3-7-1/src/jdk.management/bsd/native/libmanagement_ext/UnixOperatingSystem.c:29:
/usr/include/sys/sysctl.h:1120:25: error: unknown type name 'u_int'; did you mean 'jint'?
 int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
                         ^~~~~
                         jint
Comment 17 Greg Lewis freebsd_committer 2019-04-29 15:44:35 UTC
Can someone please try a build of the bsd-port branch of https://github.com/battleblow/openjdk-jdk11u on powerpc64?  If that looks good then we'll roll a release from there and incorporate it into the port.  Thanks.
Comment 18 Francis Little 2019-05-01 09:14:24 UTC
(In reply to Greg Lewis from comment #17)

Hi, tried this on my PowerMac G5 and get an error:

make: "/usr/ports/test/openjdk-jdk11u/Makefile" line 33: warning: "echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2 && exit 1" returned non-zero status

pkg info | grep gmake
gmake-4.2.1_3                  GNU version of 'make' utility

Regards
Comment 19 Francis Little 2019-05-01 09:21:57 UTC
(In reply to Greg Lewis from comment #17)

Running bash configure, I get this error:

configure: Could not find a valid Boot JDK.
configure: This might be fixed by explicitly setting --with-boot-jdk
configure: error: Cannot continue
configure exiting with result code 1

Regards
Comment 20 mikael.urankar 2019-05-01 09:42:34 UTC
Created attachment 204137 [details]
patch

(In reply to Francis Little from comment #19)
you need to apply the attached patch:
cd /usr/ports
svn patch /path/to/java_ppc64.patch
make -C /usr/ports/java/openjdk11

post the full build log if it fails.

I don't have access to my ppc64 box, can't do any tests
Comment 21 mikael.urankar 2019-05-01 09:43:37 UTC
(In reply to Francis Little from comment #19)
and don't forget to manually fetch the bootstrap:
fetch -o /usr/ports/distfiles/bootstrap-openjdk11-powerpc64-11.0.2.9.2.tar.xz http://mikael.urankar.free.fr/FreeBSD/powerpc64/bootstrap-openjdk11-powerpc64-11.0.2.9.2.tar.xz
Comment 22 Greg Lewis freebsd_committer 2019-05-01 15:41:34 UTC
I should have been more specific in terms of instructions there.

I'm asking for a build of the upstream repository.  You'll need to follow steps something like this:

* Download the bootstrap (there are links in the first comment and the most recent one before this).
* Unpack the bootstrap somewhere.  Let's say /usr/local/openjdk11
* Checkout the upstream repo from git (link in my previous comment)
* Run the configure script, e.g.

env CC=/usr/local/bin/gcc8 \
    CXX=/usr/local/bin/g++8 \
    bash configure \
        --with-boot-jdk=/usr/local/openjdk11 \
        --disable-ccache \
        --disable-hotspot-gtest \
        --with-alsa=/usr/local \
        --with-cups=/usr/local \
        --with-fontconfig=/usr/local \
        --with-freetype=system \
        --with-freetype-include=/usr/local/include/freetype2 \
        --with-freetype-lib=/usr/local/lib \
        --with-milestone=fcs \
        --with-libjpeg=system \
        --with-giflib=system \
        --with-giflib-include=/usr/local/include \
        --with-giflib-lib=/usr/local/lib \
        --with-libpng=system \
        --with-zlib=system \
        --with-lcms=system \
        --with-toolchain-type=clang \
        --x-includes=/usr/local/include \
        --x-libraries=/usr/local/lib \
        --with-debug-level=release

* Run a build, e.g.

env LANG="C" \
    LC_ALL="C" \
    CLASSPATH="" \
    JAVA_HOME="" \
    LD_LIBRARY_PATH="" \
    CC=/usr/local/bin/gcc8 \
    CXX=/usr/local/bin/g++8 \
    MAKEFLAGS="" \
    USE_CLANG=true \
    gmake \
    CC=/usr/local/bin/gcc8 \
    CXX=/usr/local/bin/g++8 \
    COMPILER_WARNINGS_FATAL="false" \
    LOG=debug \
    images

If that works then we can cut a release and update the port.
Comment 23 Francis Little 2019-05-01 20:12:57 UTC
(In reply to Greg Lewis from comment #22)

Hi, now I fully expect I may be doing something wrong... but trying to help!

I get an error:

So, I completed the following:

* Download the bootstrap (there are links in the first comment and the most recent one before this).
* Unpack the bootstrap somewhere.  Let's say /usr/local/openjdk11
* Checkout the upstream repo from git (link in my previous comment)

    I checked out the bsd-port branch....

* Run the configure script, e.g.

env CC=/usr/local/bin/gcc8 \
    CXX=/usr/local/bin/g++8 \
    bash configure \
        --with-boot-jdk=/usr/local/openjdk11 \
        --disable-ccache \
        --disable-hotspot-gtest \
        --with-alsa=/usr/local \
        --with-cups=/usr/local \
        --with-fontconfig=/usr/local \
        --with-freetype=system \
        --with-freetype-include=/usr/local/include/freetype2 \
        --with-freetype-lib=/usr/local/lib \
        --with-milestone=fcs \
        --with-libjpeg=system \
        --with-giflib=system \
        --with-giflib-include=/usr/local/include \
        --with-giflib-lib=/usr/local/lib \
        --with-libpng=system \
        --with-zlib=system \
        --with-lcms=system \
        --with-toolchain-type=clang \
        --x-includes=/usr/local/include \
        --x-libraries=/usr/local/lib \
        --with-debug-level=release

After running this first step, I get this output:

Runnable configure script is not present
Generating runnable configure script at /root/jdk/openjdk-jdk11u/build/.configure-support/generated-configure.sh
Using autoconf at /usr/local/bin/autoconf [autoconf (GNU Autoconf) 2.69]
configure: Configuration created at Wed May  1 21:07:03 BST 2019.
checking for basename... /usr/bin/basename
checking for bash... /usr/local/bin/bash
checking for cat... /bin/cat
checking for chmod... /bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /bin/cp
checking for cut... /usr/bin/cut
checking for date... /bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /bin/echo
checking for expr... /bin/expr
checking for file... /usr/bin/file
checking for find... /usr/bin/find
checking for head... /usr/bin/head
checking for gunzip... /usr/bin/gunzip
checking for pigz... no
checking for gzip... /usr/bin/gzip
checking for ln... /bin/ln
checking for ls... /bin/ls
checking for mkdir... /bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /bin/mv
checking for nawk... /usr/bin/nawk
checking for printf... /usr/bin/printf
checking for greadlink... no
checking for readlink... /usr/bin/readlink
checking for rm... /bin/rm
checking for rmdir... /bin/rmdir
checking for sh... /bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... no
checking for tar... /usr/bin/tar
checking for tee... /usr/bin/tee
checking for touch... /usr/bin/touch
checking for tr... /usr/bin/tr
checking for uname... /usr/bin/uname
checking for uniq... /usr/bin/uniq
checking for wc... /usr/bin/wc
checking for which... /usr/bin/which
checking for xargs... /usr/bin/xargs
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for a sed that does not truncate output... /usr/bin/sed
checking for cygpath... no
checking for df... /bin/df
checking for cpio... /usr/bin/cpio
checking for nice... /usr/bin/nice
checking for pandoc... no
checking build system type... powerpc64-unknown-freebsd12.0
checking host system type... powerpc64-unknown-freebsd12.0
checking target system type... powerpc64-unknown-freebsd12.0
checking openjdk-build os-cpu... bsd-ppc64
checking openjdk-target os-cpu... bsd-ppc64
checking openjdk-target os-env... bsd.freebsd
checking compilation type... native
checking for top-level directory... /root/jdk/openjdk-jdk11u
checking if custom source is suppressed (openjdk-only)... no
checking which variant of the JDK to build... normal
checking which debug level to use... release
checking which variants of the JVM to build... server
checking for sysroot... 
checking for toolchain path... 
checking for extra path... 
checking where to store configuration... in default location
checking what configuration name to use... bsd-ppc64-normal-server-release
checking for apt-get... no
checking for yum... no
checking for brew... no
checking for port... no
checking for pkgutil... no
checking for pkgadd... no
checking for gmake... /usr/local/bin/gmake
configure: Testing potential make at /usr/local/bin/gmake, found using gmake in PATH
configure: Using GNU make at /usr/local/bin/gmake (version: GNU Make 4.2.1)
checking if make --output-sync is supported... yes
checking for output-sync value... none
checking if find supports -delete... yes
checking what type of tar was found... bsd
checking that grep (/usr/bin/grep) -Fx handles empty lines in the pattern list correctly... yes
checking for unzip... /usr/bin/unzip
checking for zip... /usr/local/bin/zip
checking for ldd... /usr/bin/ldd
checking for greadelf... no
checking for readelf... /usr/bin/readelf
checking for dot... /usr/local/bin/dot
checking for hg... no
checking for stat... /usr/bin/stat
checking for time... /usr/bin/time
checking for flock... no
checking for dtrace... /usr/sbin/dtrace
checking for gpatch... no
checking for patch... /usr/bin/patch
checking bash version... 5.0.7
checking if bash supports pipefail... yes
checking if bash supports errexit (-e)... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for default LOG value... 
checking headless only... no
checking for graphviz dot... yes
checking for pandoc... no, cannot generate full docs
checking full docs... no, missing dependencies
checking for cacerts file... default
checking if packaged modules are kept... yes (default)
configure: WARNING: Option --with-milestone is deprecated and will be ignored.
checking for version string... 11.0.3-internal+0-adhoc.root.openjdk-jdk11u
configure: Found potential Boot JDK using configure arguments
checking for Boot JDK... /usr/local/openjdk11
checking Boot JDK version... openjdk version "11.0.2" 2019-04-16 OpenJDK Runtime Environment (build 11.0.2+9-4) OpenJDK 64-Bit Server VM (build 11.0.2+9-4, mixed mode) 
checking for java in Boot JDK... ok
checking for javac in Boot JDK... ok
checking for javadoc in Boot JDK... ok
checking for jar in Boot JDK... ok
checking for jarsigner in Boot JDK... ok
checking if Boot JDK is 32 or 64 bits... 64
checking for local Boot JDK Class Data Sharing (CDS)... yes, created
checking for Build JDK... yes, will use output dir
configure: Using user selected toolchain clang (clang/LLVM). Default toolchain is gcc.
configure: Will use user supplied compiler CC=/usr/local/bin/gcc8
checking resolved symbolic links for CC... no symlink
configure: The C compiler (located as /usr/local/bin/gcc8) does not seem to be the required clang compiler.
configure: The result from running with --version was: "gcc8 (FreeBSD Ports Collection) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
configure: error: A clang compiler is required. Try setting --with-tools-dir.
configure exiting with result code 1
Comment 24 Piotr Kubaj freebsd_committer 2019-05-01 20:19:25 UTC
(In reply to Francis Little from comment #23)
Don't set toolchain type to clang when you use gcc.
Comment 25 Greg Lewis freebsd_committer 2019-05-02 01:19:23 UTC
Sorry about that, I cut and paste it from some amd64 instructions and didn't change the --with-toolchain-type flag.  Try using gcc instead of clang or leaving it out.
Comment 26 Francis Little 2019-05-02 06:36:54 UTC
(In reply to Greg Lewis from comment #25)

Hi, configure completed with --with-toolchain-type=gcc

so running a build with:

env LANG="C" \
    LC_ALL="C" \
    CLASSPATH="" \
    JAVA_HOME="" \
    LD_LIBRARY_PATH="" \
    CC=/usr/local/bin/gcc8 \
    CXX=/usr/local/bin/g++8 \
    MAKEFLAGS="" \
    gmake \
    CC=/usr/local/bin/gcc8 \
    CXX=/usr/local/bin/g++8 \
    COMPILER_WARNINGS_FATAL="false" \
    LOG=debug \
    images

(I took out "USE_CLANG=true \" for the build.)

I get an error and will attach the log...
Comment 27 Francis Little 2019-05-02 06:37:49 UTC
Created attachment 204157 [details]
build log 02.05.2019 07:37 AM

Here is the output from the build.
Comment 28 Klaus Küchemann 2019-05-02 12:41:40 UTC
(In reply to Francis Little from comment #27)
you could try to set 'Wno-stringop-overflow'  -flag for gcc8, or something
like that...
.. before fixing sources in the hotspot-subdirectory ( strncat from ...dfa.cpp  ) , you should ask Kurt&Greg first whether its recommended.
Comment 29 Greg Lewis freebsd_committer 2019-05-02 15:11:12 UTC
I committed a change which should fix the error compiling dfa.cpp (it does for me).  Please try running 'git pull' and compiling again.

FWIW, on FreeBSD 11/amd64 trying to compile with gcc8 results in internal compiler errors.  I'm hoping that isn't true on ppc64.
Comment 30 mikael.urankar 2019-05-02 15:16:55 UTC
(In reply to Greg Lewis from comment #29)
I did the bootstrap on 11.2.
I had this kind of error on aarch64 when using the precompiled header, you can try with --disable-precompiled-headers (there is a comment in openjdk8 wrt precomp header)
Comment 31 Curtis Hamilton 2019-05-02 17:41:00 UTC
(In reply to Francis Little from comment #27)

Looking at your log the problem is with "images" in your environment settings.  This seems to be of no use to the build process.
Comment 32 Klaus Küchemann 2019-05-02 18:17:25 UTC
(In reply to Curtis Hamilton from comment #31)

'images' is the build target, (https://hg.openjdk.java.net/jdk/jdk11/raw-file/tip/doc/building.html#gnu-make). I can not see anything wrong with `images` in the logs of Francis Little (at first sight)
Comment 33 Greg Lewis freebsd_committer 2019-05-02 19:50:45 UTC
Thanks for reminding me, I'd forgotten we'd disabled precompiled headers with gcc.

If I add that and --disable-dtrace I get a lot further.
Comment 34 Francis Little 2019-05-02 21:01:14 UTC
(In reply to Greg Lewis from comment #33)

Updating from git, and building with both --disable-dtrace and --disable-precompiled-headers I get the following:

/usr/bin/printf "\n=== Output from failing command(s) repeated here ===\n"

=== Output from failing command(s) repeated here ===
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_abstractInterpreter.o:\n"
* For target hotspot_variant-server_libjvm_objs_abstractInterpreter.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_abstractInterpreter.
In file included from /root/jdk/openjdk-jdk11u/src/hotspot/share/asm/macroAssembler.hpp:31,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/interpreter/abstractInterpreter.cpp:26:
/root/jdk/openjdk-jdk11u/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp:614:5: error: "INCLUDE_RTM_OPT" is not defined, evaluates to 0 [-Werror=undef]
 #if INCLUDE_RTM_OPT
     ^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_abstractInterpreter.o.log` -gt 12; then /bi
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_abstractInterpreter_ppc.o:\n"
* For target hotspot_variant-server_libjvm_objs_abstractInterpreter_ppc.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_abstractInterpreter_
In file included from /root/jdk/openjdk-jdk11u/src/hotspot/share/asm/macroAssembler.hpp:31,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/interpreter/abstractInterpreter.hpp:28,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/interpreter/cppInterpreter.hpp:28,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/interpreter/interpreter.hpp:29,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp:27:
/root/jdk/openjdk-jdk11u/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp:614:5: error: "INCLUDE_RTM_OPT" is not defined, evaluates to 0 [-Werror=undef]
 #if INCLUDE_RTM_OPT
     ^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_abstractInterpreter_ppc.o.log` -gt 12; then
/usr/bin/printf "\n* All command lines available in /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs.\n"

* All command lines available in /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs.
/usr/bin/printf "=== End of repeated output ===\n"
=== End of repeated output ===
if /usr/bin/grep -q "recipe for target .* failed" /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/build.log 2> /dev/null; then /usr/bin/printf "\n=== Make failed targets repeated

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
/usr/bin/printf "Hint: See doc/building.html#troubleshooting for assistance.\n\n"
Hint: See doc/building.html#troubleshooting for assistance.

gmake[2]: Leaving directory '/root/jdk/openjdk-jdk11u'
gmake[1]: Leaving directory '/root/jdk/openjdk-jdk11u'
Comment 35 Curtis Hamilton 2019-05-03 01:10:13 UTC
(In reply to Francis Little from comment #34)

Build on powerpc64 requires precompiled-headers to be enabled, when using gcc.
Comment 36 Francis Little 2019-05-03 09:14:25 UTC
(In reply to Curtis Hamilton from comment #35)

Tried another build, without  --disable-dtrace and --disable-precompiled-headers:

=== Output from failing command(s) repeated here ===
/usr/bin/printf "* For target buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch:\n"
* For target buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch.log || true) | /usr/bin/head -n 12
Failed to create server process: Cannot run program "/usr/local/openjdk11/bin/java": error=13, Permission denied
IOException caught during compilation: java.io.IOException: Cannot run program "/usr/local/openjdk11/bin/java": error=13, Permission denied
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_jni.o:\n"
* For target hotspot_variant-server_libjvm_objs_jni.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_jni.o.log || true) | /usr/bin/head -n 12
In file included from /root/jdk/openjdk-jdk11u/src/hotspot/share/utilities/dtrace.hpp:52,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/prims/jni.cpp:86:
/root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/hotspot/variant-server/gensrc/dtracefiles/hotspot_jni.h: In function '_jstring* jni_NewStringUTF(JNIEnv*, const char*)':
/root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/hotspot/variant-server/gensrc/dtracefiles/hotspot_jni.h:3421:45: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  __dtrace_hotspot_jni___NewStringUTF__return(arg0)
                                             ^
/root/jdk/openjdk-jdk11u/src/hotspot/share/prims/jni.cpp:2510:11: note: 'ret' was declared here
   jstring ret;
           ^~~
In file included from /root/jdk/openjdk-jdk11u/src/hotspot/share/utilities/dtrace.hpp:52,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/prims/jni.cpp:86:
/root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/hotspot/variant-server/gensrc/dtracefiles/hotspot_jni.h: In function '_jobject* jni_NewObjectA(JNIEnv*, jclass, jmethodID, const jvalue*)':
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_jni.o.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi
   ... (rest of output omitted)
/usr/bin/printf "\n* All command lines available in /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs.\n"

* All command lines available in /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs.
/usr/bin/printf "=== End of repeated output ===\n"
=== End of repeated output ===
if /usr/bin/grep -q "recipe for target .* failed" /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/build.log 2> /dev/null; then /usr/bin/printf "\n=== Make failed targets repeated here ===\n" ; /usr/bin/grep "recipe for target .* failed" /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/build.log ; /usr/bin/printf "=== End of repeated output ===\n" ; /usr/bin/printf "\nHint: Try searching the build log for the name of the first failed target.\n" ; else /usr/bin/printf "\nNo indication of failed target found.\n" ; /usr/bin/printf "Hint: Try searching the build log for '] Error'.\n" ; fi

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
/usr/bin/printf "Hint: See doc/building.html#troubleshooting for assistance.\n\n"
Hint: See doc/building.html#troubleshooting for assistance.

gmake[2]: Leaving directory '/root/jdk/openjdk-jdk11u'
gmake[1]: *** [/root/jdk/openjdk-jdk11u/make/Init.gmk:305: main] Error 2
gmake[1]: Leaving directory '/root/jdk/openjdk-jdk11u'
gmake: *** [/root/jdk/openjdk-jdk11u/make/Init.gmk:186: images] Error 2


I'm not sure why it can't run /usr/local/openjdk11/bin/java, because:

/usr/local/openjdk11/bin/java --version
openjdk 11.0.2 2019-04-16
OpenJDK Runtime Environment (build 11.0.2+9-4)
OpenJDK 64-Bit Server VM (build 11.0.2+9-4, mixed mode)

I may be doing something wrong!
Comment 37 Piotr Kubaj freebsd_committer 2019-05-03 09:19:20 UTC
(In reply to Francis Little from comment #36)
I'm not sure about precompiled headers, but dtrace needs to be disabled for sure.
Comment 38 Francis Little 2019-05-03 10:01:30 UTC
(In reply to Piotr Kubaj from comment #37)

Building with --disable-dtrace, I get:

/usr/bin/printf "* For target buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch:\n"
* For target buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch.log || true) | /usr/bin/head -n 12
Failed to create server process: Cannot run program "/usr/local/openjdk11/bin/java": error=13, Permission denied
IOException caught during compilation: java.io.IOException: Cannot run program "/usr/local/openjdk11/bin/java": error=13, Permission denied
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_macroAssembler_ppc_sha.o:\n"
* For target hotspot_variant-server_libjvm_objs_macroAssembler_ppc_sha.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_macroAssembler_ppc_sha.o.log || true) | /usr/bin/head -n 12
In file included from /root/jdk/openjdk-jdk11u/src/hotspot/share/asm/macroAssembler.hpp:31,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/share/asm/macroAssembler.inline.hpp:28,
                 from /root/jdk/openjdk-jdk11u/src/hotspot/cpu/ppc/macroAssembler_ppc_sha.cpp:25:
/root/jdk/openjdk-jdk11u/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp:614:5: error: "INCLUDE_RTM_OPT" is not defined, evaluates to 0 [-Werror=undef]
Comment 39 Curtis Hamilton 2019-05-03 12:31:37 UTC
Created attachment 204189 [details]
Patch to fix not defined "INCLUDE_RTM_OPT"

The attached patch should fix the not defined "INCLUDE_RTM_OPT" error.  It is defined but only for AIX and Linux. This patch will also apply to jdk12.

I running a build to verify there are no other missing definitions for BSD_PPC.
Comment 40 Curtis Hamilton 2019-05-03 13:14:15 UTC
Recommend configuring with "--disable-warnings-as-errors" when using gcc.  There are a several warnings that will cause the build to fail.  One seems to be an inherent issues with gcc string handling.

Ref: https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00609.html
Comment 41 Francis Little 2019-05-03 14:35:58 UTC
With the patch for INCLUDE_RTM_OPT and --disable-warnings-as-errors, I am back to this error:

/usr/bin/printf "* For target buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch:\n"
* For target buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/make-support/failure-logs/buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch.log || true) | /usr/bin/head -n 12
Failed to create server process: Cannot run program "/usr/local/openjdk11/bin/java": error=13, Permission denied
IOException caught during compilation: java.io.IOException: Cannot run program "/usr/local/openjdk11/bin/java": error=13, Permission denied
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/make-support/failure-logs/buildtools_jdk_tools_classes__the.BUILD_TOOLS_JDK_batch.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi
/usr/bin/printf "\n* All command lines available in /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/make-support/failure-logs.\n"

* All command lines available in /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/make-support/failure-logs.
/usr/bin/printf "=== End of repeated output ===\n"
=== End of repeated output ===
if /usr/bin/grep -q "recipe for target .* failed" /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/build.log 2> /dev/null; then /usr/bin/printf "\n=== Make failed targets repeated here ===\n" ; /usr/bin/grep "recipe for target .* failed" /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/build.log ; /usr/bin/printf "=== End of repeated output ===\n" ; /usr/bin/printf "\nHint: Try searching the build log for the name of the first failed target.\n" ; else /usr/bin/printf "\nNo indication of failed target found.\n" ; /usr/bin/printf "Hint: Try searching the build log for '] Error'.\n" ; fi

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
/usr/bin/printf "Hint: See doc/building.html#troubleshooting for assistance.\n\n"
Hint: See doc/building.html#troubleshooting for assistance.

gmake[2]: Leaving directory '/root/jdk/openjdk-jdk11u-patched'
gmake[1]: *** [/root/jdk/openjdk-jdk11u-patched/make/Init.gmk:305: main] Error 2
gmake[1]: Leaving directory '/root/jdk/openjdk-jdk11u-patched'
gmake: *** [/root/jdk/openjdk-jdk11u-patched/make/Init.gmk:186: images] Error 2
Comment 42 Curtis Hamilton 2019-05-03 16:14:02 UTC
(In reply to Francis Little from comment #41)
I encountered the following error during my build:

Compiling management_ext.c (for libmanagement_ext.so)
In file included from /usr/ports/tmp/openjdk-jdk11u/src/jdk.management/bsd/native/libmanagement_ext/UnixOperatingSystem.c:29:
/usr/include/sys/sysctl.h:1047:25: error: unknown type name 'u_int'; did you mean 'jint'?
 int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
                         ^~~~~
                         jint
cd /usr/ports/tmp/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/support/modules_libs/jdk.management.agent && /usr/bin/objcopy --add-gnu-debuglink=/usr/ports/tmp/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/support/modules_libs/jdk.management.agent/libmanagement_agent.debuginfo /usr/ports/tmp/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/support/modules_libs/jdk.management.agent/libmanagement_agent.so
/usr/ports/tmp/openjdk-jdk11u/src/jdk.management/bsd/native/libmanagement_ext/UnixOperatingSystem.c: In function 'Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0':
/usr/ports/tmp/openjdk-jdk11u/src/jdk.management/bsd/native/libmanagement_ext/UnixOperatingSystem.c:111:9: warning: implicit declaration of function 'sysctl'; did you mean 'syscall'? [-Wimplicit-function-declaration]
     if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) {
         ^~~~~~
         syscall
/usr/bin/strip -g /usr/ports/tmp/openjdk-jdk11u/build/bsd-ppc64-normal-server-release/support/modules_libs/jdk.management.agent/libmanagement_agent.so
gmake[3]: *** [Lib-jdk.management.gmk:49: 

To get pass this I added "sys/types.h" to UnixOperatingSystem.c, before sys/sysctl.h.  Not sure this is the right fix, but it lets me get pass this error to completion.

I configured using '--with-boot-jdk=/usr/local/openjdk11 --disable-ccache --enable-dtrace=no --disable-warnings-as-errors --disable-hotspot-gtest --with-alsa=/usr/local --with-cups=/usr/local --with-fontconfig=/usr/local --with-freetype=system --with-freetype-include=/usr/local/include/freetype2 --with-freetype-lib=/usr/local/lib --with-milestone=fcs --with-libjpeg=system --with-giflib=system --with-libpng=system --with-zlib=system --with-lcms=system --with-toolchain-type=gcc --x-includes=/usr/local/include --x-libraries=/usr/local/lib --with-debug-level=release'
Comment 43 Greg Lewis freebsd_committer 2019-05-03 16:57:49 UTC
(In reply to Francis Little from comment #41)

Francis, try

chmod a+x /usr/local/openjdk11/lib/jspawnhelper

and see if that fixes the permissions issue.
Comment 44 Greg Lewis freebsd_committer 2019-05-03 17:02:01 UTC
(In reply to Curtis Hamilton from comment #42)

<sys/types.h> for u_int looks like the right header to me.
Comment 45 Greg Lewis freebsd_committer 2019-05-03 17:07:43 UTC
(In reply to Curtis Hamilton from comment #39)

On x86, all operating systems have INCLUDE_RTM_OPT defined:

#if defined(COMPILER2)
// Include Restricted Transactional Memory lock eliding optimization
#define INCLUDE_RTM_OPT 1
#endif

Is there a reason to not define this on FreeBSD/ppc64?  Note that AIX and Linux are currently the only other PPC supporting OSes for JDK, so I'm questioning why this is restricted to them.
Comment 46 Gustavo Romero 2019-05-03 17:13:42 UTC
(In reply to Greg Lewis from comment #45)

Hi Curtis,

RTM (on PPC64 aka HTM, Hardware Transactional Memory) is not supported on FreeBSD. It's necessary a kernel support for the feature besides the availability in the CPU for that feature.

Breno Leitao was working but the work got stuck and I don't think he will resume the work any time soon.
Comment 47 Curtis Hamilton 2019-05-03 19:16:00 UTC
(In reply to Gustavo Romero from comment #46)

In that case the patch is correct in setting RTM to 0 (false).
Comment 48 Gustavo Romero 2019-05-03 19:22:19 UTC
(In reply to Curtis Hamilton from comment #47)

Yes, that's my understanding too.
Comment 49 Francis Little 2019-05-03 21:45:06 UTC
(In reply to Greg Lewis from comment #43)

So with fixing the permission: chmod a+x /usr/local/openjdk11/lib/jspawnhelper

Adding <sys/types.h> to UnixOperatingSystem.c

Installing ports/audio/alsa-lib (got an error missing the header)

the build has completed:

----- Build times -------
Start 2019-05-03 21:52:14
End   2019-05-03 22:32:40

00:40:26 TOTAL
-------------------------
if test -f /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/make-support/exit-with-error ; then \
    exit 1 ; \
  fi
/usr/bin/printf "Finished building target 'images' in configuration 'bsd-ppc64-normal-server-release'\n" > >(/usr/bin/tee -a /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/build.log) 2> >(/usr/bin/tee -a /root/jdk/openjdk-jdk11u-patched/build/bsd-ppc64-normal-server-release/build.log >&2) && wait
Finished building target 'images' in configuration 'bsd-ppc64-normal-server-release'
gmake[1]: Leaving directory '/root/jdk/openjdk-jdk11u-patched'

root@PowerMacG5:~/jdk/openjdk-jdk11u-patched # ./build/bsd-ppc64-normal-server-release/images/jdk/bin/java --version
openjdk 11.0.3-internal 2019-04-16
OpenJDK Runtime Environment (build 11.0.3-internal+0-adhoc.root.openjdk-jdk11u-patched)
OpenJDK 64-Bit Server VM (build 11.0.3-internal+0-adhoc.root.openjdk-jdk11u-patched, mixed mode)
Comment 50 commit-hook freebsd_committer 2019-05-17 04:16:13 UTC
A commit references this bug:

Author: glewis
Date: Fri May 17 04:15:30 UTC 2019
New revision: 501834
URL: https://svnweb.freebsd.org/changeset/ports/501834

Log:
  Update to 11.0.3.7.2 which includes powerpc64 support.

  PR:		237208

Changes:
  head/java/openjdk11/Makefile
  head/java/openjdk11/distinfo
Comment 51 Francis Little 2019-05-17 08:24:49 UTC
(In reply to commit-hook from comment #50)

Hi, the Makefile still has

ONLY_FOR_ARCHS= amd64 i386

so fails on powerpc64
Comment 52 mikael.urankar 2019-05-17 09:51:05 UTC
Created attachment 204422 [details]
patch

regen after ports r501834
Comment 53 Greg Lewis freebsd_committer 2019-05-19 16:47:23 UTC
This updated to a source code base that support powerpc64.  There are some changes to the port itself necessary for powerpc64 support that still need to be made.
Comment 54 Greg Lewis freebsd_committer 2019-05-29 06:17:53 UTC
Created attachment 204682 [details]
Changes for openjdk11/Makefile

I'd propose the following change to openjdk11/Makefile instead.  This uses the COMPILER_TYPE variable to determine whether to use gcc or clang rather than the architecture.  Since the differences are all based on gcc vs clang it seemed to be better to base them on that rather than ARCH.
Comment 55 Mark Millard 2019-05-29 08:09:11 UTC
Comment on attachment 204682 [details]
Changes for openjdk11/Makefile

(In reply to Greg Lewis from comment #54)

If powerpc64 FreeBSD is constructed such that base/binutils and
base/gcc supply the system compiler, it will still be using
the system libc++ / libcxxrt instead of libstdc++ , despite a
gcc compiler type.

That will not mix well with, say, lang/gcc8 based materials
that are based on its libstdc++ when some involved libraries
from ports are built by the system cc/c++ and involve c++
library code.

It is the same sort of mix occurs for system-clang-8 as the
system cc/c++ when some ports libraries involving c++ library
code are built by clang and others are built byt the likes of
lang/gcc8 via USE_GCC is use. A recent example was (note the
use of both libstdc++ and libc++ / libcxxrt in the first two):

# ldd /usr/local/lib/qt5/bin/qlalr
/usr/local/lib/qt5/bin/qlalr:
	libQt5Core.so.5 => /usr/local/lib/qt5/libQt5Core.so.5 (0x8100b1000)
	libstdc++.so.6 => /usr/local/lib/gcc8/libstdc++.so.6 (0x81085e000)
	libc.so.7 => /lib/libc.so.7 (0x810ab7000)
	libkvm.so.7 => /lib/libkvm.so.7 (0x810e1c000)
	libprocstat.so.1 => /usr/lib/libprocstat.so.1 (0x810e41000)
	libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x810e5e000)
	libz.so.6 => /lib/libz.so.6 (0x810e71000)
	libicui18n.so.64 => /usr/local/lib/libicui18n.so.64 (0x810e9d000)
	libicuuc.so.64 => /usr/local/lib/libicuuc.so.64 (0x8112ac000)
	libpcre2-16.so.0 => /usr/local/lib/libpcre2-16.so.0 (0x81151e000)
	libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x8115ce000)
	libm.so.5 => /lib/libm.so.5 (0x81172e000)
	libgcc_s.so.1 => /usr/local/lib/gcc8/libgcc_s.so.1 (0x811765000)
	libthr.so.3 => /lib/libthr.so.3 (0x81178e000)
	libelf.so.2 => /lib/libelf.so.2 (0x8117d7000)
	libutil.so.9 => /lib/libutil.so.9 (0x811804000)
	libicudata.so.64 => /usr/local/lib/libicudata.so.64 (0x81182e000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x81183f000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x811958000)
	libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x81198a000)
	libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x811a9c000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x811b45000)

# ldd /usr/local/lib/qt5/libQt5Core.so.5
/usr/local/lib/qt5/libQt5Core.so.5:
	libkvm.so.7 => /lib/libkvm.so.7 (0x8113ad000)
	libprocstat.so.1 => /usr/lib/libprocstat.so.1 (0x8113d2000)
	libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x8113ef000)
	libz.so.6 => /lib/libz.so.6 (0x811402000)
	libicui18n.so.64 => /usr/local/lib/libicui18n.so.64 (0x81142e000)
	libicuuc.so.64 => /usr/local/lib/libicuuc.so.64 (0x81183d000)
	libpcre2-16.so.0 => /usr/local/lib/libpcre2-16.so.0 (0x811aaf000)
	libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x811b5f000)
	libstdc++.so.6 => /usr/local/lib/gcc8/libstdc++.so.6 (0x811cbf000)
	libm.so.5 => /lib/libm.so.5 (0x811f18000)
	libgcc_s.so.1 => /usr/local/lib/gcc8/libgcc_s.so.1 (0x811f4f000)
	libthr.so.3 => /lib/libthr.so.3 (0x811f78000)
	libc.so.7 => /lib/libc.so.7 (0x810071000)
	libelf.so.2 => /lib/libelf.so.2 (0x811fc1000)
	libutil.so.9 => /lib/libutil.so.9 (0x811fee000)
	libicudata.so.64 => /usr/local/lib/libicudata.so.64 (0x812018000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x812029000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x812142000)
	libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x812174000)
	libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x812286000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x81232f000)

The libc++/libcxxrt use comes from libraries built with the
system c++ compiler toolchain instead of a lang/gcc* via
USE_GCC:

# ldd /usr/local/lib/libicui18n.so.64
/usr/local/lib/libicui18n.so.64:
	libicuuc.so.64 => /usr/local/lib/libicuuc.so.64 (0x81100f000)
	libicudata.so.64 => /usr/local/lib/libicudata.so.64 (0x811281000)
	libthr.so.3 => /lib/libthr.so.3 (0x811292000)
	libm.so.5 => /lib/libm.so.5 (0x8112db000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x811312000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x81142b000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x81145d000)
	libc.so.7 => /lib/libc.so.7 (0x810071000)

# ldd /usr/local/lib/libicuuc.so.64
/usr/local/lib/libicuuc.so.64:
	libicudata.so.64 => /usr/local/lib/libicudata.so.64 (0x810e72000)
	libthr.so.3 => /lib/libthr.so.3 (0x810e83000)
	libm.so.5 => /lib/libm.so.5 (0x810ecc000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x810f03000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x81101c000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x81104e000)
	libc.so.7 => /lib/libc.so.7 (0x810071000)

By contrast, /usr/local/lib/qt5/libQt5Core.so.5 were built
via a lang/gcc* . As was /usr/local/lib/qt5/bin/qlalr .

The end result was that /usr/local/lib/qt5/bin/qlalr crashed
very early in its startup.

However, even the gcc 4.2.1 based system toolchain has the issue
of the version mismatch of its libstdc++ vs. one from the likes
of a lang/gcc* . This type of mismatch might lead to problems as
well.

All the involved libraries that in turn involve a c++ standard
library need to have been built by the same toolchain (including
an appropriate vintage match). This is so they are all using the
same c++ standard library. (Messy.)
Comment 56 mikael.urankar 2019-05-29 10:11:30 UTC
(In reply to Greg Lewis from comment #54)
dtrace is only a problem on ppc64/aarch64. It should be possible to build jdk11/dtrace with gcc on amd64.
Why do we need USE_CLANG? I can't find a reference of it in /usr/ports/Mk or java/openjdk11/work/*
Don't forget to update ONLY_FOR_ARCH.

Otherwise I agree with your change.
Comment 57 mikael.urankar 2019-06-28 14:22:07 UTC
bootstrap for ELFv2, built with gcc8 and this patch:

--- make/autoconf/flags-cflags.m4.orig	2019-06-27 11:02:48.894038000 +0200
+++ make/autoconf/flags-cflags.m4	2019-06-27 11:03:12.271242000 +0200
@@ -744,7 +744,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
       if test "x$FLAGS_CPU" = xppc64; then
         # -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
         # Use ppc64 instructions, but schedule for power5
-        $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5"
+        $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=powerpc64 -mtune=power5"
       elif test "x$FLAGS_CPU" = xppc64le; then
         # Little endian machine uses ELFv2 ABI.
         # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.


http://mikael.urankar.free.fr/FreeBSD/powerpc64/bootstrap-openjdk11-powerpc64-11.0.2.9.2_elfv2.tar.xz
Comment 58 commit-hook freebsd_committer 2019-08-25 20:22:49 UTC
A commit references this bug:

Author: glewis
Date: Sun Aug 25 20:22:06 UTC 2019
New revision: 509854
URL: https://svnweb.freebsd.org/changeset/ports/509854

Log:
  Add support for powerpc64

  PR:		237208

Changes:
  head/java/bootstrap-openjdk11/Makefile
  head/java/bootstrap-openjdk11/distinfo
Comment 59 commit-hook freebsd_committer 2019-08-25 20:28:52 UTC
A commit references this bug:

Author: glewis
Date: Sun Aug 25 20:28:47 UTC 2019
New revision: 509855
URL: https://svnweb.freebsd.org/changeset/ports/509855

Log:
  Add support for powerpc64

  PR:		237208

Changes:
  head/java/openjdk11/Makefile
  head/java/openjdk11/files/patch-src_jdk.hotspot.agent_bsd_native_libsaproc_ps__proc.c
Comment 60 Greg Lewis freebsd_committer 2019-08-25 20:40:34 UTC
Support tested with FreeBSD 11 and gcc 8.x.  No testing yet with FreeBSD 12 or gcc 9.x.  Please reopen if you see problems with either of those.