Bug 239368 - java/openjdk8: fix build on GCC architectures
Summary: java/openjdk8: fix build on GCC architectures
Status: New
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 mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-21 20:49 UTC by Piotr Kubaj
Modified: 2019-08-05 04:12 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

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 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 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 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 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 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 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 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.