eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.27k stars 721 forks source link

Building for Fedora #16869

Open shanemikel opened 1 year ago

shanemikel commented 1 year ago

I'm trying to build openj9 for current Fedora (37). I'm starting with the openj9-openjdk-jdk17 distribution. I see the latest Dockerfiles are generated for ubuntu18 and centos7. In both of those, gcc7 is used. I would like to use current gcc (on Fedora 37: gcc12) and build without docker if possible to ease packaging.

So I am using the Dockerfiles to figure out dependencies and building on host with ./configure && make. OMR is failing compile here:

g++  -I. -I../../include_core -I../../nls -DLINUX -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DJ9HAMMER -c -MMD -MP -fno-strict-aliasing -std=c++0x -fno-exceptions -fno-rtti -fno-threadsafe-statics -fPIC -ggdb -m64 -Wreturn-type -Werror -Wall -Wno-non-virtual-dtor -O3 -fno-strict-aliasing   -o CFileWriter.o CFileWriter.cpp
CFileWriter.cpp: In member function ‘RCType CFileWriter::writeOutputFiles(J9TDFOptions*, J9TDFFile*, J9TDFGroup*, unsigned int)’:
CFileWriter.cpp:141:23: error: pointer ‘fd’ may be used after ‘int fclose(FILE*)’ [-Werror=use-after-free]
  141 |                 fclose(fd);
      |                 ~~~~~~^~~~
CFileWriter.cpp:125:32: note: call to ‘int fclose(FILE*)’ here
  125 |                 if (0 == fclose(fd)) {
      |                          ~~~~~~^~~~
cc1plus: all warnings being treated as errors

I can successfully build OMR by disabling -Werror (with CFLAGS=-Wno-error and CXXFLAGS=-Wno-error). However, I can't figure out how to propagate those options from the openj9-openjdk-jdk17 build system...

Any help is greatly appreciated.

shanemikel commented 1 year ago

I should add that to get to this point I modified omr/cmake/modules/FindLibDwarf.cmake to find the libdwarf.h header installed in Fedora at /usr/include/libdwarf-0:

diff --git a/cmake/modules/FindLibDwarf.cmake b/cmake/modules/FindLibDwarf.cmake
index dd84e0b04..e1b9f4064 100644
--- a/cmake/modules/FindLibDwarf.cmake
+++ b/cmake/modules/FindLibDwarf.cmake
@@ -86,7 +86,9 @@ set(LIBDWARF_H_DEFINITIONS)
 set(LIBDWARF_H_FOUND false)
 set(LIBDWARF_H_INCLUDE_DIRS)

-find_path(LIBDWARF_H_INCLUDE_DIR "libdwarf.h")
+find_path(LIBDWARF_H_INCLUDE_DIR "libdwarf.h"
+       HINT "/usr/include/*"
+)

 if(LIBDWARF_H_INCLUDE_DIR)
        list(APPEND LIBDWARF_H_INCLUDE_DIRS "${LIBDWARF_H_INCLUDE_DIR}")
@@ -94,14 +96,6 @@ if(LIBDWARF_H_INCLUDE_DIR)
        set(LIBDWARF_H_FOUND true)
 endif()

-find_path(LIBDWARF_LIBDWARF_H_INCLUDE_DIR "libdwarf/libdwarf.h")
-
-if(LIBDWARF_LIBDWARF_H_INCLUDE_DIR)
-       list(APPEND LIBDWARF_H_INCLUDE_DIRS "${LIBDWARF_LIBDWARF_H_INCLUDE_DIR}")
-       list(APPEND LIBDWARF_H_DEFINITIONS HAVE_LIBDWARF_LIBDWARF_H)
-       set(LIBDWARF_H_FOUND true)
-endif()
-
 if(NOT LIBDWARF_H_FOUND)
        set(LIBDWARF_H_FOUND false)
        set(LIBDWARF_H_INCLUDE_DIRS NOTFOUND)

Passing CFLAGS and CXXFLAGS to the parent project's configure script yields this complaint:

WARNING: Ignoring CFLAGS(-Wno-error) found in environment. Use --with-extra-cflags
WARNING: Ignoring CXXFLAGS(-Wno-error) found in environment. Use --with-extra-cxxflags
WARNING: The following variables might be unknown to configure:  CFLAGS  CXXFLAGS 

--with-extra-cflags and --with-extra-cxxflags don't appear to be propagating down to the OMR build configuration:

$ ./configure --with-extra-cflags=-Wno-error --with-extra-cxxflags=-Wno-error && make clean images
configure: Configuration created at Thu Mar  9 06:28:07 UTC 2023.
checking for basename... /usr/bin/basename
checking for dirname... /usr/bin/dirname
checking for file... /usr/bin/file
checking for ldd... /usr/bin/ldd
checking for bash... /usr/bin/bash
checking for cat... /usr/bin/cat
checking for chmod... /usr/bin/chmod
checking for cp... /usr/bin/cp
checking for cut... /usr/bin/cut
checking for date... /usr/bin/date
checking for gdiff... [not found]
checking for diff... /usr/bin/diff
checking for echo... echo [builtin]
checking for expr... /usr/bin/expr
checking for find... /usr/bin/find
checking for gunzip... /usr/bin/gunzip
checking for pigz... /usr/bin/pigz
checking for head... /usr/bin/head
checking for ln... /usr/bin/ln
checking for ls... /usr/bin/ls
checking for gmkdir... [not found]
checking for mkdir... /usr/bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /usr/bin/mv
checking for gawk... /usr/bin/gawk
checking for printf... printf [builtin]
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for sh... /usr/bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... /usr/bin/gtar
checking for tee... /usr/bin/tee
checking for touch... /usr/bin/touch
checking for tr... /usr/bin/tr
checking for uname... /usr/bin/uname
checking for wc... /usr/bin/wc
checking for xargs... /usr/bin/xargs
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for a sed that does not truncate output... /usr/bin/sed
checking for df... /usr/bin/df
checking for nice... /usr/bin/nice
checking for greadlink... [not found]
checking for readlink... /usr/bin/readlink
checking for cygpath... [not found]
checking for wslpath... [not found]
checking for lsb_release... [not found]
checking for cmd.exe... [not found]
checking for cmp... /usr/bin/cmp
checking for uniq... /usr/bin/uniq
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking openjdk-build os-cpu... linux-x86_64
checking openjdk-build C library... gnu
checking openjdk-target os-cpu... linux-x86_64
checking openjdk-target C library... gnu
checking compilation type... native
checking for top-level directory... /var/home/core/src/openj9-openjdk-jdk17
checking if custom source is suppressed (openjdk-only)... disabled, default
checking for --enable-debug... disabled, default
checking which debug level to use... release
checking which variants of the JVM to build... server
checking for m4... /usr/bin/m4
checking for cmake... /usr/bin/cmake
checking for CRIU support... yes (default)
checking for cuda... no (default)
checking for ddr... yes (default for xa64)
checking if demos should be included in jdk image... no
checking checking for numa... yes
checking if OMR compile warnings are considered errors... yes (default)
checking if OpenJ9 native compile warnings are considered errors... yes (default)
checking for jitserver... yes (default)
checking for inline types... no (default)
checking for nasm... /usr/bin/nasm
checking whether nasm version requirement is met... yes
checking if absolute paths should be allowed in the build output... no, release build
checking for sysroot... 
checking for toolchain path... 
checking for extra path... 
checking where to store configuration... in default location
checking what configuration name to use... linux-x86_64-server-release
checking for zypper... [not found]
checking for apt-get... [not found]
checking for yum... /usr/bin/yum
checking for pandoc... [not found]
checking for gmake... /usr/bin/gmake
configure: Testing potential make at /usr/bin/gmake, found using gmake in PATH
configure: Using GNU make at /usr/bin/gmake (version: GNU Make 4.3)
checking if make --output-sync is supported... yes
checking for make --output-sync value... none, default
checking if find supports -delete... yes
checking what type of tar was found... gnu
checking that grep (/usr/bin/grep) -Fx handles empty lines in the pattern list correctly... yes
checking for unzip... /usr/bin/unzip
checking for zip... /usr/bin/zip
checking for greadelf... [not found]
checking for readelf... /usr/bin/readelf
checking for dot... [not found]
checking for hg... [not found]
checking for git... /usr/bin/git
checking for stat... /usr/bin/stat
checking for time... time [builtin]
checking for flock... /usr/bin/flock
checking for dtrace... /usr/bin/dtrace
checking for gpatch... [not found]
checking for patch... /usr/bin/patch
checking if date is a GNU compatible version... yes
checking for ulimit... ulimit [builtin]
checking bash version... 5.2.9
checking if bash supports pipefail... yes
checking if bash supports errexit (-e)... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for default LOG value... 
checking if packaged modules are kept... enabled, default
checking for version string... 17.0.7-internal+0-adhoc.core.openj9-openjdk-jdk17
checking for javac... /usr/bin/javac
checking for java... /usr/bin/java
configure: Found potential Boot JDK using java(c) in PATH
checking for Boot JDK... /usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64
checking Boot JDK version... openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (Red_Hat-17.0.6.0.10-1.fc37) (build 17.0.6+10) OpenJDK 64-Bit Server VM (Red_Hat-17.0.6.0.10-1.fc37) (build 17.0.6+10, mixed mode, sharing)
checking for java [Boot JDK]... $BOOT_JDK/bin/java
checking for javac [Boot JDK]... $BOOT_JDK/bin/javac
checking for javadoc [Boot JDK]... $BOOT_JDK/bin/javadoc
checking for jar [Boot JDK]... $BOOT_JDK/bin/jar
checking if Boot JDK jar supports --date=TIMESTAMP... true
checking if Boot JDK is 32 or 64 bits... 64
checking for local Boot JDK Class Data Sharing (CDS)... yes, created
checking for Build JDK... yes, will use output dir
checking for docs-reference JDK... no, using interim javadoc for the docs-reference targets
checking if we should build headless-only (no GUI)... disabled, default
checking if linker should clean out unused code (linktime-gc)... disabled, default
checking for graphviz dot... no, cannot generate full docs
checking for pandoc... no, cannot generate full docs
checking for --enable-full-docs... disabled, from default 'auto'
checking for cacerts file... default
checking for cacerts source... default
checking for --enable-unlimited-crypto... enabled, default
checking for jni library path... default
checking if static build is available... no
checking if static build is enabled... disabled, default
configure: Using default toolchain gcc (GNU Compiler Collection)
checking for gcc... /usr/bin/gcc
checking resolved symbolic links for CC... no symlink
configure: Using gcc C compiler version 12.2.1 [gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)]
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to enable C11 features... none needed
checking for g++... /usr/bin/g++
checking resolved symbolic links for CXX... no symlink
configure: Using gcc C++ compiler version 12.2.1 [g++ (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)]
checking whether the compiler supports GNU C++... yes
checking whether /usr/bin/g++ accepts -g... yes
checking for /usr/bin/g++ option to enable C++11 features... none needed
checking how to run the C preprocessor... /usr/bin/gcc -E
checking how to run the C++ preprocessor... /usr/bin/g++ -E
configure: Using gcc linker version 2.38 [GNU ld version 2.38-25.fc37]
configure: comparing linker version to minimum version 2.25
checking for ar... /usr/bin/ar
checking for strip... /usr/bin/strip
checking for nm... /usr/bin/nm
checking for gobjcopy... [not found]
checking for objcopy... /usr/bin/objcopy
checking for gobjdump... [not found]
checking for objdump... /usr/bin/objdump
checking for c++filt... /usr/bin/c++filt
checking for jtreg... [not found]
checking for jtreg test harness... no, not found
checking for jmh (Java Microbenchmark Harness)... no, disabled
checking for jib... no
checking if @file is supported by gcc... yes
checking if CC supports "-m64"... yes
checking if CXX supports "-m64"... yes
checking if both CC and CXX support "-m64"... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for stdio.h... (cached) yes
checking size of int *... 8
checking for target address size... 64 bits
checking whether byte ordering is bigendian... no
checking what source date to use... determined at build time, from 'updated'
checking for --enable-reproducible-build... disabled, default
checking if CC supports "-fdebug-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking if CXX supports "-fdebug-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking if both CC and CXX support "-fdebug-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking for --enable-warnings-as-errors... enabled, default
checking if CC supports "-Xassembler -mrelax-relocations=no"... yes
checking if CXX supports "-Xassembler -mrelax-relocations=no"... yes
checking if both CC and CXX support "-Xassembler -mrelax-relocations=no"... yes
checking if TARGET is x86... no
checking if CC supports "-fno-delete-null-pointer-checks"... yes
checking if CXX supports "-fno-delete-null-pointer-checks"... yes
checking if both CC and CXX support "-fno-delete-null-pointer-checks"... yes
checking if CC supports "-fno-lifetime-dse"... yes
checking if CXX supports "-fno-lifetime-dse"... yes
checking if both CC and CXX support "-fno-lifetime-dse"... yes
checking if CC supports "-fmacro-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking if CXX supports "-fmacro-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking if both CC and CXX support "-fmacro-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking how to prevent absolute paths in output... using compiler options
checking if CC supports "-ffp-contract=off"... yes
checking if CXX supports "-ffp-contract=off"... yes
checking if both CC and CXX support "-ffp-contract=off"... yes
checking if BUILD is x86... no
checking if BUILD_CC supports "-fno-delete-null-pointer-checks"... yes
checking if BUILD_CXX supports "-fno-delete-null-pointer-checks"... yes
checking if both BUILD_CC and BUILD_CXX support "-fno-delete-null-pointer-checks"... yes
checking if BUILD_CC supports "-fno-lifetime-dse"... yes
checking if BUILD_CXX supports "-fno-lifetime-dse"... yes
checking if both BUILD_CC and BUILD_CXX support "-fno-lifetime-dse"... yes
checking if BUILD_CC supports "-fmacro-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking if BUILD_CXX supports "-fmacro-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking if both BUILD_CC and BUILD_CXX support "-fmacro-prefix-map=/var/home/core/src/openj9-openjdk-jdk17/="... yes
checking how to prevent absolute paths in output... using compiler options
checking if BUILD_CC supports "-ffp-contract=off"... yes
checking if BUILD_CXX supports "-ffp-contract=off"... yes
checking if both BUILD_CC and BUILD_CXX support "-ffp-contract=off"... yes
checking what type of native debug symbols to use... external
checking if we should add external native debug symbols to the shipped bundles... no
checking if native coverage is available... yes
checking for --enable-native-coverage... disabled, default
checking if AddressSanitizer (asan) is available... yes
checking for --enable-asan... disabled, default
checking if static link of stdc++ is possible... yes
checking how to link with libstdc++... static
checking for X... libraries , headers 
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for X11/extensions/shape.h... yes
checking for X11/extensions/Xrender.h... yes
checking for X11/extensions/XTest.h... yes
checking for X11/Intrinsic.h... yes
checking for X11/extensions/Xrandr.h... yes
checking for cups/cups.h... yes
checking for cups/ppd.h... yes
checking for fontconfig/fontconfig.h... yes
checking for FREETYPE... yes
checking for freetype... yes (using pkg-config)
Using freetype: system
checking for ALSA... yes
checking for --enable-libffi-bundling... disabled, default
checking for which libjpeg to use... bundled
checking for which giflib to use... bundled
checking for PNG... yes
checking for which libpng to use... bundled
checking for compress in -lz... yes
checking for which zlib to use... system
checking for system zlib functionality... ok
checking for which lcms to use... bundled
checking for which harfbuzz to use... bundled
checking for cos in -lm... yes
checking for dlopen in -ldl... yes
checking for JVM features enabled by the user... none
checking for JVM features disabled by the user... none
checking if platform is supported by CDS... yes
checking if JVM feature 'cds' is available... yes
checking for dtrace tool... /usr/bin/dtrace
checking for sys/sdt.h... yes
checking if JVM feature 'dtrace' is available... yes
checking if platform is supported by JFR... yes
checking if JVM feature 'jfr' is available... yes
checking if platform is supported by JVMCI... yes
checking if JVM feature 'jvmci' is available... yes
checking if platform is supported by Shenandoah... yes
checking if JVM feature 'shenandoahgc' is available... yes
checking if static-build is enabled in configure... no, use --enable-static-build to enable static build.
checking if JVM feature 'static-build' is available... no
checking if platform is supported by ZGC... yes
checking if JVM feature 'zgc' is available... yes
checking JVM features to use for variant 'server'... 'cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs zgc'
checking if the jtreg failure handler is available... no (jtreg not present)
checking if the jtreg failure handler should be built... disabled, from default 'auto'
checking if the CDS classlist generation should be enabled... enabled, from default 'auto'
checking if any translations should be excluded... no
checking if static man pages should be copied... enabled, default
checking if CDS archive is available... yes
checking if a default CDS archive should be generated... enabled, from default 'auto'
checking if CDS archive is available... yes
checking if compatible cds region alignment enabled... disabled, default
checking for number of cores... 8
checking for memory size... 15612 MB
checking for appropriate number of jobs to run in parallel... 8
checking whether to use javac server... enabled, default
checking flags for boot jdk java command ...  -Duser.language=en -Duser.country=US  -XX:+UnlockDiagnosticVMOptions -XX:-VerifySharedSpaces -XX:SharedArchiveFile=/var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/configure-support/classes.jsa -Xshare:auto 
checking flags for boot jdk java command for big workloads...  -Xms64M -Xmx1600M
checking flags for bootcycle boot jdk java command for big workloads... -Xms64M -Xmx1600M
checking flags for boot jdk java command for small workloads...  -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
checking for --enable-icecc... disabled, default
checking if precompiled headers are available... yes
checking for --enable-precompiled-headers... enabled, from default 'auto'
checking for ccache... [not found]
checking if ccache is available... no, ccache binary missing or not executable
checking if ccache is enabled... disabled, default
checking if build directory is on local disk... yes
configure: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/configure-support/config.status
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/spec.gmk
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/bootcycle-spec.gmk
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/buildjdk-spec.gmk
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/compare.sh
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/Makefile
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/custom-spec.gmk
config.status: creating /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/toolchain.cmake

====================================================
The existing configuration has been successfully updated in
/var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release
using configure arguments '--with-extra-cflags=-Wno-error --with-extra-cxxflags=-Wno-error'.

Configuration summary:
* Name:           linux-x86_64-server-release
* Debug level:    release
* HS debug level: product
* JVM variants:   server
* JVM features:   server: 'cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs zgc' 
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 17.0.7-internal+0-adhoc.core.openj9-openjdk-jdk17 (17.0.7-internal)

Tools summary:
* Boot JDK:       openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (Red_Hat-17.0.6.0.10-1.fc37) (build 17.0.6+10) OpenJDK 64-Bit Server VM (Red_Hat-17.0.6.0.10-1.fc37) (build 17.0.6+10, mixed mode, sharing) (at /usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64)
* Toolchain:      gcc (GNU Compiler Collection)
* C Compiler:     Version 12.2.1 (at /usr/bin/gcc)
* C++ Compiler:   Version 12.2.1 (at /usr/bin/g++)

Build performance summary:
* Cores to use:   8
* Memory limit:   15612 MB

WARNING: The result of this configuration has overridden an older
configuration. You *should* run 'make clean' to make sure you get a
proper build. Failure to do so might result in strange build problems.

Building targets 'clean images' in configuration 'linux-x86_64-server-release'
Cleaning vm build artifacts ... done
Cleaning hotspot build artifacts ... done
Cleaning jdk build artifacts ... done
Cleaning bootcycle-build build artifacts ... done
Cleaning test-results build artifacts ... done
Cleaning test-support build artifacts ... done
Cleaning test build artifacts ... done
Cleaning buildtools build artifacts ... done
Cleaning support build artifacts ... done
Cleaning support/images build artifacts ... done
Cleaning images build artifacts ... done
Cleaning make-support build artifacts ... done
Cleaning test-make build artifacts ... done
Cleaning bundles build artifacts ... done
Cleaning buildjdk build artifacts ... done
Cleaned all build artifacts.
Building OpenJ9 Java Preprocessor
Building /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9tools/jpp.jar
Generating J9JCL sources
/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64/bin/java -cp /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9tools/jpp.jar -Dfile.encoding=US-ASCII com.ibm.jpp.commandline.CommandlineBuilder -verdict -config JAVA17 -baseDir /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/ -srcRoot overlay/ -xml /var/home/core/src/openj9-openjdk-jdk17/openj9/jcl/jpp_configuration.xml -dest /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9jcl -tag:define CRIU_SUPPORT;PLATFORM-xa64 -includeIfUnsure -noWarnIncludeIf
Reading preprocess instructions from xml...
[builder] 
Preprocessing /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/overlay/src
[builder] 9 of 9 file(s) included in preprocess
[builder] PREPROCESS WAS SUCCESSFUL
/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64/bin/java -cp /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9tools/jpp.jar -Dfile.encoding=US-ASCII com.ibm.jpp.commandline.CommandlineBuilder -verdict -config JAVA17 -baseDir /var/home/core/src/openj9-openjdk-jdk17/ -srcRoot closed/ -xml /var/home/core/src/openj9-openjdk-jdk17/openj9/jcl/jpp_configuration.xml -dest /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9jcl -tag:define CRIU_SUPPORT;PLATFORM-xa64 -includeIfUnsure -noWarnIncludeIf
Reading preprocess instructions from xml...
[builder] 
Preprocessing /var/home/core/src/openj9-openjdk-jdk17/closed/src
[builder] 56 of 56 file(s) included in preprocess
[builder] PREPROCESS WAS SUCCESSFUL
/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64/bin/java -cp /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9tools/jpp.jar -Dfile.encoding=US-ASCII com.ibm.jpp.commandline.CommandlineBuilder -verdict -config JAVA17 -baseDir /var/home/core/src/openj9-openjdk-jdk17/openj9/ -srcRoot jcl/ -xml /var/home/core/src/openj9-openjdk-jdk17/openj9/jcl/jpp_configuration.xml -dest /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9jcl -tag:define CRIU_SUPPORT;PLATFORM-xa64
Reading preprocess instructions from xml...
[builder] 
Preprocessing /var/home/core/src/openj9-openjdk-jdk17/openj9/jcl/src
[preprocessor] No INCLUDE-IF directives found.  File will be EXCLUDED
    file: /var/home/core/src/openj9-openjdk-jdk17/openj9/jcl/src/java.base/share/classes/java/lang/about.html
    line: 1 (char 0 to 109)
[builder] 1017 of 1126 file(s) included in preprocess
[msg] Messages written to "/var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9jcl/java.base/share/classes/com/ibm/oti/util/ExternalMessages.properties
[builder] PREPROCESS WAS SUCCESSFUL
Generating DDR_VM sources
/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64/bin/java -cp /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9tools/jpp.jar -Dfile.encoding=US-ASCII com.ibm.jpp.commandline.CommandlineBuilder -verdict -config GENERIC -baseDir /var/home/core/src/openj9-openjdk-jdk17/openj9/debugtools/DDR_VM/ -srcRoot src/ -xml /var/home/core/src/openj9-openjdk-jdk17/openj9/jcl/jpp_configuration.xml -dest /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/support/j9jcl/openj9.dtfj/share/classes -tag:define CRIU_SUPPORT;PLATFORM-xa64 -includeIfUnsure -noWarnIncludeIf -macro:define JAVA_SPEC_VERSION=17
Reading preprocess instructions from xml...
[builder] 
Preprocessing /var/home/core/src/openj9-openjdk-jdk17/openj9/debugtools/DDR_VM/src/.
[builder] 826 of 827 file(s) included in preprocess
[builder] PREPROCESS WAS SUCCESSFUL
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Parsing 2 properties into enum-like class for jdk.compiler
Compiling 7 properties into resource bundles for jdk.jshell
Compiling 16 properties into resource bundles for jdk.compiler
Compiling 13 properties into resource bundles for jdk.javadoc
Compiling 12 properties into resource bundles for jdk.jdeps
loading initial cache file /var/home/core/src/openj9-openjdk-jdk17/openj9/runtime/cmake/caches/linux_x86-64_mxdptrs.cmake
-- The C compiler identification is GNU 12.2.1
-- The CXX compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
Compiling 127 files for BUILD_java.compiler.interim
Compiling 402 files for BUILD_jdk.compiler.interim
Compiling 229 files for BUILD_jdk.javadoc.interim
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using BOOT_JDK: '/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64'
CMake Deprecation Warning at runtime/CMakeLists.txt:34 (cmake_policy):
  The OLD behavior for policy CMP0079 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- OMR: The CPU architecture is x86
-- OMR: The OS is linux
-- OMR: The tool configuration is gnu
-- OMR: The target data size is 64
-- Looking for sem_init
-- Looking for sem_init - found
-- Looking for dladdr
-- Looking for dladdr - found
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- OMR: trace root is '/var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/vm/runtime'
-- Starting with CMake version 3.26.0-rc4
-- Found Git: /usr/bin/git (found version "2.38.1") 
-- Found LibZ: /usr/lib64/libz.so  
-- Found LibElf: /usr/lib64/libelf.so  
-- Found LibDwarf: /usr/lib64/libdwarf.so  
-- Performing Test ALLOWS_STATIC_LIBCPP
-- Performing Test ALLOWS_STATIC_LIBCPP - Success
-- Found Perl: /usr/bin/perl (found version "5.36.0") 
-- The ASM_NASM compiler identification is NASM
-- Found assembler: /usr/bin/nasm
-- JITServer is enabled
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "3.0.8")  
-- Creating shared library for j9jit
-- Adding PRIVATE compiler options to j9jit for j9jit.
-- Configuring done (1.0s)
-- Generating done (0.5s)
CMake Warning:
  Manually-specified variables were not used by the project:

    OPENJDK_VERSION_NUMBER_FOUR_POSITIONS

-- Build files have been written to: /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/vm
Compiling OpenJ9 in /var/home/core/src/openj9-openjdk-jdk17/build/linux-x86_64-server-release/vm
  Source version info:
    openjdk - 1a49d73523b
    openj9  - 5a4ab5377
    omr     - d5af8d16e
[  0%] Building Java objects for objectmodel.jar
[  0%] Building Java objects for j9nls.jar
[  0%] Building CXX object runtime/omr/third_party/pugixml-1.5/CMakeFiles/pugixml.dir/pugixml.cpp.o
[  0%] Building CXX object runtime/omr/tools/tracegen/CMakeFiles/trace.dir/ArgParser.cpp.o
[  0%] Generating redirector/generated.c
[  0%] Built target copy_default_options
[  0%] Built target header_check
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/ClassType.cpp.o
[  0%] Building CXX object runtime/omr/ddr/test/CMakeFiles/ddrgentest.dir/test_subdir/testFileInSubDir.cpp.o
[  0%] Building CXX object runtime/omr/ddr/test/CMakeFiles/ddrgentest.dir/sample1.cpp.o
[  0%] Generating j9vm/generated.h
[  0%] Building CXX object runtime/omr/tools/tracegen/CMakeFiles/trace.dir/CFileWriter.cpp.o
[  0%] Generating include/jni.h
[  0%] Generating include/jvmti.h
[  0%] Built target j9vm_m4gen
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/closures.c.o
/var/home/core/src/openj9-openjdk-jdk17/omr/tools/tracegen/CFileWriter.cpp: In member function 'RCType CFileWriter::writeOutputFiles(J9TDFOptions*, J9TDFFile*, J9TDFGroup*, unsigned int)':
/var/home/core/src/openj9-openjdk-jdk17/omr/tools/tracegen/CFileWriter.cpp:141:23: error: pointer 'fd' may be used after 'int fclose(FILE*)' [-Werror=use-after-free]
  141 |                 fclose(fd);
      |                 ~~~~~~^~~~
/var/home/core/src/openj9-openjdk-jdk17/omr/tools/tracegen/CFileWriter.cpp:125:32: note: call to 'int fclose(FILE*)' here
  125 |                 if (0 == fclose(fd)) {
      |                          ~~~~~~^~~~
cc1plus: all warnings being treated as errors
gmake[6]: *** [runtime/omr/tools/tracegen/CMakeFiles/trace.dir/build.make:90: runtime/omr/tools/tracegen/CMakeFiles/trace.dir/CFileWriter.cpp.o] Error 1
gmake[5]: *** [CMakeFiles/Makefile2:3569: runtime/omr/tools/tracegen/CMakeFiles/trace.dir/all] Error 2
gmake[5]: *** Waiting for unfinished jobs....
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/debug.c.o
/var/home/core/src/openj9-openjdk-jdk17/openj9/runtime/libffi/closures.c: In function 'dlmmap_locked':
/var/home/core/src/openj9-openjdk-jdk17/openj9/runtime/libffi/closures.c:495:7: warning: ignoring return value of 'ftruncate' declared with attribute 'warn_unused_result' [-Wunused-result]
  495 |       ftruncate (execfd, offset);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/var/home/core/src/openj9-openjdk-jdk17/openj9/runtime/libffi/closures.c:507:7: warning: ignoring return value of 'ftruncate' declared with attribute 'warn_unused_result' [-Wunused-result]
  507 |       ftruncate (execfd, offset);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
[  0%] Building CXX object runtime/omr/ddr/test/CMakeFiles/ddrgentest.dir/sample2.cpp.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/java_raw_api.c.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/prep_cif.c.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/raw_api.c.o
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/ClassUDT.cpp.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/types.c.o
[  0%] Building CXX object runtime/omr/ddr/test/CMakeFiles/ddrgentest.dir/sample3.cpp.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/tramp.c.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/x86/ffiw64.c.o
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/EnumMember.cpp.o
[  0%] Building C object runtime/libffi/CMakeFiles/ffi.dir/x86/ffi64.c.o
[  0%] Building ASM object runtime/libffi/CMakeFiles/ffi.dir/x86/unix64.S.o
[  0%] Building C object runtime/omr/ddr/test/CMakeFiles/ddrgentest.dir/sample4.c.o
[  0%] Building ASM object runtime/libffi/CMakeFiles/ffi.dir/x86/win64.S.o
[  0%] Building CXX object runtime/omr/ddr/test/CMakeFiles/ddrgentest.dir/test.cpp.o
[  0%] Linking CXX executable ../../../ddrgentest
[  0%] Building ASM object runtime/libffi/CMakeFiles/ffi.dir/x86/sysv.S.o
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/EnumUDT.cpp.o
[  0%] Linking C static library ../lib/libffi.a
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/Field.cpp.o
[  0%] Built target ddrgentest
[  0%] Copying com/ibm/j9tools/om/io/messages.properties to the build directory
[  0%] Copying com/ibm/j9tools/om/messages.properties to the build directory
[  0%] Built target ffi
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/Macro.cpp.o
[  0%] Copying schema/archive-v1.xsd to the build directory
[  0%] Copying schema/build-v1.xsd to the build directory
[  0%] Copying schema/build-v2.xsd to the build directory
[  0%] Copying schema/build-v3.xsd to the build directory
[  0%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/Members.cpp.o
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[  0%] Copying schema/build-v4.xsd to the build directory
[  1%] Copying schema/build-v5.xsd to the build directory
[  1%] Copying schema/build-v6.xsd to the build directory
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/Modifiers.cpp.o
[  1%] Copying schema/feature-v1.xsd to the build directory
[  1%] Generating CMakeFiles/j9nls.dir/java_class_filelist
[  1%] Copying schema/feature-v2.xsd to the build directory
[  1%] Creating Java archive j9nls.jar
[  1%] Copying schema/flags-v1.xsd to the build directory
[  1%] Copying schema/spec-v1.xsd to the build directory
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/NamespaceUDT.cpp.o
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/Symbol_IR.cpp.o
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/TextFile.cpp.o
[  1%] Built target j9nls
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/Type.cpp.o
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/TypedefUDT.cpp.o
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/UDT.cpp.o
[  1%] Generating CMakeFiles/objectmodel.dir/java_class_filelist
[  1%] Creating Java archive om.jar
[  1%] Built target objectmodel
[  1%] Building CXX object runtime/omr/ddr/lib/ddr-ir/CMakeFiles/omr_ddr_ir.dir/UnionUDT.cpp.o
[  1%] Linking CXX static library ../../../../lib/libomr_ddr_ir.a
[  1%] Built target omr_ddr_ir
[  1%] Linking CXX static library ../../../lib/libpugixml.a
[  1%] Built target pugixml
gmake[4]: *** [Makefile:136: all] Error 2
gmake[3]: *** [/var/home/core/src/openj9-openjdk-jdk17/closed/OpenJ9.gmk:521: build-j9] Error 2
gmake[2]: *** [/var/home/core/src/openj9-openjdk-jdk17/closed/custom/Main.gmk:51: j9vm-build] Error 2
gmake[2]: *** Waiting for unfinished jobs....

ERROR: Build failed for targets 'clean images' in configuration 'linux-x86_64-server-release' (exit code 2) 

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See doc/building.html#troubleshooting for assistance.

make[1]: *** [/var/home/core/src/openj9-openjdk-jdk17/make/Init.gmk:316: main] Error 2
make: *** [/var/home/core/src/openj9-openjdk-jdk17/make/Init.gmk:186: clean] Error 2
FireMasterK commented 1 year ago

Hi, I built the JRE on centos stream 9, which fails due to the same error.

You can workaround this, by using an older version, like so: https://github.com/FireMasterK/openj9-docker/blob/e9f499c654fabdca6cd59910d60eae412967858d/Dockerfile#L74

shanemikel commented 1 year ago

Yes maybe I will try that, but I need this to be a maintainable, distributable prebuilt package going forward, so this needs fixing.

It looks like I might need an old version of gcc anyway, so if there are no linking issues on gcc12+ systems I suppose it's not the end of the world to bootstrap with gcc7. Will need to package and build gcc7 from source if there's any hope of submission to fedora or centos upstream.

Should ideally be able to bootstrap with current gcc though .

I saw there are some openj9 packages for RHEL (8 I think), but they are for openjdk8 and 11 only. I'll probably download the srpms to take a look anyway.

BTW what version of OpenJDK are you using with openj9 on Stream?

FireMasterK commented 1 year ago

I'm using openjdk 18 as a bootjdk, I'm building Java 19 with openj9.

shanemikel commented 1 year ago

Thanks

pshipton commented 1 year ago

Have you tried fixing the code? I expect you can assign fd to NULL around line 128.

Also I'm curious, does the OpenJ9 build provided not work on Fedora? It's built on an old OS using glibc 2.17 and expected to work anywhere with a more current glibc level. Fedora isn't explicitly listed as supported because it's not tested.