OpenJDK9 build failure

Tiago Stürmer Daitx tdaitx at br.ibm.com
Wed Jun 25 18:18:01 UTC 2014


Adding hotspot-dev to the thread.

On Wed, 2014-06-18 at 11:52 -0300, Tiago Sturmer Daitx wrote:

tl;dr I have had problems building JDK9 due to -Werror=format flag on gcc/g++ 4.8.2
and also due to hotspot/agent/src/os/linux/libproc.h including
linux/ptrace.h instead of sys/ptrace.h


I have been trying to build JDK9 from
http://hg.openjdk.java.net/jdk9/dev (or /hs-comp or /jdk9) and JDK8u
from http://hg.openjdk.java.net/jdk8u/jdk8u/

First, I'm seeing the following on JDK9 only:


/usr/bin/g++ -DLINUX -D_GNU_SOURCE -DPPC64 -DPRODUCT -I.
-I/home/tdaitx/jdk9-dev/hotspot/src/share/vm/prims
-I/home/tdaitx/jdk9-dev/hotspot/sr
c/share/vm -I/home/tdaitx/jdk9-dev/hotspot/src/share/vm/precompiled
-I/home/tdaitx/jdk9-dev/hotspot/src/cpu/ppc/vm
-I/home/tdaitx/jdk9-dev/hot
spot/src/os_cpu/linux_ppc/vm
-I/home/tdaitx/jdk9-dev/hotspot/src/os/linux/vm
-I/home/tdaitx/jdk9-dev/hotspot/src/os/posix/vm -I../generated -D
HOTSPOT_BUILD_TARGET="\"product\"" -DHOTSPOT_BUILD_USER="\"tdaitx\""
-DHOTSPOT_LIB_ARCH=\"ppc64\" -DHOTSPOT_VM_DISTRO="\"OpenJDK\""
 -DTARGET_
OS_FAMILY_linux -DTARGET_ARCH_ppc -DTARGET_ARCH_MODEL_ppc_64
-DTARGET_OS_ARCH_linux_ppc -DTARGET_OS_ARCH_MODEL_linux_ppc_64
-DTARGET_COMPILER_
gcc -DCOMPILER2 -fPIC -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new
-fvisibility=hidden -m64 -DCC_INTERP -pipe -fno-strict-aliasing  -fno
-omit-frame-pointer -O3   -g -D_LP64=1 -mminimal-toc -mcpu=powerpc64
-mtune=power5 -minsert-sched-nops=regroup_exact -mno-multiple
-mno-string
 -Werror -Wpointer-arith -Wsign-compare -Wundef -Wunused-function
-Wunused-value -Wformat=2   -Wno-strict-aliasing -Werror
-DDTRACE_ENABLED -c
 -MMD -MP -MF ../generated/dependencies/bytecodes.o.d -fpch-deps -o
bytecodes.o /home/tdaitx/jdk9-dev/hotspot/src/share/vm/interpreter/bytecod
es.cpp 
Compiling /home/tdaitx/jdk9-dev/hotspot/src/cpu/ppc/vm/bytecodes_ppc.cpp
rm -f bytecodes_ppc.o
In file included
from /home/tdaitx/jdk9-dev/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp:31:0:
/home/tdaitx/jdk9-dev/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp: In static member function ‘static void BytecodeInterpreter::run(interpreterState)’:
/home/tdaitx/jdk9-dev/hotspot/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp:95:17: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘DataLayout*’ [-Werror=format=]
                 );       

Pasted at http://fpaste.org/110642/30430021/ (and there are many many lines with
similar errors until the build is aborted).

After ignoring the error ('CFLAGS="-Wno-error=format" make' or editing
make/linux/makefiles/gcc.make to remove "-Werror=format"), I get the
following on JDK9: 


Making SA debugger back-end...
/usr/bin/gcc -Dppc64 -D_GNU_SOURCE                   \
           -D_FILE_OFFSET_BITS=64                               \
                   -g -m64 -shared -fPIC     \
           -I/home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux
                             \
           -I../generated                                       \

 -I/home/tdaitx/build/jdk8-at60-power5/images/j2sdk-image/include
                   \

 -I/home/tdaitx/build/jdk8-at60-power5/images/j2sdk-image/include/linux
   \

\

 /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/salibelf.c /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/symtab.c /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/libproc_impl.c /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/ps_proc.c /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/ps_core.c /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c /home/tdaitx/jdk9-dev/hotspot/agent/src/share/native/sadis.c                                        \
           -Xlinker
--version-script=/home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/mapfile -Wl,--hash-style=both                                         \
                                              \
           -Wno-strict-aliasing -Werror
     \
           -o libsaproc.so
   \
           -lthread_db
In file included
from /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/libproc.h:37:0,

 from /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/libproc_impl.h:30,

 from /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/ps_proc.c:33:
/usr/include/linux/ptrace.h:58:8: error: redefinition of ‘struct
ptrace_peeksiginfo_args’
 struct ptrace_peeksiginfo_args {
        ^
In file included
from /home/tdaitx/jdk9-dev/hotspot/agent/src/os/linux/ps_proc.c:32:0:
/usr/include/sys/ptrace.h:161:8: note: originally defined here
 struct ptrace_peeksiginfo_args


Pasted at http://fpaste.org/110640/42657140/

For JDK8 see: http://fpaste.org/110638/40304229/

I see that both sys/ptrace.h and linux/ptrace.h have been included:

$ grep -r ptrace.h hotspot/
hotspot/agent/src/os/linux/ps_proc.c:#include <sys/ptrace.h>
hotspot/agent/src/os/linux/libproc.h:#include <linux/ptrace.h>

Usually linux/ptrace.h is used by glibc to do syscall, wile sys/ptrace.h
is used by app code to do library calls (thanks Maynard for the info).

After editing hotspot/agent/src/os/linux/libproc.h to use sys/ptrace.h
I'm able to build both JDK8 & JDK9.

Some settings:

JDK8 configure:
$ ./configure \
  --with-boot-jdk=/home/tdaitx/icedtea7/openjdk.build/j2sdk-image/ \
  --with-jvm-variants=server --with-jvm-interpreter=cpp \
  --with-extra-cflags=-Wno-strict-aliasing

JDK9 configure is similar but I point it to a JDK8 build.

Make for JDK8 and JDK9:
$ make JOBS=8 LOG=debug



$ /usr/bin/gcc -v  # g++ is the same, except for COLLECT_GCC
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/ppc64-redhat-linux/4.8.2/lto-wrapper
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c
++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--disable-libjava-multilib
--with-isl=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-ppc64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-ppc64-redhat-linux/cloog-install --enable-secureplt --with-long-double-128 --build=ppc64-redhat-linux
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC) 

$ cat /etc/redhat-release 
Fedora release 20 (Heisenbug)

$ rpm -qf /usr/include/linux/ptrace.h 
kernel-headers-3.14.5-200.fc20.ppc64p7

$ rpm -qf /usr/include/sys/ptrace.h
glibc-headers-2.18-12.fc20.ppc64p7

Let me know if you need any additional info.

Regards,
Tiago

-- 
Tiago Stürmer Daitx
Linux Technology Center [LTC|IBM]
tdaitx at br.ibm.com



More information about the ppc-aix-port-dev mailing list