cross-compile of openjdk for riscv64

Abhishek Kumar Abhishek.kumar at exaleapsemi.com
Mon May 9 12:32:43 UTC 2022


Hi,

I am trying to compile openjdk for riscv64 and the sources used these https://openjdk.java.net/projects/riscv-port.
OpenJDK: RISC-V Port Project<https://openjdk.java.net/projects/riscv-port>
RISC-V Port Project. The goal of this Project is to deliver a full-featured port of OpenJDK on the Linux/RISC-V platform which may be integrated into the main OpenJDK development branch.. This Project is sponsored by the Porters Group.. Community. Members; Mailing list riscv-port-dev (); Links Repository; Wiki page
openjdk.java.net


I tried bellow steps to build jdk.
(1) setup toolchain and libs:

export RISCV64=path to toolchain
export LD_LIBRARY_PATH=$RISCV64/lib64:/usr/local/gcc/lib64:/usr/local/gcc/lib
export PATH="$RISCV64/bin:$PATH"
export CC=$RISCV64/bin/riscv64-unknown-linux-gnu-gcc
export CXX=$RISCV64/bin/riscv64-unknown-linux-gnu-g++

(2) configure:

bash configure --openjdk-target=riscv64-unknown-linux-gnu BUILD_CC=../../install/bin/riscv64-unknown-linux-gnu-gcc BUILD_CXX=../../install/bin/riscv64-unknown-linux-gnu-g++ --with-boot-jdk=../boot-jdk/jdk-18.0.1.1/ --with-sysroot=../../rootfs/


(3)compile:
make all

so all these steps I followed ,configure is successfull but I am getting error in make ,bellow is the error, please help me out how can I fix it.

abhishek at virtual-machine:~/abhi/jdk$ make
Building target 'default (exploded-image)' in configuration 'linux-riscv64-server-release'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Compiling 1 files for BUILD_TOOLS_HOTSPOT
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
Compiling 17 properties into resource bundles for jdk.javadoc
Generating classes for compiler.properties launcher.properties
Compiling 15 properties into resource bundles for jdk.jdeps
Compiling 9 properties into resource bundles for jdk.jshell
Compiling 20 properties into resource bundles for jdk.compiler
Compiling 127 files for BUILD_java.compiler.interim
Compiling 406 files for BUILD_jdk.compiler.interim
Compiling 242 files for BUILD_jdk.javadoc.interim
Creating support/modules_libs/java.base/server/libjvm.so from 1052 file(s)
Compiling 186 files for BUILD_TOOLS_JDK
Compiling 2 files for COMPILE_DEPEND
/home/abhishek/abhi/jdk/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template:29:10: fatal error: stdio.h: No such file or directory
29 | #include <stdio.h>
| ^~~~~~~~~
compilation terminated.
gensrc/GensrcMisc.gmk:95: recipe for target '/home/abhishek/abhi/jdk/build/linux-riscv64-server-release/support/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java' failed
make[3]: *** [/home/abhishek/abhi/jdk/build/linux-riscv64-server-release/support/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java] Error 1
make[3]: *** Deleting file '/home/abhishek/abhi/jdk/build/linux-riscv64-server-release/support/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java'
make[3]: *** Waiting for unfinished jobs....
make/Main.gmk:110: recipe for target 'java.base-gensrc-src' failed
make[2]: *** [java.base-gensrc-src] Error 2
make[2]: *** Waiting for unfinished jobs....


Thanks,
Abhishek Kumar



More information about the riscv-port-dev mailing list