Closed AntonKozlov closed 5 years ago
May be useful: https://bugs.openjdk.java.net/browse/JDK-8199138
I've managed to build it and it seems to work (takes more than a minute to run hello world, but whatever). I've documented everything here: https://github.com/azul-research/jdk-riscv/blob/zero-compiling/dev-riscv/docs/CROSS_COMPILING.md
Now we need somebody to create docker image with the toolchain and jdk's dependencies.
https://github.com/azul-research/jdk-riscv/blob/zero-compiling/dev-riscv/docs/CROSS_COMPILING.md
Wow, great! Dependencies up to "Building OpenJDK zero" will be required to cross-compilation too. I propose to persist them once and reuse.
A docker image with toolchain is good place to store these
I dockerized toolchain with OpenJDK dependencies: https://github.com/azul-research/jdk-riscv/tree/riscv/dev-riscv/toolchain
Thank you!
A couple of notes:
zip
/unzip
are as wellI see zero builds, great! Can you make a Pull Request after those minors fixed?
I see zero builds, great! Can you make a Pull Request after those minors fixed?
Sorry, I meant zero-compiling
branch
Seems like cross-compiling environment and target emu-user are different. This leads to problems like
$ ./build/linux-riscv64-zero-release/jdk/bin/java -version
Error: dl failure on line 603
Error: failed /jdk/build/linux-riscv64-zero-release/jdk/lib/server/libjvm.so, because libffi.so.7: cannot open shared object file: No such file or directory
The problem is that for user-emu repos have only ffi.so.6
$ ldd /lib/riscv64-linux-gnu/libffi.so.6
libc.so.6 => /lib/riscv64-linux-gnu/libc.so.6 (0x0000004000827000)
/lib/ld-linux-riscv64-lp64d.so.1 (0x0000004000000000)
This is solved by mounting /opt/riscv/sysroot
and configuring the dynamic linker to look for libraries at appropriate locations.
This works!
$ docker ps
f2d86469ddb6 tsarn/riscv-toolchain
$ docker cp f2d86469ddb6:/opt/riscv/sysroot riscv-sysroot
cont$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/riscv-sysroot/usr/lib/
cont$ time ./build/linux-riscv64-zero-release/jdk/bin/java -version
openjdk version "13-internal" 2019-09-17
OpenJDK Runtime Environment (build 13-internal+0-adhoc..jdk)
OpenJDK 64-Bit Zero VM (build 13-internal+0-adhoc..jdk, interpreted mode)
real 1m48.637s
user 1m47.335s
sys 0m0.810s
zero build for x86 (host).
To be combined #3 and get a first RISC-V working binary. Be able to start it emulator (#2)