Bug 237370 - java/openjdk12: Add powerpc64 support
Summary: java/openjdk12: Add powerpc64 support
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 (Nobody)
URL:
Keywords: feature, needs-qa
Depends on:
Blocks:
 
Reported: 2019-04-18 21:42 UTC by Curtis Hamilton
Modified: 2019-08-26 02:49 UTC (History)
6 users (show)

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


Attachments
Patch to add powerpc64 support (86.38 KB, patch)
2019-04-18 21:42 UTC, Curtis Hamilton
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Hamilton 2019-04-18 21:42:17 UTC
Created attachment 203773 [details]
Patch to add powerpc64 support

Adds powerpc64 support.  

Uses bootstrap provided by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237208
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-21 05:04:35 UTC
@Curtis If bug 237208 needs to land before this can, please add it to the 'Depends on' field
Comment 2 Curtis Hamilton 2019-04-21 12:34:14 UTC
(In reply to Kubilay Kocak from comment #1)
Doesn't need bug 237208 to land, but uses the provided bootstrap.

http://mikael.urankar.free.fr/FreeBSD/powerpc64/bootstrap-openjdk11-powerpc64-11.0.2.9.2.tar.xz
Comment 3 Greg Lewis freebsd_committer freebsd_triage 2019-04-22 22:35:59 UTC
I'd prefer that instead of committing this directly to the FreeBSD port that we instead work this out on Github in the upstream repo.

I'm very open to a pull request there and have one from Mikael for openjdk11.  If you'd like to contribute to that or open a separate one for openjdk12 I'd be happy to merge it in and cut a release.

See https://github.com/battleblow/openjdk-jdk11u/pull/13 for the openjdk11 pull request.  I've asked for a few changes before merging it.
Comment 4 Gustavo Romero 2019-04-22 23:17:03 UTC
Hi folks,

Shouldn't we contribute to the OpenJDK upstream project?
Comment 5 Gustavo Romero 2019-04-22 23:18:18 UTC
(In reply to Gustavo Romero from comment #4)

Contribute Curti's patchset to OpenJDK tip then request a downport to 11 LTS I mean.
Comment 6 Curtis Hamilton 2019-04-26 01:41:26 UTC
I'll submit a pull request.  

However, the GitHub repo seems to be missing "src/jdk.hotspot.agent/bsd/native/libsaproc" directory and files.
Comment 7 Greg Lewis freebsd_committer freebsd_triage 2019-04-26 02:08:50 UTC
Thanks.  Please check the bsd-port branch.  That has all the changes for *BSD.  The master branch just tracks the upstream master.
Comment 8 Greg Lewis freebsd_committer freebsd_triage 2019-04-26 02:09:23 UTC
Which is to say that you'll find that directory if you switch to the bsd-port branch.
Comment 9 Curtis Hamilton 2019-04-26 13:00:06 UTC
Greg,  maybe I'm looking in the wrong place (http://hg.openjdk.java.net/bsd-port), but I don't see jdk11 nor jdk12.  

Nor do I see the bsd files in http://hg.openjdk.java.net/jdk-updates

Perhaps you can point me to the correct repo.
Comment 10 Mikael Urankar freebsd_committer freebsd_triage 2019-04-26 13:01:48 UTC
it's here https://github.com/battleblow/openjdk-jdk12u

git clone -b bsd-port https://github.com/battleblow/openjdk-jdk12u.git
Comment 11 Curtis Hamilton 2019-04-26 14:00:26 UTC
Pull request submitted.
Comment 12 Gustavo Romero 2019-04-26 14:48:24 UTC
Hi,

Curtis, I believe Greg e Mikael are talking only about OpenJDK code in FreeBSD port github (downstream) whilst I'm talking about the OpenJDK Mercurial repo in openjdk.java.net in fact (upstream) and trying to understand if you are planning to contribute the patcheset to that upstream OpenJDK repo (bsd port in Hg openjdk.java.net).

It looks like that the OpenJDK PPC64 BSD port effort/discussions upstream got stuck as per bsd port ML [0] (looks only a bunch of advertisement for last non-related pushes to jdk8u) and from what I remember from the last discussions more than a year ago on ppc-aix-port ML [1]. Hence I'm wondering what's your current understanding about it/plans, Curtis :)

Thank you.

[0] https://mail.openjdk.java.net/pipermail/bsd-port-dev/
[1] https://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/2016-December/002847.html
Comment 13 Curtis Hamilton 2019-04-26 16:32:13 UTC
(In reply to Gustavo Romero from comment #12)
Understood! My initial efforts back in 2016 were to provide the patches directly to openjdk.java.net. I may have even exchanged emails with you about including my patched in the ppc-aix-port back then. However, it was recommended that I provide my patches to the downstream bsd-port. So I worked with Greg to get the initial jdk8 patches committed. 

Greg and the maintainers of the bsd-port should decide whether to upstream the bsd-port (patches) to openjdk.java.net. These patches alone are incomplete.

Hope this helps.
Comment 14 Gustavo Romero 2019-04-26 21:19:39 UTC
(In reply to Curtis Hamilton from comment #13)
Got it, Curtis. It does help me to understand the current situation. Thank you!
Comment 15 Greg Lewis freebsd_committer freebsd_triage 2019-04-29 15:46:16 UTC
Just to confirm we're good to go, can someone please try a build of the bsd-port branch of https://github.com/battleblow/openjdk-jdk12u on powerpc64?  If that looks good then I'll make a release.
Comment 16 Greg Lewis freebsd_committer freebsd_triage 2019-04-29 15:55:35 UTC
In terms of where to upstream patches, it would likely take a dedicated developer several months to coordinate getting patches upstreamed to the Mercurial repository.  No one has stepped forward with that sort of time over the last few years since Java 8.

I've also noticed that it seems to limit collaboration since people have to sign an Oracle Contributor Agreement for us to upstream their patches and not as many people are familiar with Mercurial as they are Git.  The interface doesn't provide the same tooling that a site like Github does as well to enable easy forking and pull requests.  This has led to a lot of patches existing only in the FreeBSD port that were generally applicable.

For Java 11 I decided to try following the AdoptOpenJDK ports on Github.  So far this has been positive in terms of collaboration and ease of releases/port updates, at least from my perspective.  Ideally we'd still look to upstream these changes, but that will ultimately still require someone dedicated to doing so with sufficient time to make it happen.
Comment 17 Francis Little 2019-05-05 20:17:01 UTC
Tried a build of this on PPC (PowerMac), using the same build commands as with openjdk11 from the other bug.

Pulled the latest from the bsd-port branch.

I had to remove --with-milestone=fcs \ when running the configure as it says: configure: error: unrecognized options: --with-milestone

Removing that I can start the compile, but get errors:

=== Output from failing command(s) repeated here ===
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_classFileParser.o:\n"
* For target hotspot_variant-server_libjvm_objs_classFileParser.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk12u/build/bsd-ppc64-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_classFileParser.o.log || true) | /usr/bin/head -n 12
/root/jdk/openjdk-jdk12u/src/hotspot/share/classfile/classFileParser.cpp: In member function 'void ClassFileParser::prepend_host_package_name(const InstanceKlass*, Thread*)':
/root/jdk/openjdk-jdk12u/src/hotspot/share/classfile/classFileParser.cpp:5761:12: error: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
     strncpy(new_anon_name, host_pkg_name, host_pkg_len);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/jdk/openjdk-jdk12u/src/hotspot/share/classfile/classFileParser.cpp:5756:33: note: length computed here
     size_t host_pkg_len = strlen(host_pkg_name);
                           ~~~~~~^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk12u/build/bsd-ppc64-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_classFileParser.o.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_classLoaderExt.o:\n"
* For target hotspot_variant-server_libjvm_objs_classLoaderExt.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk12u/build/bsd-ppc64-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_classLoaderExt.o.log || true) | /usr/bin/head -n 12
/root/jdk/openjdk-jdk12u/src/hotspot/share/classfile/classLoaderExt.cpp: In static member function 'static void ClassLoaderExt::process_jar_manifest(ClassPathEntry*, bool)':
/root/jdk/openjdk-jdk12u/src/hotspot/share/classfile/classLoaderExt.cpp:212:16: error: 'char* strncat(char*, const char*, size_t)' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
         strncat(libname, file_start, name_len);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/jdk/openjdk-jdk12u/src/hotspot/share/classfile/classLoaderExt.cpp:206:33: note: length computed here
       int name_len = (int)strlen(file_start);
                           ~~~~~~^~~~~~~~~~~~
cc1plus: all warnings being treated as errors
if test `/usr/bin/wc -l < /root/jdk/openjdk-jdk12u/build/bsd-ppc64-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_classLoaderExt.o.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi
/usr/bin/printf "\n* All command lines available in /root/jdk/openjdk-jdk12u/build/bsd-ppc64-server-release/make-support/failure-logs.\n"
Comment 18 Curtis Hamilton 2019-05-06 13:38:08 UTC
(In reply to Francis Little from comment #17)
Ensure you configure with "--disable-warnings-as-errors", otherwise you'll encounter the string errors with gcc.
Comment 19 Francis Little 2019-05-06 16:37:21 UTC
(In reply to Curtis Hamilton from comment #18)

Hi, I get the following about missing alloca.h:

=== Output from failing command(s) repeated here ===
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_sharedRuntime_ppc.o:\n"
* For target hotspot_variant-server_libjvm_objs_sharedRuntime_ppc.o:
(/usr/bin/grep -v -e "^Note: including file:" <  /root/jdk/openjdk-jdk12u/build/bsd-ppc64-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_sharedRuntime_ppc.o.log || true) | /usr/bin/head -n 12
/root/jdk/openjdk-jdk12u/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp:50:10: fatal error: alloca.h: No such file or directory
 #include <alloca.h>
          ^~~~~~~~~~
compilation terminated.
Comment 20 Francis Little 2019-05-06 16:42:30 UTC
(In reply to Francis Little from comment #19)

So it looks like there is a fix in the above patch, is that to apply after the pull from the git repo or should it already be in there?
Comment 21 Curtis Hamilton 2019-05-06 18:40:42 UTC
(In reply to Francis Little from comment #20)
I just took a look at the repo and found 2 patches that seems to have been dropped for "src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp" and "src/hotspot/cpu/ppc/vm_version_ppc.cpp".

Just submitted a new PR to fix.
Comment 22 Greg Lewis freebsd_committer freebsd_triage 2019-05-06 18:54:46 UTC
I've merged the missing change from the openjdk11 repo.
Comment 23 Curtis Hamilton 2019-05-06 18:57:17 UTC
(In reply to Greg Lewis from comment #22)

Thanks Greg.
Comment 24 Francis Little 2019-05-06 19:53:16 UTC
Hi, the build has completed using the following:

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 \
        --disable-dtrace \
        --disable-warnings-as-errors \
        --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-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=gcc \
        --x-includes=/usr/local/include \
        --x-libraries=/usr/local/lib \
        --with-debug-level=release

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


root@PowerMacG5:~/jdk/openjdk-jdk12u # ./build/bsd-ppc64-server-release/jdk/bin/java --version
openjdk 12.0.1-internal 2019-04-16
OpenJDK Runtime Environment (build 12.0.1-internal+0-adhoc.root.openjdk-jdk12u)
OpenJDK 64-Bit Server VM (build 12.0.1-internal+0-adhoc.root.openjdk-jdk12u, mixed mode)
root@PowerMacG5:~/jdk/openjdk-jdk12u # ./build/bsd-ppc64-server-release/jdk/bin/javac --version
javac 12.0.1-internal
Comment 25 commit-hook freebsd_committer freebsd_triage 2019-05-17 04:33:31 UTC
A commit references this bug:

Author: glewis
Date: Fri May 17 04:32:41 UTC 2019
New revision: 501835
URL: https://svnweb.freebsd.org/changeset/ports/501835

Log:
  Update to 12.0.1.12.2 which includes powerpc64 support.

  PR:		237370

Changes:
  head/java/openjdk12/Makefile
  head/java/openjdk12/distinfo
Comment 26 commit-hook freebsd_committer freebsd_triage 2019-08-25 20:55:57 UTC
A commit references this bug:

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

Log:
  Allow the JDK to be compiled with gcc.

  This is required for powerpc64 support.

  PR:		237370

Changes:
  head/java/openjdk12/Makefile
Comment 27 commit-hook freebsd_committer freebsd_triage 2019-08-26 02:01:16 UTC
A commit references this bug:

Author: glewis
Date: Mon Aug 26 02:00:43 UTC 2019
New revision: 509861
URL: https://svnweb.freebsd.org/changeset/ports/509861

Log:
  Add powerpc64 support

  PR:		237370

Changes:
  head/java/openjdk12/Makefile
  head/java/openjdk12/files/patch-src_jdk.hotspot.agent_bsd_native_libsaproc_ps__proc.c