Re: cross-compile JDK 14 with arm-linux-gnueabihf target
Thank you so much for the help! The build JDK must have been the issue -- I was able to build a native JDK for the host Linux x86 platform that I am building on, and everything worked out when I provided that as the build JDK. (I still had to keep all the configure flags though. The build couldn't find the correct libraries when I took some of them out...) On Mon, Apr 20, 2020 at 5:41 PM Erik Joelsson wrote: > Hello Jiwon, > > Are you able to build a native JDK for the x86 platform you are running > the build on or is that giving the same errors? > > Since JDK 9, when cross compiling, we need a native JDK to run some of > the build steps with (jmod and jlink mainly). This native JDK (referred > to as the "build" jdk in configure and the makefiles) has to match the > version you are cross compiling exactly. If one is not provided, the > default is to build one on the fly using the sources present, but we > only compile the modules necessary to run the build steps. > > A way to work around this is to explicitly build a native JDK from the > same sources first, and then provide that image to the cross compilation > build using --with-build-jdk=... That may help you here, not sure. It > may at least be easier to troubleshoot the native build if done > explicitly. Especially if you need to disable warnings in that build as > well. > > I don't think you need all of those configure arguments. Configure > should find the correct compiler for your target if present on your > path. The sysroot setting should get you the correct system include > paths etc. If freetype is installed in your sysroot in a reasonable > location, it should be found automatically. Disabling warnings should be > done using --disable-warnings-as-errors. Linking stdc++ static should be > done with --with-stdc++lib=,,. > > /Erik > > On 2020-04-20 14:04, Choe, Jiwon wrote: > > Hello all, > > > > I'm trying to cross-compile OpenJDK 14 to target arm-linux-gnueabihf, and > > the build is failing for me with these errors: > > > > === Output from failing command(s) repeated here === > > * For target buildjdk_hotspot_variant-server_libjvm_objs_os_linux_x86.o: > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp: In > > static member function 'static u_char* os::Linux::ucontext_get_pc(const > > ucontext_t*)': > > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:120:35: > > error: 'const mcontext_t' has no member named 'gregs' > > return (address)uc->uc_mcontext.gregs[REG_PC]; > > ^ > > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:90:16: > > error: 'REG_EIP' was not declared in this scope > > #define REG_PC REG_EIP > > ^ > > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:120:41: > > note: in expansion of macro 'REG_PC' > > return (address)uc->uc_mcontext.gregs[REG_PC]; > > ^ > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp: In > > static member function 'static void > os::Linux::ucontext_set_pc(ucontext_t*, > > address)': > > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:124:19: > > error: 'mcontext_t' has no member named 'gregs' > > uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; > > ^ > > > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:90:16: > > error: 'REG_EIP' was not declared in this scope > > ... (rest of output omitted) > > > > > > Although my build system is 32-bit x86 Linux, I'm confused because it > seems > > odd that a cross-compile for ARM would need to compile something in a > > linux_x86 directory. > > > > > > These are the steps I took for the build: > > > > 1. sudo qemu-debootstrap --arch=armhf --verbose > > > --include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libfreetype6-dev,libasound2-dev,libc6-dev,gcc-multilib,g++-multilib > > --resolve-deps trusty /opt/sysroot/ > > > > 2. bash configure --openjdk-target=arm-linux-gnueabihf > > --with-sysroot=/opt/sysroot/ > > --with-freetype-include=/opt/sysroot/usr/include/freetype2 > > --with-freetype-lib=/opt/sysroot/usr/lib/arm-linux-gnueabihf > > --with-extra-cflags='-Wno-error > > -I/opt/sysroot/usr/include/arm-linux-gnueabihf/c++/4.8 > > -I/opt/sysroot/usr/include/c++/4.8' --with-extra-cxxflags='-Wno-error > > -I/opt/sysroot/usr/include/arm-linux-gnueabihf/c++/4.8 > > -I/opt/sysroot/usr/include/c++/4.8' --with-stdc++lib=static > > CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ > > > > 3. make images > > > > > > The steps above worked for me when I tried the same cross-compile for JDK > > 8. I had an additional flag --with-jvm-variants=client in the configure > > stage for JDK 8. I tried both client and server variants for JDK 14, and > I > > get the same error. > > > > If anyone has insight into how to fix
Re: cross-compile JDK 14 with arm-linux-gnueabihf target
Hello Jiwon, Are you able to build a native JDK for the x86 platform you are running the build on or is that giving the same errors? Since JDK 9, when cross compiling, we need a native JDK to run some of the build steps with (jmod and jlink mainly). This native JDK (referred to as the "build" jdk in configure and the makefiles) has to match the version you are cross compiling exactly. If one is not provided, the default is to build one on the fly using the sources present, but we only compile the modules necessary to run the build steps. A way to work around this is to explicitly build a native JDK from the same sources first, and then provide that image to the cross compilation build using --with-build-jdk=... That may help you here, not sure. It may at least be easier to troubleshoot the native build if done explicitly. Especially if you need to disable warnings in that build as well. I don't think you need all of those configure arguments. Configure should find the correct compiler for your target if present on your path. The sysroot setting should get you the correct system include paths etc. If freetype is installed in your sysroot in a reasonable location, it should be found automatically. Disabling warnings should be done using --disable-warnings-as-errors. Linking stdc++ static should be done with --with-stdc++lib=,,. /Erik On 2020-04-20 14:04, Choe, Jiwon wrote: Hello all, I'm trying to cross-compile OpenJDK 14 to target arm-linux-gnueabihf, and the build is failing for me with these errors: === Output from failing command(s) repeated here === * For target buildjdk_hotspot_variant-server_libjvm_objs_os_linux_x86.o: /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp: In static member function 'static u_char* os::Linux::ucontext_get_pc(const ucontext_t*)': /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:120:35: error: 'const mcontext_t' has no member named 'gregs' return (address)uc->uc_mcontext.gregs[REG_PC]; ^ /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:90:16: error: 'REG_EIP' was not declared in this scope #define REG_PC REG_EIP ^ /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:120:41: note: in expansion of macro 'REG_PC' return (address)uc->uc_mcontext.gregs[REG_PC]; ^ /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp: In static member function 'static void os::Linux::ucontext_set_pc(ucontext_t*, address)': /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:124:19: error: 'mcontext_t' has no member named 'gregs' uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; ^ /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:90:16: error: 'REG_EIP' was not declared in this scope ... (rest of output omitted) Although my build system is 32-bit x86 Linux, I'm confused because it seems odd that a cross-compile for ARM would need to compile something in a linux_x86 directory. These are the steps I took for the build: 1. sudo qemu-debootstrap --arch=armhf --verbose --include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libfreetype6-dev,libasound2-dev,libc6-dev,gcc-multilib,g++-multilib --resolve-deps trusty /opt/sysroot/ 2. bash configure --openjdk-target=arm-linux-gnueabihf --with-sysroot=/opt/sysroot/ --with-freetype-include=/opt/sysroot/usr/include/freetype2 --with-freetype-lib=/opt/sysroot/usr/lib/arm-linux-gnueabihf --with-extra-cflags='-Wno-error -I/opt/sysroot/usr/include/arm-linux-gnueabihf/c++/4.8 -I/opt/sysroot/usr/include/c++/4.8' --with-extra-cxxflags='-Wno-error -I/opt/sysroot/usr/include/arm-linux-gnueabihf/c++/4.8 -I/opt/sysroot/usr/include/c++/4.8' --with-stdc++lib=static CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ 3. make images The steps above worked for me when I tried the same cross-compile for JDK 8. I had an additional flag --with-jvm-variants=client in the configure stage for JDK 8. I tried both client and server variants for JDK 14, and I get the same error. If anyone has insight into how to fix or work around this issue, please let me know! Thanks in advance, Jiwon Choe
Re: cross-compile JDK 14 with arm-linux-gnueabihf target
Is the ARM compiler on your path? I use the —with-devkit configure option to point to the compiler. Bob. > On Apr 20, 2020, at 5:04 PM, Choe, Jiwon wrote: > > Hello all, > > I'm trying to cross-compile OpenJDK 14 to target arm-linux-gnueabihf, and > the build is failing for me with these errors: > > === Output from failing command(s) repeated here === > * For target buildjdk_hotspot_variant-server_libjvm_objs_os_linux_x86.o: > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp: In > static member function 'static u_char* os::Linux::ucontext_get_pc(const > ucontext_t*)': > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:120:35: > error: 'const mcontext_t' has no member named 'gregs' > return (address)uc->uc_mcontext.gregs[REG_PC]; > ^ > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:90:16: > error: 'REG_EIP' was not declared in this scope > #define REG_PC REG_EIP >^ > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:120:41: > note: in expansion of macro 'REG_PC' > return (address)uc->uc_mcontext.gregs[REG_PC]; > ^ > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp: In > static member function 'static void os::Linux::ucontext_set_pc(ucontext_t*, > address)': > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:124:19: > error: 'mcontext_t' has no member named 'gregs' > uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; > ^ > /home/sim32/jdk14/jdk14/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:90:16: > error: 'REG_EIP' was not declared in this scope > ... (rest of output omitted) > > > Although my build system is 32-bit x86 Linux, I'm confused because it seems > odd that a cross-compile for ARM would need to compile something in a > linux_x86 directory. > > > These are the steps I took for the build: > > 1. sudo qemu-debootstrap --arch=armhf --verbose > --include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libfreetype6-dev,libasound2-dev,libc6-dev,gcc-multilib,g++-multilib > --resolve-deps trusty /opt/sysroot/ > > 2. bash configure --openjdk-target=arm-linux-gnueabihf > --with-sysroot=/opt/sysroot/ > --with-freetype-include=/opt/sysroot/usr/include/freetype2 > --with-freetype-lib=/opt/sysroot/usr/lib/arm-linux-gnueabihf > --with-extra-cflags='-Wno-error > -I/opt/sysroot/usr/include/arm-linux-gnueabihf/c++/4.8 > -I/opt/sysroot/usr/include/c++/4.8' --with-extra-cxxflags='-Wno-error > -I/opt/sysroot/usr/include/arm-linux-gnueabihf/c++/4.8 > -I/opt/sysroot/usr/include/c++/4.8' --with-stdc++lib=static > CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ > > 3. make images > > > The steps above worked for me when I tried the same cross-compile for JDK > 8. I had an additional flag --with-jvm-variants=client in the configure > stage for JDK 8. I tried both client and server variants for JDK 14, and I > get the same error. > > If anyone has insight into how to fix or work around this issue, please let > me know! > > Thanks in advance, > Jiwon Choe