Skip to contentSkip to conversation

openjdk-bin: new package

PATCH Superseded aduskett at gmail.com 3 participants 7 messages Feb 5, 2019 – Feb 10, 2019

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/3 openjdk-bin: new package

From: Adam Duskett <[email protected]>

Paradoxically, building OpenJDK requires a pre-existing JDK. This pre-existing JDK is called the "boot JDK."

The boot JDK for building JDK major version N should be a JDK of major version N-1, so for building JDK11, JDK10 would be needed. This requirement is an issue when building on most distributions, as the host JDK tends to be JDK8.

The AdoptOpenJDK project provides binaries that can act as the boot JDK to build the target JDK, which is what this package provides.

Currently, only a x86_64 host is supported, for two reasons:
1) A 32bit x86 binary distribution is not available from AdoptOpenJDK
2) Access to a machine that is not x86_64 that can build Buildroot is not avaliable.

The provided unpack200 has an invalid RPATH and relies on libzlib. When host-libzlib runs the install step, the following error is generated:

*** ERROR: package host-libzlib installs executables without proper RPATH:
*** $(HOST_DIR)/bin/unpack200

Because unpack200 is a deprecated tool, removing it after installation is safe and fixes the issue.

---
Changes v1 -> v2:
- No change

Changes v2 -> v3:
- Changed the location of the installed binaries to just $(HOST_DIR)/openjdk

- Added a more in-depth commit message explaining some of the my reasoning for some of the quirks in the package files.

Changes v3 -> v4:
- Removed first person wordage. (Thomas)
- Changed GPLv2+ -> GPL-2.0+ (Thomas)
- Removed Config.in.host (Thomas)

Changes v4 -> v5:
- Changed the install location to just $(HOST_DIR)/bin and ${HOST_DIR}/lib
- Remove unpack200 from ${HOSt_DIR}/bin due to bad RPATHS in the binary.
- Remove support/testing/tests/package/br2-external/openjdk/ from DEVELOPERS (Matthew)
- Update version to 11.0.2+9

 DEVELOPERS                           |  1 +
 package/openjdk-bin/openjdk-bin.hash |  6 ++++++
 package/openjdk-bin/openjdk-bin.mk   | 30 ++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 package/openjdk-bin/openjdk-bin.hash
 create mode 100644 package/openjdk-bin/openjdk-bin.mk
DEVELOPERS +1 -0
index 59e1f32ba9..460e4de7b9 100644
@@ -50,6 +50,7 @@ F:	package/libselinux/
 F:	package/libsemanage/
 F:	package/libsepol/
 F:	package/nginx-naxsi/
+F:	package/openjdk-bin/
 F:	package/policycoreutils/
 F:	package/python-flask-sqlalchemy/
 F:	package/python-mutagen/
package/openjdk-bin/openjdk-bin.hash new file +6 -0
new file mode 100644
index 0000000000..d36a582a33
@@ -0,0 +1,6 @@
+# From https://github.com/AdoptOpenJDK/openjdk11-binaries/releases
+sha256	d02089d834f7702ac1a9776d8d0d13ee174d0656cf036c6b68b9ffb71a6f610e	OpenJDK11U-jdk_x64_linux_hotspot_11.0.2_9.tar.gz
+
+# Locally calculated
+sha256	4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726	legal/java.prefs/LICENSE
+sha256	a44eb7b5caf5534c6ef536b21edb40b4d6babf91bf97d9d45596868618b2c6fb	legal/java.prefs/ASSEMBLY_EXCEPTION
package/openjdk-bin/openjdk-bin.mk new file +30 -0
new file mode 100644
index 0000000000..390baad0c6
@@ -0,0 +1,30 @@
+################################################################################
+#
+# host-openjdk-bin
+#
+################################################################################
+
+HOST_OPENJDK_BIN_VERSION_MAJOR = 11.0.2
+HOST_OPENJDK_BIN_VERSION_MINOR = 9
+HOST_OPENJDK_BIN_VERSION = $(HOST_OPENJDK_BIN_VERSION_MAJOR)_$(HOST_OPENJDK_BIN_VERSION_MINOR)
+HOST_OPENJDK_BIN_SOURCE = OpenJDK11U-jdk_x64_linux_hotspot_$(HOST_OPENJDK_BIN_VERSION).tar.gz
+HOST_OPENJDK_BIN_SITE = https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-$(HOST_OPENJDK_BIN_VERSION_MAJOR)%2B$(HOST_OPENJDK_BIN_VERSION_MINOR)
+HOST_OPENJDK_BIN_LICENSE = GPL-2.0+ with exception
+HOST_OPENJDK_BIN_LICENSE_FILES = legal/java.prefs/LICENSE legal/java.prefs/ASSEMBLY_EXCEPTION
+
+# If the files are installed to $(HOST_DIR)/bin and $(HOST_DIR)/lib
+# the build will fail because the RPATH of java binaries do not have a proper
+# RPATH
+define HOST_OPENJDK_BIN_INSTALL_CMDS
+	cp -aLrf $(@D)/bin/* $(HOST_DIR)/bin/
+	cp -aLrf $(@D)/lib/* $(HOST_DIR)/lib/
+	# unpack200 has an invalid RPATH and relies on libzlib. When host-libzlib
+	# is installed on the system, the error
+	# "ERROR: package host-libzlib installs executables without proper RPATH:
+	# /home/buildroot/bropenjdk/output/host/bin/unpack200" will occure.
+	# Because unpack200 is a deprecated tool, removing it to fix this issue is
+	# safe.
+	$(RM) $(HOST_DIR)/bin/unpack200
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.17.2 (Apple Git-113)
#1 lore raw

PATCH v5 1/3 openjdk-bin: new package

All

Quoted 100 lines · On Tue, Feb 5, 2019 at 3:31 PM <[email protected]> wrote:

From: Adam Duskett <[email protected]>

Paradoxically, building OpenJDK requires a pre-existing JDK. This pre-existing JDK is called the "boot JDK."

The boot JDK for building JDK major version N should be a JDK of major version N-1, so for building JDK11, JDK10 would be needed. This requirement is an issue when building on most distributions, as the host JDK tends to be JDK8.

The AdoptOpenJDK project provides binaries that can act as the boot JDK to build the target JDK, which is what this package provides.

Currently, only a x86_64 host is supported, for two reasons:
1) A 32bit x86 binary distribution is not available from AdoptOpenJDK
2) Access to a machine that is not x86_64 that can build Buildroot is not avaliable.

The provided unpack200 has an invalid RPATH and relies on libzlib. When host-libzlib runs the install step, the following error is generated:

*** ERROR: package host-libzlib installs executables without proper RPATH:
*** $(HOST_DIR)/bin/unpack200

Because unpack200 is a deprecated tool, removing it after installation is safe and fixes the issue.

---
Changes v1 -> v2:
- No change

Changes v2 -> v3:
- Changed the location of the installed binaries to just $(HOST_DIR)/openjdk

- Added a more in-depth commit message explaining some of the my reasoning for some of the quirks in the package files.

Changes v3 -> v4:
- Removed first person wordage. (Thomas)
- Changed GPLv2+ -> GPL-2.0+ (Thomas)
- Removed Config.in.host (Thomas)

Changes v4 -> v5:
- Changed the install location to just $(HOST_DIR)/bin and ${HOST_DIR}/lib
- Remove unpack200 from ${HOSt_DIR}/bin due to bad RPATHS in the binary.
- Remove support/testing/tests/package/br2-external/openjdk/ from DEVELOPERS (Matthew)
- Update version to 11.0.2+9

 DEVELOPERS                           |  1 +
 package/openjdk-bin/openjdk-bin.hash |  6 ++++++
 package/openjdk-bin/openjdk-bin.mk   | 30 ++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 package/openjdk-bin/openjdk-bin.hash
 create mode 100644 package/openjdk-bin/openjdk-bin.mk
DEVELOPERS +1 -0
index 59e1f32ba9..460e4de7b9 100644
@@ -50,6 +50,7 @@ F:    package/libselinux/
 F:     package/libsemanage/
 F:     package/libsepol/
 F:     package/nginx-naxsi/
+F:     package/openjdk-bin/
 F:     package/policycoreutils/
 F:     package/python-flask-sqlalchemy/
 F:     package/python-mutagen/
package/openjdk-bin/openjdk-bin.hash new file +6 -0
new file mode 100644
index 0000000000..d36a582a33
@@ -0,0 +1,6 @@
+# From https://github.com/AdoptOpenJDK/openjdk11-binaries/releases
+sha256 d02089d834f7702ac1a9776d8d0d13ee174d0656cf036c6b68b9ffb71a6f610e        OpenJDK11U-jdk_x64_linux_hotspot_11.0.2_9.tar.gz
+
+# Locally calculated
+sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726        legal/java.prefs/LICENSE
+sha256 a44eb7b5caf5534c6ef536b21edb40b4d6babf91bf97d9d45596868618b2c6fb        legal/java.prefs/ASSEMBLY_EXCEPTION
package/openjdk-bin/openjdk-bin.mk new file +13 -0
new file mode 100644
index 0000000000..390baad0c6
@@ -0,0 +1,30 @@
+################################################################################
+#
+# host-openjdk-bin
+#
+################################################################################
+
+HOST_OPENJDK_BIN_VERSION_MAJOR = 11.0.2
+HOST_OPENJDK_BIN_VERSION_MINOR = 9
+HOST_OPENJDK_BIN_VERSION = $(HOST_OPENJDK_BIN_VERSION_MAJOR)_$(HOST_OPENJDK_BIN_VERSION_MINOR)
+HOST_OPENJDK_BIN_SOURCE = OpenJDK11U-jdk_x64_linux_hotspot_$(HOST_OPENJDK_BIN_VERSION).tar.gz
+HOST_OPENJDK_BIN_SITE = https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-$(HOST_OPENJDK_BIN_VERSION_MAJOR)%2B$(HOST_OPENJDK_BIN_VERSION_MINOR)
+HOST_OPENJDK_BIN_LICENSE = GPL-2.0+ with exception
+HOST_OPENJDK_BIN_LICENSE_FILES = legal/java.prefs/LICENSE legal/java.prefs/ASSEMBLY_EXCEPTION

package/openjdk-bin/openjdk-bin.mk line 23

Quoted 10 lines
package/openjdk-bin/openjdk-bin.mk new file +10 -0
+
+# If the files are installed to $(HOST_DIR)/bin and $(HOST_DIR)/lib
+# the build will fail because the RPATH of java binaries do not have a proper
+# RPATH
+define HOST_OPENJDK_BIN_INSTALL_CMDS
+       cp -aLrf $(@D)/bin/* $(HOST_DIR)/bin/
+       cp -aLrf $(@D)/lib/* $(HOST_DIR)/lib/
+       # unpack200 has an invalid RPATH and relies on libzlib. When host-libzlib
+       # is installed on the system, the error
+       # "ERROR: package host-libzlib installs executables without proper RPATH:

If the patch is accepted, please fix this path. I hope that is possible without having
to submit a new patch series.

Quoted 10 lines
package/openjdk-bin/openjdk-bin.mk new file +7 -1
+       # /home/buildroot/bropenjdk/output/host/bin/unpack200" will occure.
+       # Because unpack200 is a deprecated tool, removing it to fix this issue is
+       # safe.
+       $(RM) $(HOST_DIR)/bin/unpack200
+endef
+
+$(eval $(host-generic-package))
--

2.17.2 (Apple Git-113)

Thanks!
Adam

#2 lore raw

PATCH v5 2/3 openjdk: new package

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

OpenJDK is a free and open-source implementation of the Java Platform. This package provides the option to build a client or a server JVM interpreter.

The default option is the server option, as that is what the majority of users use. This JVM interpreter loads more slowly, putting more effort into JIT compilations to yield higher performance.

Unlike most autotools packages, OpenJDK is exceptionally different and has many quirks, some of which are documented below:

- X11, alsa, and cups are required to build Java, even if it's a headless build.

- There is no autogen.sh file, instead, a user calls ./configure autogen.

- If ccache is enabled, BuildRoot sets CC, CXX, and CPP to
the ccache binary, which causes OpenJDK to throw an error during the configure step, so LD, CC, CXX, and CPP must set explicitly to the actual binaries.

- Some variables are ignored unless set as a configure option. These variables are OBJCOPY, OBJDUMP, NM, STRIP, and AR.

- Other variables must be environment variables, these are PATH, LD, CC, CXX, and CPP.

- Parallel make is possible, but not with make -jN, instead, one has to pass the --with-jobs=$(PARALLEL_JOBS) to ./configure, or pass JOBS=$(PARALLEL_JOBS) to make. The formner was chosen as it seems cleaner.

---
Changes v1 -> v2:
- Fixed the patch name.

Changes v2 -> v3:
- Changed the install location of the libraries and binaries to

    $(TARGET_DIR)/bin and $(TARGET_DIR)/lib.

- Changed -with-boot-jdk location to $(HOST_DIR)/openjdk

- Added a more in-depth commit message explaining some of the my reasoning for some of the quirks in the package files.

Changes v3 -> v4:
- Changed GPLv2+ -> GPL-2.0+ (Thomas)
- Added BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS to Config.in
- Removed first person wordage. (Thomas)

Changes v4 -> v5:
- Add jpeg, giflib, libpng, and zlib as dependencies. (Thomas)
- Remove dependencies that aren't necessary. (Thomas)
- Add better comments in the openjdk.mk file. (Matthew)
- Change --with-boot-jdk location to just $(HOST_DIR)
- Use newer Oracle provided cpu port for aarch64.
- Update version to 11.0.2+9

 DEVELOPERS                   |   1 +
 package/Config.in            |   1 +
 package/openjdk/Config.in    |  56 ++++++++++++++++
 package/openjdk/openjdk.hash |   3 +
 package/openjdk/openjdk.mk   | 122 +++++++++++++++++++++++++++++++++++
 5 files changed, 183 insertions(+)
 create mode 100644 package/openjdk/Config.in
 create mode 100644 package/openjdk/openjdk.hash
 create mode 100644 package/openjdk/openjdk.mk
DEVELOPERS +1 -0
index 460e4de7b9..e4f5ac6258 100644
@@ -50,6 +50,7 @@ F:	package/libselinux/
 F:	package/libsemanage/
 F:	package/libsepol/
 F:	package/nginx-naxsi/
+F:	package/openjdk/
 F:	package/openjdk-bin/
 F:	package/policycoreutils/
 F:	package/python-flask-sqlalchemy/
package/Config.in +1 -0
index bca61f14ed..e43770f7d2 100644
@@ -671,6 +671,7 @@ menu "Mono libraries/modules"
 endmenu
 endif
 	source "package/nodejs/Config.in"
+	source "package/openjdk/Config.in"
 	source "package/perl/Config.in"
 if BR2_PACKAGE_PERL
 menu "Perl libraries/modules"
package/openjdk/Config.in new file +56 -0

56 lines not on this page · raw message

package/openjdk/openjdk.hash new file +3 -0
new file mode 100644
index 0000000000..8b14609066
@@ -0,0 +1,3 @@
+# Locally computed
+sha256 6c69a2c1b5177659d4263545cf83e0fbcd697669b0107481372be3648af7b89b  openjdk-jdk-11.0.2+9.tar.gz
+sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726  LICENSE
package/openjdk/openjdk.mk new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.17.2 (Apple Git-113)
#3 lore raw

PATCH v5 2/3 openjdk: new package

Adam.

Quoted 3 lines · On Tue, Feb 5, 2019 at 8:34 AM <[email protected]> wrote:

From: Adam Duskett <[email protected]>

[snip]

Quoted 8 lines
package/openjdk/openjdk.mk new file +8 -0
+OPENJDK_CONF_OPTS = \
+       --disable-full-docs \
+       --disable-hotspot-gtest \
+       --disable-manpages \
+       --disable-warnings-as-errors \
+       --enable-headless-only \
+       --enable-openjdk-only \
+       --enable-unlimited-crypto \

package/openjdk/openjdk.mk line 72

Quoted 10 lines
package/openjdk/openjdk.mk new file +10 -0
+       --openjdk-target=$(GNU_TARGET_NAME) \
+       --prefix=$(TARGET_DIR)/usr \
+       --with-boot-jdk=$(HOST_DIR) \
+       --with-debug-level=release \
+       --with-devkit=$(HOST_DIR) \
+       --with-extra-cflags="$(TARGET_CFLAGS)" \
+       --with-extra-cxxflags="$(TARGET_CXXFLAGS)" \
+       --with-extra-path=$(HOST_DIR)/bin:$(HOST_DIR)/sbin \
+       --with-giflib=system \
+       --with-jobs=$(PARALLEL_JOBS) \

Got a build failure where I suspect PARALLEL_JOBS might be a fault. I'm dropping my core count and seeing if things succeed.

Here's the pastebin
https://pastebin.com/FNehyafY

Matt

#4 lore raw

PATCH v5 2/3 openjdk: new package

Adam,

Quoted 27 lines · Matthew Weber

Adam.

Quoted 3 lines · On Tue, Feb 5, 2019 at 8:34 AM <[email protected]> wrote:

From: Adam Duskett <[email protected]>

[snip]

Quoted 8 lines
package/openjdk/openjdk.mk new file +8 -0
+OPENJDK_CONF_OPTS = \
+       --disable-full-docs \
+       --disable-hotspot-gtest \
+       --disable-manpages \
+       --disable-warnings-as-errors \
+       --enable-headless-only \
+       --enable-openjdk-only \
+       --enable-unlimited-crypto \

package/openjdk/openjdk.mk line 72

Quoted 10 lines
package/openjdk/openjdk.mk new file +10 -0
+       --openjdk-target=$(GNU_TARGET_NAME) \
+       --prefix=$(TARGET_DIR)/usr \
+       --with-boot-jdk=$(HOST_DIR) \
+       --with-debug-level=release \
+       --with-devkit=$(HOST_DIR) \
+       --with-extra-cflags="$(TARGET_CFLAGS)" \
+       --with-extra-cxxflags="$(TARGET_CXXFLAGS)" \
+       --with-extra-path=$(HOST_DIR)/bin:$(HOST_DIR)/sbin \
+       --with-giflib=system \
+       --with-jobs=$(PARALLEL_JOBS) \
Quoted 5 lines

Got a build failure where I suspect PARALLEL_JOBS might be a fault. I'm dropping my core count and seeing if things succeed.

Here's the pastebin
https://pastebin.com/FNehyafY

No luck, same failure output with -j8. My environment was a Ubuntu 14.04 machine running the run-time test.

Matt

Signature · 23 lines
Matthew Weber | Pr. Software Engineer | Commercial Avionics

COLLINS AEROSPACE

400 Collins Road NE, Cedar Rapids, Iowa 52498, USA

Tel: +1 319 295 7349 | FAX: +1 319 263 6099

matthew.weber at collins.com | collinsaerospace.com



CONFIDENTIALITY WARNING: This message may contain proprietary and/or
privileged information of Collins Aerospace and its affiliated
companies. If you are not the intended recipient, please 1) Do not
disclose, copy, distribute or use this message or its contents. 2)
Advise the sender by return email. 3) Delete all copies (including all
attachments) from your computer. Your cooperation is greatly
appreciated.


Any export restricted material should be shared using my
matthew.weber at corp.rockwellcollins.com address.
#5 lore raw

PATCH v5 3/3 openjdk-hello-world: new test

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

This test is a simple "Hello, World" integration test of the OpenJDK package.

It compiles the Java app on the host, then runs it on an emulated AARCH64 target and verifies "Hello, World" is printed.

---
Changes v1 -> v3:
- Added this patch to the series.

Changes v3 -> v4:
- None

Changes v4 -> v5:
- Add support/testing/tests/package/br2-external/openjdk/ from DEVELOPERS
- Change $(HOST_DIR)/openjdk/bin/javac to $(HOST_DIR)/bin/javac in openjdk-hello-world.mk.

 .gitlab-ci.yml                                |  1 +
 DEVELOPERS                                    |  1 +
 .../package/br2-external/openjdk/Config.in    |  1 +
 .../br2-external/openjdk/external.desc        |  1 +
 .../package/br2-external/openjdk/external.mk  |  1 +
 .../package/openjdk-hello-world/Config.in     | 26 ++++++++++++
 .../openjdk-hello-world/HelloWorld.java       |  8 ++++
 .../openjdk-hello-world.mk                    | 18 ++++++++
 support/testing/tests/package/test_openjdk.py | 42 +++++++++++++++++++
 9 files changed, 99 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/openjdk/Config.in
 create mode 100644 support/testing/tests/package/br2-external/openjdk/external.desc
 create mode 100644 support/testing/tests/package/br2-external/openjdk/external.mk
 create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in
 create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java
 create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk
 create mode 100644 support/testing/tests/package/test_openjdk.py
.gitlab-ci.yml +1 -0
index f05b9d041e..09d1581a01 100644
@@ -325,6 +325,7 @@ tests.package.test_ipython.TestIPythonPy2: *runtime_test
 tests.package.test_ipython.TestIPythonPy3: *runtime_test
 tests.package.test_lua.TestLua: *runtime_test
 tests.package.test_lua.TestLuajit: *runtime_test
+tests.package.test_openjdk.TestOpenJdk: *runtime_test
 tests.package.test_perl.TestPerl: *runtime_test
 tests.package.test_perl_class_load.TestPerlClassLoad: *runtime_test
 tests.package.test_perl_dbd_mysql.TestPerlDBDmysql: *runtime_test
DEVELOPERS +1 -0
index e4f5ac6258..6f35c5cc3b 100644
@@ -1474,6 +1474,7 @@ F:	package/valijson/
 F:	package/wpa_supplicant/
 F:	package/wireless_tools/
 F:	package/xen/
+F:	support/testing/tests/package/br2-external/openjdk/
 
 N:	Mauro Condarelli <[email protected]>
 F:	package/mc/
support/testing/tests/package/br2-external/openjdk/Config.in new file +1 -0
new file mode 100644
index 0000000000..00c7fd4799
@@ -0,0 +1 @@
+source "$BR2_EXTERNAL_OPENJDK_PATH/package/openjdk-hello-world/Config.in"
support/testing/tests/package/br2-external/openjdk/external.desc new file +1 -0
new file mode 100644
index 0000000000..f28ba5060c
@@ -0,0 +1 @@
+name: OPENJDK
support/testing/tests/package/br2-external/openjdk/external.mk new file +1 -0
new file mode 100644
index 0000000000..54c24e8c64
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_OPENJDK_PATH)/package/*/*.mk))
support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in new file +26 -0
new file mode 100644
index 0000000000..4f9022fb92
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_OPENJDK_HELLO_WORLD
+	bool "openjdk hello world"
+	depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_PACKAGE_XORG7
+	depends on BR2_USE_WCHAR # gtk2 -> glib2
+	depends on BR2_TOOLCHAIN_HAS_THREADS # gtk2 -> glib2
+	depends on BR2_USE_MMU # gtk2 -> glib2
+	depends on BR2_INSTALL_LIBSTDCPP # gtk2, cups
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # gtk2 -> pango -> harfbuzz
+	depends on !BR2_STATIC_LIBS
+	select BR2_PACKAGE_OPENJDK
+	help
+	  Simple class for testing openjdk
+
+comment "OpenJDK-hello-world needs a glibc toolchain w/ wchar, dynamic library, threads, C++, gcc >= 4.9"
+	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on BR2_PACKAGE_XORG7
+	depends on !BR2_USE_WCHAR || \
+		BR2_STATIC_LIBS || \
+		!BR2_INSTALL_LIBSTDCPP || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
+		!BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_USES_GLIBC
support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java new file +7 -0
new file mode 100644
index 0000000000..612d661cdd
@@ -0,0 +1,7 @@
+public class HelloWorld
+{
+    public static void main(String[] args)
+    {
+        System.out.println("Hello, World");
+    }
+}
support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk new file +18 -0
new file mode 100644
index 0000000000..12cc67fc83
@@ -0,0 +1,18 @@
+################################################################################
+#
+# openjdk hello world
+#
+################################################################################
+
+OPENJDK_HELLO_WORLD_DEPENDENCIES = openjdk
+
+define OPENJDK_HELLO_WORLD_BUILD_CMDS
+	$(INSTALL) -D $(OPENJDK_HELLO_WORLD_PKGDIR)/HelloWorld.java $(@D)/HelloWorld.java
+	$(HOST_DIR)/bin/javac $(@D)/HelloWorld.java
+endef
+
+define OPENJDK_HELLO_WORLD_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/HelloWorld.class $(TARGET_DIR)/usr/bin/HelloWorld.class
+endef
+
+$(eval $(generic-package))
support/testing/tests/package/test_openjdk.py new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.17.2 (Apple Git-113)
#6 lore raw

PATCH v5 1/3 openjdk-bin: new package

In reply to aduskett at gmail.com

Hello,

Quoted 20 lines · On Tue, 5 Feb 2019 15:31:24 +0100 aduskett at gmail.com wrote:

From: Adam Duskett <[email protected]>

Paradoxically, building OpenJDK requires a pre-existing JDK. This pre-existing JDK is called the "boot JDK."

The boot JDK for building JDK major version N should be a JDK of major version N-1, so for building JDK11, JDK10 would be needed. This requirement is an issue when building on most distributions, as the host JDK tends to be JDK8.

The AdoptOpenJDK project provides binaries that can act as the boot JDK to build the target JDK, which is what this package provides.

Currently, only a x86_64 host is supported, for two reasons:
1) A 32bit x86 binary distribution is not available from AdoptOpenJDK
2) Access to a machine that is not x86_64 that can build Buildroot is not avaliable.

The provided unpack200 has an invalid RPATH and relies on libzlib. When host-libzlib runs the install step, the following error is generated:

Quoted 7 lines

*** ERROR: package host-libzlib installs executables without proper RPATH:
*** $(HOST_DIR)/bin/unpack200

Because unpack200 is a deprecated tool, removing it after installation is safe and fixes the issue.

I've applied to next.

package/openjdk-bin/openjdk-bin.mk line 17

Quoted 3 lines
package/openjdk-bin/openjdk-bin.mk new file +3 -0
+# If the files are installed to $(HOST_DIR)/bin and $(HOST_DIR)/lib
+# the build will fail because the RPATH of java binaries do not have a proper
+# RPATH

This comment was no longer true.

package/openjdk-bin/openjdk-bin.mk line 20

Quoted 3 lines
package/openjdk-bin/openjdk-bin.mk new file +3 -0
+define HOST_OPENJDK_BIN_INSTALL_CMDS
+	cp -aLrf $(@D)/bin/* $(HOST_DIR)/bin/
+	cp -aLrf $(@D)/lib/* $(HOST_DIR)/lib/

I used "cp -dpfr" instead, which we use more commonly in other packages.

package/openjdk-bin/openjdk-bin.mk line 26

Quoted 6 lines
package/openjdk-bin/openjdk-bin.mk new file +6 -0
+	# unpack200 has an invalid RPATH and relies on libzlib. When host-libzlib
+	# is installed on the system, the error
+	# "ERROR: package host-libzlib installs executables without proper RPATH:
+	# /home/buildroot/bropenjdk/output/host/bin/unpack200" will occure.
+	# Because unpack200 is a deprecated tool, removing it to fix this issue is
+	# safe.

I moved the comment above the INSTALL_CMDS variable definition, so that the comment doesn't appear in the build log when building.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com