Bug 239368 - java/openjdk8: fix build on GCC architectures
Summary: java/openjdk8: fix build on GCC architectures
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-java (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-21 20:49 UTC by Piotr Kubaj
Modified: 2019-11-06 17:39 UTC (History)
3 users (show)

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


Attachments
patch (984 bytes, patch)
2019-07-21 20:49 UTC, Piotr Kubaj
no flags Details | Diff
fail log (5.96 KB, text/plain)
2019-07-22 08:23 UTC, Piotr Kubaj
no flags Details
v2 (6.94 KB, patch)
2019-07-22 18:16 UTC, Piotr Kubaj
pkubaj: maintainer-approval? (java)
Details | Diff
Disable mfdscr on FreeBSD 12 for openjdk11 (1.21 KB, patch)
2019-10-23 20:08 UTC, Greg Lewis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2019-07-21 20:49:22 UTC
Created attachment 205978 [details]
patch

In hotspot/agent/src/os/bsd/ps_proc.c move include sys/sysctl.h after include sys/types.h.

Otherwise build fails with:
/usr/include/sys/sysctl.h:1062: error: expected declaration specifiers or '...' before 'u_int'
Comment 1 Piotr Kubaj freebsd_committer freebsd_triage 2019-07-22 08:23:07 UTC
Created attachment 205986 [details]
fail log

It looks like even though openjdk8 itself builds with this patch, ports using java now fail to build, e.g. graphics/batik:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x000000081224b41c, pid=78786, tid=0x0000000000018962
#
# JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10)
# Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode bsd-ppc64 compressed oops)
# Problematic frame:
# v  ~StubRoutines::jlong_disjoint_arraycopy
#
# Core dump written. Default location: /usr/local/poudriere/ports/default/graphics/batik/work/batik-1.7/java.core
#
# An error report file with more information is saved as:
# /usr/local/poudriere/ports/default/graphics/batik/work/batik-1.7/hs_err_pid78786.log
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2019-07-22 09:35:18 UTC
The cause is one of updates to hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp. I'll try to bisect.
Comment 3 Piotr Kubaj freebsd_committer freebsd_triage 2019-07-22 18:16:46 UTC
Created attachment 205995 [details]
v2

This patch fixes things on powerpc64.

Note that files/patch-hotspot_src_cpu_ppc_vm_stubGenerator__ppc.cpp should only be necessary on 11 and 12 (stable/12 should have fix for mfdscr issue in near future).
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-07-24 23:29:49 UTC
A commit references this bug:

Author: glewis
Date: Wed Jul 24 23:29:40 UTC 2019
New revision: 507305
URL: https://svnweb.freebsd.org/changeset/ports/507305

Log:
  Fix the build for powerpc64

  PR:		239368
  Submitted by:	pkubaj

Changes:
  head/java/openjdk8/files/patch-hotspot_agent_src_os_bsd_ps__proc.c
  head/java/openjdk8/files/patch-hotspot_src_cpu_ppc_vm_stubGenerator__ppc.cpp
Comment 5 Greg Lewis freebsd_committer freebsd_triage 2019-07-24 23:33:08 UTC
I have upstreamed the change to ps_proc.c.  I've concerns about the patch to stubGenerator_ppc.cpp though in that it deletes code which other OSes may be using.  Would it work if we instead just set has_mfdscr() to return false on FreeBSD?
Comment 6 Piotr Kubaj freebsd_committer freebsd_triage 2019-07-25 07:44:35 UTC
(In reply to Greg Lewis from comment #5)
The change to stubGenerator_ppc.cpp is because of a bug in stable/12 (and it apparently won't be fixed in 12 because of KBI breakage by the fix). It's already fixed in head.

11 also has this bug, but POWER processors that support mfdscr don't work in 11 (only since 12).

So this bug really applies only to 12. You could set has_mfdscr() to false, but only on FreeBSD 12.
Comment 7 Piotr Kubaj freebsd_committer freebsd_triage 2019-10-23 17:07:30 UTC
(In reply to Greg Lewis from comment #5)
Since new OpenJDK doesn't build on stable/12, can you make has_mfdscr() return false on 12?

OpenJDK8 builds, the problem is with 11 and 12 (and probably 13).
Comment 8 Greg Lewis freebsd_committer freebsd_triage 2019-10-23 19:28:57 UTC
I am looking at that and also at rebuilding the bootstrap for openjdk11 since it is causing issues on 12.x as well.
Comment 9 Greg Lewis freebsd_committer freebsd_triage 2019-10-23 20:08:35 UTC
Created attachment 208537 [details]
Disable mfdscr on FreeBSD 12 for openjdk11
Comment 10 Greg Lewis freebsd_committer freebsd_triage 2019-10-23 20:11:12 UTC
I don't have a powerpc64 12.x box at the moment.  Piotr, can you give the patch I just attached a test compile if you do?  I'll work on building the bootstrap with that applied as well.  Particularly interested on testing this on a POWER8 or higher to see if it has the desired effect.
Comment 11 Greg Lewis freebsd_committer freebsd_triage 2019-10-24 23:22:06 UTC
The bootstrap at http://distcache.freebsd.org/local-distfiles/glewis/bootstrap-openjdk11/bootstrap-openjdk11-powerpc64-11.0.5.tar.xz may also be necessary to compile openjdk11 on POWER8+.  Note that URL is certainly temporary.  Once I've got some confirmation that we have a working set up I'll get the port ready to go.
Comment 12 Mark Linimon freebsd_committer freebsd_triage 2019-10-25 02:54:18 UTC
(In reply to Greg Lewis from comment #10)

> I don't have a powerpc64 12.x box at the moment.  Piotr, can you give the patch
> I just attached a test compile if you do?

I do not have access to a 12.x box either but I can confirm it "does no harm" on 13-CURRENT.
Comment 13 Greg Lewis freebsd_committer freebsd_triage 2019-10-26 09:29:06 UTC
(In reply to Mark Linimon from comment #12)

Thanks Mark, that's a useful data point.  Just need to hear from someone with a 12.x POWER8+ box then.
Comment 14 commit-hook freebsd_committer freebsd_triage 2019-11-06 17:19:42 UTC
A commit references this bug:

Author: glewis
Date: Wed Nov  6 17:19:31 UTC 2019
New revision: 516905
URL: https://svnweb.freebsd.org/changeset/ports/516905

Log:
  Update bootstrap for openjdk11

  * Re-roll bootstrap binaries.  The main reason for this is that the
    previous binaries won't work correctly on a FreeBSD 12/powerpc64
    POWER8+ machine.

  PR:		239368

Changes:
  head/java/bootstrap-openjdk11/Makefile
  head/java/bootstrap-openjdk11/distinfo
  head/java/bootstrap-openjdk11/pkg-message
  head/java/bootstrap-openjdk11/pkg-plist
Comment 15 commit-hook freebsd_committer freebsd_triage 2019-11-06 17:22:44 UTC
A commit references this bug:

Author: glewis
Date: Wed Nov  6 17:21:59 UTC 2019
New revision: 516906
URL: https://svnweb.freebsd.org/changeset/ports/516906

Log:
  Fix build on FreeBSD 12.x/powerpc64 on POWER8+ machines

  * Make sure has_mfdscr() returns false on these machines as using it on
    FreeBSD 12.x will cause problems (e.g. SIGILL).

  PR:		239368

Changes:
  head/java/openjdk11/Makefile
  head/java/openjdk11/files/extra-patch-src_hotspot_cpu_ppc_vm__version__ppc.hpp
Comment 16 commit-hook freebsd_committer freebsd_triage 2019-11-06 17:31:46 UTC
A commit references this bug:

Author: glewis
Date: Wed Nov  6 17:31:34 UTC 2019
New revision: 516907
URL: https://svnweb.freebsd.org/changeset/ports/516907

Log:
  Fix build on FreeBSD 12.x/powerpc64 on POWER8+ machines

  * Make sure has_mfdscr() returns false on these machines as using it on
    FreeBSD 12.x will cause problems (e.g. SIGILL).

  PR:		239368
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/java/openjdk12/Makefile
  head/java/openjdk12/files/extra-patch-src_hotspot_cpu_ppc_vm__version__ppc.hpp
Comment 17 commit-hook freebsd_committer freebsd_triage 2019-11-06 17:35:47 UTC
A commit references this bug:

Author: glewis
Date: Wed Nov  6 17:35:05 UTC 2019
New revision: 516908
URL: https://svnweb.freebsd.org/changeset/ports/516908

Log:
  Fix build on FreeBSD 12.x/powerpc64 on POWER8+ machines

  * Make sure has_mfdscr() returns false on these machines as using it on
    FreeBSD 12.x will cause problems (e.g. SIGILL).

  PR:		239368
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/java/openjdk13/Makefile
  head/java/openjdk13/files/extra-patch-src_hotspot_cpu_ppc_vm__version__ppc.hpp
Comment 18 Greg Lewis freebsd_committer freebsd_triage 2019-11-06 17:39:07 UTC
The latest commits should fix this for all remaining versions of jdk