|Summary:||java/bootstrap-openjdk17: broken on aarch64|
|Product:||Ports & Packages||Reporter:||Mikael Urankar <mikael>|
|Component:||Individual Port(s)||Assignee:||freebsd-java (Nobody) <java>|
|Severity:||Affects Many People||CC:||bz, glewis, mikael, ronald-lists|
Description Mikael Urankar 2021-12-03 11:55:27 UTC
/usr/local/bootstrap-openjdk17/bin/java Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes Exit 1 Any ideas?
Comment 1 Greg Lewis 2021-12-07 02:25:44 UTC
Hmmm, I'm not sure what might be going wrong, but I can add details about the binary itself. It was built on an AWS aarch64 instance. I installed 12.2 and built the current version of the openjdk17 port. I then deleted things that weren't needed for bootstrap, like src.zip, the manual pages, the examples, etc. What version are you trying this on and how much memory does the machine have?
Comment 2 Mikael Urankar 2021-12-07 09:34:45 UTC
(In reply to Greg Lewis from comment #1) It's on a recent 14-current, the board has 64gb of RAM.
Comment 3 Greg Lewis 2021-12-29 04:45:01 UTC
I tried this on both FreeBSD 12.3/arm64 and FreeBSD 13.0/arm64 and it worked on both of them. The JDK sometimes encounters problems on -CURRENT. These often end up being bugs in -CURRENT if they can't be reproduced on released versions. In this case I would suggest transferring this to the Base System category unless FreeBSD 14 is planning to deliberately break compatibility with earlier releases.
Comment 4 Mikael Urankar 2022-01-19 11:54:02 UTC
Cannot reproduce with a recent 14-current, closing.
Comment 5 Mikael Urankar 2022-01-20 09:27:50 UTC
(In reply to Mikael Urankar from comment #4) It happened again, setting kern.elf64.aslr.pie_enable=0 fixed it
Comment 6 Bjoern A. Zeeb 2022-05-15 23:30:06 UTC
I just hit this on my honeycomb machine trying to build openjdk17 on a CURRENT from two days ago or so... ... checking bash version... 5.1.16 checking if bash supports pipefail... yes checking if bash supports errexit (-e)... yes 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.3+7-1 configure: Found potential Boot JDK using configure arguments configure: Potential Boot JDK found at /usr/local/bootstrap-openjdk17 is not a working JDK; ignoring configure: Output from java -version was: Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes configure: error: The path given by --with-boot-jdk does not contain a valid Boot JDK configure exiting with result code 1 ===> Script "configure" failed unexpectedly. Please report the problem to java@FreeBSD.org [maintainer] and attach the "/var/tmp/work-20220515/usr/ports/java/openjdk17/work/jdk17u-jdk-17.0.3-7-1/config.log" including the output of the failure of your make command. Also, it might be a good idea to provide an overview of all packages installed on your system (e.g. a /usr/local/sbin/pkg-static info -g -Ea). *** Error code 1 Stop. make: stopped in /usr/ports/java/openjdk17 *** Error code 1 And I can confirm that setting the sysctl fixed it here too: # /usr/local/bootstrap-openjdk17/bin/jar --help Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes # sysctl kern.elf64.aslr.pie_enable=0 kern.elf64.aslr.pie_enable: 1 -> 0 # /usr/local/bootstrap-openjdk17/bin/jar --version jar 17.0.1 Thanks a lot for leaving the fix. I have no idea how the ports framework might handle this dynamically but if it can it probably should... at least give a warning/error without trying to build.
Comment 7 Ronald Klop 2022-05-16 07:49:26 UTC
See this thread for more info about the issue. https://lists.freebsd.org/archives/freebsd-arm/2022-May/001340.html It is pretty easy to workaround the failure of bootstrap-openjdk17 by using "ELF_FEATURES= +noaslr:bin/*" in the port. See the linked mail for a more elaborate patch which only enables this on aarch64. But using this to build the java/openjdk17 build still fails in all kinds of internal executables with that same error during the openjdk17 build. I don't know how to workaround this in the ports framework. Plus -more important- why does this only happen on aarch64 and not amd64? I can reproduce this on an rpi4/8GB running: # uname -a FreeBSD rpi4 14.0-CURRENT FreeBSD 14.0-CURRENT #7 main-31e076d70b: Wed Mar 23 08:55:39 CET 2022 ronald@rpi4:/home/ronald/dev/obj/home/ronald/dev/freebsd/arm64.aarch64/sys/GENERIC-NODEBUG arm64 Although my build jail is newer than the host. [00:00:01] Host OSVERSION: 1400053 [00:00:01] Jail OSVERSION: 1400055 I have no idea if something is broken in Java or in FreeBSD.
Comment 8 Bjoern A. Zeeb 2022-05-16 12:02:42 UTC
(In reply to Ronald Klop from comment #7) Thanks for all the further information. Having changed to the sysctl openjdk17 did build fine for me on arm64: # /usr/local/openjdk17/bin/java --version openjdk 17.0.3 2022-04-19 OpenJDK Runtime Environment (build 17.0.3+7-1) OpenJDK 64-Bit Server VM (build 17.0.3+7-1, mixed mode, sharing) Maybe we should just compile java with -fno-stack-protector (assuming that's the correct option) for the time being?
Comment 9 Ronald Klop 2022-05-16 13:58:59 UTC
These settings have something to do with it: [root@rpi4 ~]# /usr/local/bootstrap-openjdk17/bin/java -version Error occurred during initialization of VM Could not allocate compressed class space: 1073741824 bytes [root@rpi4 ~]# /usr/local/bootstrap-openjdk17/bin/java -XX:CompressedClassSpaceSize=1m -version Error occurred during initialization of VM Could not allocate compressed class space: 4194304 bytes [root@rpi4 ~]# /usr/local/bootstrap-openjdk17/bin/java -XX:CompressedClassSpaceSize=10g -version size_t CompressedClassSpaceSize=10737418240 is outside the allowed range [ 1048576 ... 3221225472 ] Improperly specified VM option 'CompressedClassSpaceSize=10g' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. No value of CompressedClassSpaceSize works. But disabling CompressedClassPointers does: [root@rpi4 ~]# /usr/local/bootstrap-openjdk17/bin/java -XX:-UseCompressedClassPointers -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-1) OpenJDK 64-Bit Server VM (build 17.0.1+12-1, mixed mode)
Comment 10 Mikael Urankar 2022-05-19 08:15:24 UTC