On Wed, Jan 22, 2020 at 2:30 PM Waldek Kozaczuk <[email protected]> wrote:
> > > On Wednesday, January 22, 2020 at 4:52:51 AM UTC-5, Nadav Har'El wrote: >> >> >> On Wed, Jan 22, 2020 at 5:22 AM Waldemar Kozaczuk <[email protected]> >> wrote: >> >>> Java 7 reached end of life almost 5 years ago and has since >>> been largely replaced by Java 8 which is still widely used. >>> >>> This patch eliminates openjdk7 module and adds new openjdk8-from-host one >>> as a default java module. This patch also replaces dependencies in the >>> main makefile on antique openjdk7 in external/x64 with openjdk8 >>> from host that should be installed by setup.py. >>> >> >> I'll commit this because I like this direction, but I wonder (I'm not >> up-to-date with the current Java >> trends) - how do we know that the Java that will be installed on the host >> is specifically Java 8? >> Shouldn't we just call it "java-from-host", because it will use whatever >> is available in the host - >> couldn't this be Java 9, or 10, or 11, or whatever is the current version >> nowadays (as I said, I >> really did not keep up with Java...). >> > The C++ code in modules/java-base should compile with headers of any Java > but the Java code in the same module, more specifically the > "isolated" one, will NOT compile with java > 8 as (which is rare) some > classes/interfaces have been removed (not just deprecated). So that is why > we need opendjk8 > to compile java code. > I guess that in some future Linux distribution, we will suddenly discover this doesn't work any more because the host Java actually has Java 9, not 8. But I guess we can fix this later when we reach this problem. > Let me send more detailed email later about it. > >> >> >>> This patch also removes external/x64/openjdk.bin and >>> external/aarch64/openjdk.bin modules. >>> >>> References #743 >>> >>> Signed-off-by: Waldemar Kozaczuk <[email protected]> >>> --- >>> .gitmodules | 7 ----- >>> Makefile | 9 +----- >>> external/aarch64/openjdk.bin | 1 - >>> external/x64/openjdk.bin | 1 - >>> modules/httpserver-jvm-plugin/Makefile | 3 +- >>> modules/java-base/common.gmk | 2 ++ >>> modules/java/module.py | 2 +- >>> modules/openjdk7/module.py | 22 -------------- >>> modules/openjdk8-from-host/.gitignore | 1 + >>> modules/openjdk8-from-host/Makefile | 14 +++++++++ >>> modules/openjdk8-from-host/module.py | 40 ++++++++++++++++++++++++++ >>> scripts/build | 11 ++++--- >>> 12 files changed, 65 insertions(+), 48 deletions(-) >>> delete mode 160000 external/aarch64/openjdk.bin >>> delete mode 160000 external/x64/openjdk.bin >>> delete mode 100644 modules/openjdk7/module.py >>> create mode 100644 modules/openjdk8-from-host/.gitignore >>> create mode 100644 modules/openjdk8-from-host/Makefile >>> create mode 100644 modules/openjdk8-from-host/module.py >>> >>> diff --git a/.gitmodules b/.gitmodules >>> index a9fc9c64..8244a0e7 100644 >>> --- a/.gitmodules >>> +++ b/.gitmodules >>> @@ -1,7 +1,3 @@ >>> -[submodule "external/x64/openjdk.bin"] >>> - path = external/x64/openjdk.bin >>> - url = ../../cloudius-systems/openjdk.bin >>> - ignore = dirty >>> [submodule "external/x64/gcc.bin"] >>> path = external/x64/gcc.bin >>> url = ../../cloudius-systems/gcc.bin >>> @@ -24,9 +20,6 @@ >>> [submodule "external/aarch64/misc.bin"] >>> path = external/aarch64/misc.bin >>> url = ../../cloudius-systems/aarch64-misc.bin.git >>> -[submodule "external/aarch64/openjdk.bin"] >>> - path = external/aarch64/openjdk.bin >>> - url = ../../cloudius-systems/aarch64-openjdk.bin.git >>> [submodule "modules/httpserver/swagger-ui"] >>> path = modules/httpserver-html5-gui/swagger-ui >>> url = ../../cloudius-systems/swagger-ui.git >>> diff --git a/Makefile b/Makefile >>> index cbe90704..a4b000d6 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -112,7 +112,6 @@ endif >>> # musl/ - for some of the header files (symbolic links in >>> include/api) and >>> # some of the source files ($(musl) below). >>> # external/x64/acpica - for the ACPICA library (see $(acpi) below). >>> -# external/x64/openjdk.bin - for $(java-targets) below. >>> # Additional submodules are need when certain make parameters are used. >>> ifeq (,$(wildcard musl/include)) >>> $(error Missing musl/ directory. Please run "git submodule update >>> --init --recursive") >>> @@ -120,9 +119,6 @@ endif >>> ifeq (,$(wildcard external/x64/acpica/source)) >>> $(error Missing external/x64/acpica/ directory. Please run "git >>> submodule update --init --recursive") >>> endif >>> -ifeq (,$(wildcard external/x64/openjdk.bin/usr)) >>> - $(error Missing external/x64/openjdk.bin/ directory. Please run >>> "git submodule update --init --recursive") >>> -endif >>> >>> # This makefile wraps all commands with the $(quiet) or $(very-quiet) >>> macros >>> # so that instead of half-a-screen-long command lines we short summaries >>> @@ -233,9 +229,6 @@ INCLUDES += -isystem include/glibc-compat >>> >>> gccbase = external/$(arch)/gcc.bin >>> miscbase = external/$(arch)/misc.bin >>> -jdkbase := $(shell find external/$(arch)/openjdk.bin/usr/lib/jvm \ >>> - -maxdepth 1 -type d -name 'java*') >>> - >>> >>> ifeq ($(gcc_include_env), external) >>> gcc-inc-base := $(dir $(shell find $(gccbase)/ -name vector | grep -v >>> -e debug/vector$$ -e profile/vector$$)) >>> @@ -1933,7 +1926,7 @@ $(bootfs_manifest_dep): phony >>> $(out)/bootfs.bin: scripts/mkbootfs.py $(bootfs_manifest) >>> $(bootfs_manifest_dep) $(tools:%=$(out)/%) \ >>> $(out)/zpool.so $(out)/zfs.so $(out)/libenviron.so >>> $(out)/libvdso.so >>> $(call quiet, olddir=`pwd`; cd $(out); >>> "$$olddir"/scripts/mkbootfs.py -o bootfs.bin -d bootfs.bin.d -m >>> "$$olddir"/$(bootfs_manifest) \ >>> - -D jdkbase="$$olddir"/$(jdkbase) -D >>> gccbase="$$olddir"/$(gccbase) \ >>> + -D gccbase="$$olddir"/$(gccbase) \ >>> -D miscbase="$$olddir"/$(miscbase), MKBOOTFS $@) >>> >>> $(out)/bootfs.o: $(out)/bootfs.bin >>> diff --git a/external/aarch64/openjdk.bin b/external/aarch64/openjdk.bin >>> deleted file mode 160000 >>> index 443f2cca..00000000 >>> --- a/external/aarch64/openjdk.bin >>> +++ /dev/null >>> @@ -1 +0,0 @@ >>> -Subproject commit 443f2cca797910915274a0a3a42ea8a67752c063 >>> diff --git a/external/x64/openjdk.bin b/external/x64/openjdk.bin >>> deleted file mode 160000 >>> index 019ea95e..00000000 >>> --- a/external/x64/openjdk.bin >>> +++ /dev/null >>> @@ -1 +0,0 @@ >>> -Subproject commit 019ea95e844cc9e51c149a519391e2a99915ad39 >>> diff --git a/modules/httpserver-jvm-plugin/Makefile >>> b/modules/httpserver-jvm-plugin/Makefile >>> index fdc20bb7..e92bec2c 100644 >>> --- a/modules/httpserver-jvm-plugin/Makefile >>> +++ b/modules/httpserver-jvm-plugin/Makefile >>> @@ -1,7 +1,6 @@ >>> >>> INCLUDES = -I$(src)/build/$(mode)/gen/include >>> -INCLUDES += -I../../include -I. -I../../java -I../../arch/$(ARCH) >>> -I../.. >>> -INCLUDES += -I$(jdkbase)/include -I$(jdkbase)/include/linux >>> +INCLUDES += -I../../include -I. -I../../arch/$(ARCH) -I../.. >>> INCLUDES += -I../httpserver-api >>> >>> # compiler flags: >>> diff --git a/modules/java-base/common.gmk b/modules/java-base/common.gmk >>> index 0e2e4690..3d0a1c98 100644 >>> --- a/modules/java-base/common.gmk >>> +++ b/modules/java-base/common.gmk >>> @@ -1,3 +1,5 @@ >>> +jdkbase = $(dir $(shell readlink -f $$(which javac)))/.. >>> + >>> INCLUDES = -I$(src)/arch/$(arch) -I$(src) -I$(src)/include >>> -I$(src)/arch/common >>> INCLUDES += -I$(src)/include/glibc-compat >>> INCLUDES += $(shell $(CXX) -E -xc++ - -v </dev/null 2>&1 | awk '/^End/ >>> {exit} /^ .*c\+\+/ {print "-isystem" $$0}') >>> diff --git a/modules/java/module.py b/modules/java/module.py >>> index 7af25104..114c5fb9 100644 >>> --- a/modules/java/module.py >>> +++ b/modules/java/module.py >>> @@ -1,4 +1,4 @@ >>> from osv.modules import api >>> >>> api.require('java-non-isolated') >>> -api.require('openjdk7') >>> +api.require('openjdk8-from-host') >>> diff --git a/modules/openjdk7/module.py b/modules/openjdk7/module.py >>> deleted file mode 100644 >>> index e4895465..00000000 >>> --- a/modules/openjdk7/module.py >>> +++ /dev/null >>> @@ -1,22 +0,0 @@ >>> -from osv.modules.filemap import FileMap >>> -from osv.modules import api >>> -import os, os.path >>> - >>> -api.require('java-cmd') >>> -provides = ['java'] >>> - >>> -usr_files = FileMap() >>> - >>> -jdkdir = os.path.basename(os.path.expandvars('${jdkbase}')) >>> - >>> -usr_files.add('${jdkbase}').to('/usr/lib/jvm/java') \ >>> - .include('lib/**') \ >>> - .include('jre/**') \ >>> - .include('bin/java') \ >>> - .exclude('jre/lib/security/cacerts') \ >>> - .exclude('jre/lib/audio/**') >>> - >>> -usr_files.link('/usr/lib/jvm/' + jdkdir).to('java') >>> -usr_files.link('/usr/lib/jvm/jre').to('java/jre') >>> >>> -usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts') >>> -usr_files.link('/usr/bin/java').to('/usr/lib/jvm/java/bin/java') >>> diff --git a/modules/openjdk8-from-host/.gitignore >>> b/modules/openjdk8-from-host/.gitignore >>> new file mode 100644 >>> index 00000000..f9235a6b >>> --- /dev/null >>> +++ b/modules/openjdk8-from-host/.gitignore >>> @@ -0,0 +1 @@ >>> +usr.manifest >>> diff --git a/modules/openjdk8-from-host/Makefile >>> b/modules/openjdk8-from-host/Makefile >>> new file mode 100644 >>> index 00000000..1bd8b898 >>> --- /dev/null >>> +++ b/modules/openjdk8-from-host/Makefile >>> @@ -0,0 +1,14 @@ >>> +.PHONY: module clean >>> + >>> +SRC = $(shell readlink -f ../..) >>> + >>> +javac_exe_path = $(shell realpath $$(which javac)) >>> +javac_bin_path = $(shell dirname $(javac_exe_path)) >>> +java_jdk_path = $(shell dirname $(javac_bin_path)) >>> + >>> +module: >>> + $(SRC)/scripts/manifest_from_host.sh >>> $(java_jdk_path)/jre/lib/amd64/libsunec.so > usr.manifest >>> + $(SRC)/scripts/manifest_from_host.sh -l libfreeblpriv3.so >> >>> usr.manifest >>> + >>> +clean: >>> + rm -rf usr.manifest >>> diff --git a/modules/openjdk8-from-host/module.py >>> b/modules/openjdk8-from-host/module.py >>> new file mode 100644 >>> index 00000000..a55c78e9 >>> --- /dev/null >>> +++ b/modules/openjdk8-from-host/module.py >>> @@ -0,0 +1,40 @@ >>> +from osv.modules.filemap import FileMap >>> +from osv.modules import api >>> +import os, os.path >>> +import subprocess >>> + >>> +api.require('java-cmd') >>> +provides = ['java','java8'] >>> + >>> +#Verify that the jdk exists by trying to locate javac (java compiler) >>> +if subprocess.call(['which', 'javac']) != 0: >>> + print('Could not find any jdk on the host. Please install >>> openjdk8!') >>> + os.exit(-1) >>> + >>> +java_version = subprocess.check_output(['java', '-version'], >>> stderr=subprocess.STDOUT) >>> +if not 'openjdk version "1.8.0' in java_version: >>> + print('Could not find openjdk version 8 on the host. Please install >>> openjdk8!') >>> + os.exit(-1) >>> + >>> +javac_path = subprocess.check_output(['which', 'javac']).split('\n')[0] >>> +javac_real_path = os.path.realpath(javac_path) >>> +jdk_path = os.path.dirname(os.path.dirname(javac_real_path)) >>> + >>> +usr_files = FileMap() >>> + >>> +jdk_dir = os.path.basename(jdk_path) >>> + >>> +usr_files.add(jdk_path).to('/usr/lib/jvm/java') \ >>> + .include('jre/**') \ >>> + .exclude('jre/lib/security/cacerts') \ >>> + .exclude('jre/lib/amd64/*audio*') \ >>> + .exclude('jre/lib/amd64/*sound*') \ >>> + .exclude('') \ >>> + .exclude('jre/man/**') \ >>> + .exclude('jre/bin/**') \ >>> + .include('jre/bin/java') >>> + >>> +usr_files.link('/usr/lib/jvm/' + jdk_dir).to('java') >>> +usr_files.link('/usr/lib/jvm/jre').to('java/jre') >>> >>> +usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts') >>> +usr_files.link('/usr/bin/java').to('/usr/lib/jvm/java/jre/bin/java') >>> diff --git a/scripts/build b/scripts/build >>> index 2a4ba957..b72a8d67 100755 >>> --- a/scripts/build >>> +++ b/scripts/build >>> @@ -170,7 +170,6 @@ esac >>> modules=${vars[modules]-!$image} >>> >>> # TODO: some modules need these... Would be better if they wouldn't... >>> -jdkbase=${vars[jdkbase]-`find >>> "$SRC"/external/$arch/openjdk.bin/usr/lib/jvm -maxdepth 1 -type d -name >>> 'java*'`} >>> gccbase=${vars[gccbase]-"$SRC"/external/$arch/gcc.bin} >>> miscbase=${vars[miscbase]-"$SRC"/external/$arch/misc.bin} >>> >>> @@ -221,8 +220,8 @@ fi >>> export "$i" ;; >>> esac >>> done >>> - # Export the variables we already have. This makes it >>> unnecessary to do "fs__type=$fstype jdkbase $jdkbase ..." >>> - export fs_type jdkbase mode OSV_BUILD_PATH >>> + # Export the variables we already have. This makes it >>> unnecessary to do "fs__type=$fstype ..." >>> + export fs_type mode OSV_BUILD_PATH >>> # Other variables we wanted to rename, I don't know why >>> export ARCH=$arch OSV_BASE=$SRC >>> # Run what we wanted to run. It will inherit everything we >>> exported above. >>> @@ -269,15 +268,15 @@ zfs) >>> >>> if [ "$export" == "none" ] >>> then >>> - "$SRC"/scripts/upload_manifest.py -o usr.img -m >>> usr.manifest -D jdkbase="$jdkbase" -D gccbase="$gccbase" -D >>> miscbase="$miscbase" >>> + "$SRC"/scripts/upload_manifest.py -o usr.img -m >>> usr.manifest -D gccbase="$gccbase" -D miscbase="$miscbase" >>> else >>> export_dir=${vars[export_dir]-$SRC/build/export} >>> - "$SRC"/scripts/export_manifest.py -e "$export_dir" -m >>> usr.manifest -D jdkbase="$jdkbase" -D gccbase="$gccbase" -D >>> miscbase="$miscbase" >>> + "$SRC"/scripts/export_manifest.py -e "$export_dir" -m >>> usr.manifest -D gccbase="$gccbase" -D miscbase="$miscbase" >>> fi >>> ;; >>> rofs) >>> rm -rf rofs.img >>> - "$SRC"/scripts/gen-rofs-img.py -o rofs.img -m usr.manifest -D >>> jdkbase="$jdkbase" -D gccbase="$gccbase" -D miscbase="$miscbase" >>> + "$SRC"/scripts/gen-rofs-img.py -o rofs.img -m usr.manifest -D >>> gccbase="$gccbase" -D miscbase="$miscbase" >>> rofs_size=`stat --printf %s rofs.img` >>> img_size=$((kernel_end + rofs_size)) >>> cp loader.img bare.raw >>> -- >>> 2.20.1 >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "OSv Development" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/osv-dev/20200122032153.6195-2-jwkozaczuk%40gmail.com >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/osv-dev/31288000-1bf0-4072-b285-b76647f92aef%40googlegroups.com > <https://groups.google.com/d/msgid/osv-dev/31288000-1bf0-4072-b285-b76647f92aef%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/CANEVyjs0AnU4VkN-TczddtNehwQ9Qy9-39-td9y-hYiKDeTtRw%40mail.gmail.com.
