adoptium / temurin-build

Eclipse Temurin™ build scripts - common across all releases/versions
Apache License 2.0
1.03k stars 249 forks source link

OpenJDK build system needs to be adapted for Sun Solaris/SmartOS #113

Closed neomatrix369 closed 5 years ago

neomatrix369 commented 7 years ago

OpenJDK build on SmartOS fails (see https://ci.adoptopenjdk.net/job/openjdk_build_x86-64_smartOS/26/console) to a few reasons.

Platform info: SunOS build-joyent-x64-smartOS-14-1 5.11 joyent_20170315T185612Z i86pc i386 i86pc Solaris

In order for it to build this patch needs applying:

--- a/hotspot/make/solaris/makefiles/build_vm_def.sh
+++ b/hotspot/make/solaris/makefiles/build_vm_def.sh
@@ -1,6 +1,6 @@
 #!/bin/sh

-/usr/ccs/bin/nm -p $* \
+/opt/local/bin/nm -p $* \
     | awk '{
           if ($2 == "U") next
           if ($3 ~ /^__1c.*__vtbl_$/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";"
diff --git a/hotspot/make/solaris/makefiles/sparcWorks.make b/hotspot/make/solaris/makefiles/sparcWorks.make
index cff57a2..a58428b 100644
--- a/hotspot/make/solaris/makefiles/sparcWorks.make
+++ b/hotspot/make/solaris/makefiles/sparcWorks.make
@@ -112,7 +112,7 @@ ARCHFLAG_OLD/sparcv9 = -xarch=v9
 ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc
 ARCHFLAG_OLD/i486    =
 ARCHFLAG_NEW/i486    = -m32
-ARCHFLAG_OLD/amd64   = -xarch=amd64
+ARCHFLAG_OLD/amd64   = -march=amdfam10
 ARCHFLAG_NEW/amd64   = -m64

 # Select the ARCHFLAGs and other SS12 (5.9) options

But then come across this other error:

Compiling /home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk/hotspot/src/share/vm/runtime/vm_version.cpp
Linking vm...
ld: warning: symbol '__JvmOffsets' has differing types:
        (file JvmOffsets.o type=OBJT; file dtrace.o type=FUNC);
ld: warning: symbol 'CodeCache::_heap' has differing types:
        (file codeCache.o type=OBJT; file dtrace.o type=FUNC);
ld: warning: symbol 'BufferBlob::__vtbl' has differing types:
        (file codeBlob.o type=OBJT; file dtrace.o type=FUNC);
ld: warning: symbol 'Method::__vtbl' has differing types:
        (file dtrace.o type=FUNC; file method.o type=OBJT);
ld: warning: symbol 'nmethod::__vtbl' has differing types:
        (file dtrace.o type=FUNC; file nmethod.o type=OBJT);
ld: warning: symbol 'Universe::_collectedHeap' has differing types:
        (file dtrace.o type=FUNC; file universe.o type=OBJT);
BFD: libjvm.debuginfo: Not enough room for program headers, try linking with -N
/opt/local/bin//gobjcopy:libjvm.debuginfo[.note]: Bad value
BFD: libjvm.debuginfo: Not enough room for program headers, try linking with -N
/opt/local/bin//gobjcopy:libjvm.debuginfo: Bad value
/home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk/hotspot/make/solaris/makefiles/vm.make:296: recipe for target 'libjvm.so' failed
gmake[6]: *** [libjvm.so] Error 1
/home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk/hotspot/make/solaris/makefiles/top.make:112: recipe for target 'the_vm' failed
gmake[5]: *** [the_vm] Error 2
/home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk/hotspot/make/solaris/Makefile:226: recipe for target 'product' failed
gmake[4]: *** [product] Error 2
Makefile:230: recipe for target 'generic_build2' failed
gmake[3]: *** [generic_build2] Error 2
Makefile:177: recipe for target 'product' failed
gmake[2]: *** [product] Error 2
HotspotWrapper.gmk:44: recipe for target '/home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk/build/solaris-x86_64-normal-server-release/hotspot/_hotspot.timestamp' failed
gmake[1]: *** [/home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk/build/solaris-x86_64-normal-server-release/hotspot/_hotspot.timestamp] Error 2
/home/jenkins/workspace/openjdk_build_x86-64_smartOS/openjdk//make/Main.gmk:108: recipe for target 'hotspot-only' failed
make: *** [hotspot-only] Error 2

This is a bug with the build system itself for Solaris Sparc platform, see https://bugs.openjdk.java.net/browse/JDK-8033602, was reported and resolved but seems to still occur.

We could try to manually patch the .stab.index in (never done this before) - but would like to try to avoid more yak-shaving.

I think we might need to ask the OpenJDK team to patch the needed changes and wait for the bug to be resolved.

neomatrix369 commented 7 years ago

Report with build-dev and build-infra teams of the OpenJDK team, see http://mail.openjdk.java.net/pipermail/build-infra-dev/2017-May/004571.html.

karianna commented 7 years ago

Sounds like we need to downgrade the toolkit:

From David Holmes:

root/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/prod/bin/CC)

The official toolset for 8u is SS12u1, so using 12u3 may encounter 
problems ...
gdams commented 7 years ago

makes sense, I did notice that but was unable to locate SS12u1

neomatrix369 commented 7 years ago

@gdams any news from Joyent to request them for a bit older SmartOS?

rmustacc commented 7 years ago

Hi, this was pointed to us in the illumos community. For what it's worth, we don't build with Sun Studio at all and instead we patch OpenJDK to build with gcc related flags in pkgsrc and other places.

cburroughs commented 7 years ago

I can provide a little more context. I have a background in Java programming, but not developing OpenJDK itself. I spent a week trying to build openjdk8 on old SmartOS images and would love this to be easier.

As rmustacc, said the userland in SmartOS is built via pkgsrc using GCC (there is also in-progress support for clang). pkgsrc is similar to popular Linux package managers, but instead of being the defining characteristic of a distro, pkgsrc runs on multiple operating systems. The set of patches for openjdk8 is at https://github.com/joyent/pkgsrc/tree/pkgsrc-2017Q3/lang/openjdk8/patches. OpenIndiana (another illumos distribution) has what I believe are a substantially similar [set])(https://github.com/OpenIndiana/oi-userland/tree/oi/hipster/components/runtime/openjdk-8/patches). I believe at least some of these patches conflict with ones that appear to be in the dev branch of AdoptOpenJDK/openjdk-jdk8u, but I have not tracked down the details. It is possible that AdoptOpenJDK also ran into and patched similar issues.

I'm afraid you are unlikely to have much luck with Sun Studio as you would be effectively the only ones trying to build with that combination. For gcc I'm not sure if the right path forward to copying those patches into AdoptOpenJDK or pushing them all the way upstream. Obviously in the long term reducing duplicated effort would benefit everyone.

Note that to create a binary that can run a variety of base SmartOS images and not be bound to a particular one (like the "Linux x64" binary that isn't just tied -- for example -- Debian-7) you would want to bundle non-core libraries. Since you are able to create a near universal Linux x64 binary I presume the openjdk build system already has everything you need there. Writing java

I hope that gives a little more context on the ecosystem. Please let me know if there are things I can help clarify.

karianna commented 5 years ago

We have Solaris Spac v9 builds on the website, closing this.