From 7c1a735e15b0b5168ffd7ad98509064550382da8 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Thu, 16 Oct 2025 12:16:13 +0300 Subject: [PATCH] spec: fix bootstrap build on i586 The problem: straightforward java17-based build fails with * What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used.For more details on the daemon, please refer to https://docs.gradle.org/8.14-rc-3/userguide/gradle_daemon.html in the Gradle documentation. Process command line: /usr/lib/jvm/java-17-openjdk-17.0.16.0.8-alt1.i586/bin/java [...] -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Xmx3100m [...] Please read the following process output to find out more: ----------------------- Error occurred during initialization of VM Could not reserve enough space for 3174400KB object heap Getting -Xmx down to e.g. 1700m from initial 3100m (the guesswork being "about half of 64-bit heap size and no more than 2048m") results in: * What went wrong: Could not determine the dependencies of task ':docs:compileJava'. > Failed to calculate the value of task ':docs:compileJava' property 'javaCompiler'. > Cannot find a Java installation on your machine (Linux 6.12.50-6.12-alt1 i386) matching: {languageVersion=21, vendor=any vendor, implementation=vendor-specific, nativeImageCapable=false}. Some toolchain resolvers had internal failures: foojay (Service 'SystemInfo' is not available (os=Linux 6.12.50-6.12-alt1 i386, enabled=false).). I was unable to find the culprit for this one, but we don't build and package docs here anyways so skipping :docs:compileJava target for i586 (maybe globally) was found to be the workaround. This resulted in: > Task :docs:dslStandaloneDocbook The message received from the daemon indicates that the daemon has disappeared. [...] JVM crash log found: file:///usr/src/RPM/BUILD/gradle-8.14.1/.gradle/daemon/8.14-rc-3/hs_err_pid2882760.log with the said log stating: # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 16777216 bytes. Error detail: Failed to reserve memory for metaspace Decreasing -Xmx further down to 1500m has solved this. See-also: http://bugzilla.altlinux.org/56409 See-also: http://altlinux.org/SecurePackagingPolicy --- .gear/gradle.spec | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gear/gradle.spec b/.gear/gradle.spec index d446f4fdb76..948eb45259c 100644 --- a/.gear/gradle.spec +++ b/.gear/gradle.spec @@ -10,7 +10,6 @@ License: Apache-2.0 Group: Development/Java Url: https://gradle.org Vcs: https://github.com/gradle/gradle.git -ExcludeArch: i586 Source0: %name-%version.tar Source1: %name-%version-vendor.tar @@ -29,7 +28,9 @@ BuildRequires: /proc BuildRequires: rpm-build-java-osgi BuildRequires: java-11-openjdk-devel BuildRequires: java-17-openjdk-devel +%ifnarch %ix86 BuildRequires: java-21-openjdk-devel +%endif BuildRequires: git %description @@ -59,10 +60,21 @@ export GRADLE_USER_HOME="$PWD/.gradle" COMMITHASH=$(./commit.sh) +%ifarch %ix86 +# reduce heap size to fix 32-bit build; see also ALT#56409 +find -type f -name gradle.properties -print0 | + xargs -r0 sed -i 's,-Xmx3100m,-Xmx1500m,' +%endif + # Skip task :docs:javadocAll that requires .git directory. ./gradlew installAll \ -x :docs:javadocAll \ +%ifarch i586 + -x :docs:compileJava \ + -Porg.gradle.java.installations.paths="%_jvmdir/java-11-openjdk,%_jvmdir/java-17-openjdk" \ +%else -Porg.gradle.java.installations.paths="%_jvmdir/java-11-openjdk,%_jvmdir/java-17-openjdk,%_jvmdir/java-21-openjdk" \ +%endif -Porg.gradle.java.installations.auto-detect=false \ -Pgradle_installPath="$PWD/dist" \ -PfinalRelease=true \ -- 2.50.1