adoptium / temurin-build

Eclipse Temurin™ build scripts - common across all releases/versions
Apache License 2.0
1k stars 243 forks source link

Failed to make the JDK #3792

Open manojniit opened 2 months ago

manojniit commented 2 months ago

What are you trying to do? I'm trying to build the java temurin-jdk. but i got the below exception. Where i need to change the compiler settings?

Observed behaviour:

An exception has occurred in the compiler (19.0.2). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you. java.io.UncheckedIOException: java.nio.file.FileSystemException: .: Value too large for defined data type at java.base/java.nio.file.Files$2.hasNext(Files.java:3802) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1921) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$DirectoryContainer.list(JavacFileManager.java:491) at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:778) at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:750) at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:687) at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:568) at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:312) at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$addRootPackageFor$8(Symtab.java:827) at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:682) at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:356) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:549) at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:286) at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:301) at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:604) at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:588) at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1042) at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:917) at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317) at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176) at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64) at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50) Caused by: java.nio.file.FileSystemException: .: Value too large for defined data type at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100) at java.base/sun.nio.fs.UnixException.asIOException(UnixException.java:115) at java.base/sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterator.readNextEntry(UnixDirectoryStream.java:168) at java.base/sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterator.hasNext(UnixDirectoryStream.java:198) at java.base/java.nio.file.Files$2.hasNext(Files.java:3800) ... 29 more printing javac parameters to: /app/workspace/build/src/make/hotspot/javac.20240506_195918.args gmake[3]: [gensrc/GensrcJvmti.gmk:36: /app/workspace/build/src/build/linux-arm-server-release/hotspot/variant-server/tools/jvmti/_the.BUILD_JVMTI_TOOLS_batch] Error 4 gmake[2]: [make/Main.gmk:245: hotspot-server-gensrc] Error 2 gmake[2]: Waiting for unfinished jobs.... Compiling up to 245 files for BUILD_jdk.javadoc.interim Compiling up to 17 files for BUILD_JAVAC_SERVER error: cannot read directory /app/workspace/build/src/build/linux-arm-server-release/buildtools/interim_langtools_modules 1 error gmake[3]: [CompileInterimLangtools.gmk:124: /app/workspace/build/src/build/linux-arm-server-release/buildtools/interim_langtools_modules/java.compiler.interim/_the.BUILD_java.compiler.interim_batch] Error 1 gmake[3]: Waiting for unfinished jobs.... gmake[2]: [make/Main.gmk:78: interim-langtools] Error 2

ERROR: Build failed for targets 'images legacy-jre-image test-image static-libs-image' in configuration 'linux-arm-server-release' (exit code 2)

=== Output from failing command(s) repeated here ===

No indication of failed target found. HELP: Try searching the build log for '] Error'. HELP: Run 'make doctor' to diagnose build problems.

make[1]: [/app/workspace/build/src/make/Init.gmk:320: main] Error 2 make: [/app/workspace/build/src/make/Init.gmk:186: images] Error 2 OpenJDK make failed, archiving make failed logs Copying build.log to TemurinLogsArchive Copying make-support/failure-logs to TemurinLogsArchive Archiving and compressing with gzip gzip: warning: GZIP environment variable is deprecated; use an alias or script

real 0m0.052s user 0m0.070s sys 0m0.015s Your archive was created as /app/workspace/build/src/build/linux-arm-server-release/OpenJDK.tar.gz Moving the artifact to location /app/workspace/target//OpenJDK-makefailurelogs.tar.gz archive done. Failed to make the JDK, exiting****

Any other comments:

Can anyone help me with this?

karianna commented 2 months ago

It's looks like you're trying to build Java 19 which is no longer under support. Have you tried building an LTS version (17 or 21)?

karianna commented 2 months ago

Is this for Arm32?

manojniit commented 2 months ago

Yes, it was originally intended for arm32 architecture, but Temurin builds no longer support arm32. Therefore, I've switched to building for arm64 architecture. Now, I'm unsure about the specific compiler settings that need to be adjusted to successfully build OpenJDK using Temurin.

karianna commented 2 months ago

Can you post what command you used with makejdk-any-platform.sh?

judovana commented 2 months ago

Ugh. Can you spare us some time, and pinpoint a bit more directly what you re trying to do?

Usually calling to makejdk_any_platform.sh do not need tha tmuch logic. I had brieafly looked over Dockerfile, build.sh and docker-img.sh and noticed few things:

in docker file is arm64v8 in build sh is -platform linux/arm/v8 \ maybe it does not meter,but for sure it is not arm32. The call to makejdk-any-platform is not visible and COPY assets/jvm/jdk19 really do not sound right. Please update to 21 or downgrade to 17.

Why there is copy of temurin-repo? Are there osme changes? I'm not brave enough to launch this:)

manojniit commented 2 months ago

This is what I'm trying to do

In order to keep using the latest Java versions and features, I have to create the JDK and JRE ourselves. I want to make this task as automated as possible.

I've managed to make JDK and JRE Debian packages work for Java 21 on a Raspberry Pi. But this process takes a lot of time and isn't good for doing over and over again.

So, I've software and scripts on the Docker Server temurin" directory. I'm trying to build "arm32" JDKs on the server using Docker and QEMU. But until now, I haven't been successful in building the images.

karianna commented 2 months ago

@manojniit I cannot tell from your build scripts how and where you are following instructions similar to:

https://github.com/adoptium/temurin-build?tab=readme-ov-file#how-do-i-build-openjdk-in-a-docker-image

sxa commented 2 months ago

@manojniit I cannot tell from your build scripts how and where you are following instructions similar to: https://github.com/adoptium/temurin-build?tab=readme-ov-file#how-do-i-build-openjdk-in-a-docker-image

I don't believe --docker supports the QEMU environment that the OP is trying to use here, although it would probably work natively on an arm32 machine.

So, I've software and scripts on the Docker Server temurin" directory. I'm trying to build "arm32" JDKs on the server using Docker and QEMU. But until now, I haven't been successful in building the images.

Hi @manojniit, it should work ok ... You can use our pre-built docker images for running the build to make things simpler:

docker run --platform linux/arm/v7 -it adoptoptopenjdk/ubuntu1604_build_image

We create that build image from this Dockerfile and publish it at Dockerhub so you don't need to build it yourself but I'm giving you the link in case you want to build it yourself.

It sounds like your goal is to build a version of JDK21 for Arm32 which Temurin does not currently provide. To do this you will also need an Arm32 JDK20 or 21 to use as the boot JDK. You can get an "Early access" Temurin 20 build from us which will be suitable as a boot JDK - it just hasn't gone through all of our testing process. You could start with JDK19, use that as a boot JDK to build a JDK20, then use your built 20 to build 21 but it's simpler to use our 20-ea build.

The only other thing you'll need to define within that image is the compiler, since the default gcc 5.4 in Ubuntu 16.04 is not suitable for building JDK21. The following steps should allow you to build a JDK21 within the container with GCC11.2 - the same version we use for JDK21 on most other architectures:

git clone https://github.com/adoptium/temurin-build
cd temurin-build
curl -L https://api.adoptium.net/v3/binary/latest/20/ea/linux/arm/jdk/hotspot/normal/adoptium | tar xpfz -
export CC=/usr/local/gcc11/bin/gcc-11.2 
export CXX=/usr/local/gcc11/bin/g++-11.2 
./makejdk-any-platform.sh -J $PWD/jdk-20.0.2+9 jdk21u

Once that completes you should have a usable JDK as a tarball in target/OpenJDK-jdk.tar.gz. Note that this will build from the latest available JDK21 code (21.0.4+2-beta+2 at the time of writing). If you want to build a specific tagged version (The latest upstream GA level for other platforms was 21.0.3+9) you can specify it with -t like this:

./makejdk-any-platform.sh -J $PWD/jdk-20.0.2+9 -t jdk-21.0.3+9 --target-file-name OpenJDK21U-jdk_arm32_hotspot_21.0.3+9.tar.gz jdk21u

I've added the --target-file-name parameter to this example which is optional but might be useful to set the filename during the build instead of leaving it as just OpenJDK-jdk.tar.gz.

Hope that helps.

sxa commented 1 month ago

Actually I'm bit confused with the settings, Can you help me to update the settings in my dockerfile and shell script file inorder to build the jdk...

I'm still unclear on what you're trying to achieve. From your earlier message you said:

So, I've software and scripts on the Docker Server temurin" directory. I'm trying to build "arm32" JDKs on the server using Docker and QEMU. But until now, I haven't been successful in building the images.

Your commands above are pulling from FROM arm64v8/ubuntu:22.04 which is not going to build for arm32. The information in my earlier comment should allow you to build a JDK21 on arm32. Also your scripts seem to be trying to build JDK20 which is out of support so I would not recommend buildng and using that version - is there a reason for JDK20 instead of 21?

We cannot provide any assistance if the problem you're seeing with your scripts is related to the crash on JDK19 (which is also out of support) as per your original message.

sxa commented 1 month ago

That makes sense, but your scripts do not seem consistent with that - they are trying to use JDK19 to build JDK20 on aarch64, not JDK21 on arm32.

Are you able to configure your script to use the commands and docker images I gave earlier, which seem to be the ones that will allow you to easily meet your goals of creating a JDK21 on arm32 the same way we do.

sxa commented 1 month ago

On another note, I'd be very interested in knowing what you plan to use Arm32 JDK21 for - if you're able to willing to a add a comment into https://github.com/adoptium/adoptium-support/issues/962#issuecomment-1833339277 to say why you would find that useful that would be helpful so we can collect all such reasons in one place :-)

sxa commented 1 month ago

I'm about to go on vacation until June so I won't be able to provide any more advice, but I'm not sure what to suggest. if you are able to run the JDK to get this message out of the build summary in the arm32 container: openjdk version "20.0.2-beta" 2023-07-18 OpenJDK Runtime Environment Temurin-20.0.2+9-202309010331 (build 20.0.2-beta+9-202309010331) then there should be no problem with executing it later during the build, so this: Failed to create server process: Cannot run program "/temurin-build/jdk-20.0.2+9/bin/java": error=0, Failed to exec spawn helper: pid: 38146, exit value: 1 seems strange, since it was able to run java to get the version string during the configure stage.

manojniit commented 1 month ago

Hi, I didn't get the solution for the above problems. I tried your way as well, but it is also not working. I have been trying for 1 month. If you have any solution, I would appreciate your help. While researching the problem, I found out that the issue is with QEMU. I have provided the reference link below (https://gitlab.com/qemu-project/qemu/-/issues/263). I tried your way but got the spawn error. I gave all the permissions (https://stackoverflow.com/questions/61301818/java-failed-to-exec-spawn-helper-error-since-moving-to-java-14-on-linux), but I still didn't find any solution. If you have any solutions, please feel free to share them with me. I am trying to implement OpenJDK for Raspberry Pi for ARM 32.