cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so

Bob Vandette bob.vandette at oracle.com
Tue Feb 28 15:55:56 UTC 2017


I just cloned the latest http://hg.openjdk.java.net/jdk9/dev
and was able to successfully build OpenJDK with the minimalvm.

Here’s my configure script.

/export/users/bobv/jdk9devopenonly/configure --enable-option-checking=fatal --build=x86_64-unknown-linux-gnu --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-jdk-variant=normal  --with-jvm-variants=minimal  --with-x=/java/embedded/buildtools/gcc/linux/arm/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr/X11R6-PI  --with-alsa=/java/embedded/buildtools/gcc/linux/arm/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr/include/alsa   --with-abi-profile=arm-vfp-sflt  --with-cups-include=/java/devtools/share/cups/include/  --with-devkit=/java/embedded/buildtools/gcc/linux/arm/arm-linaro-4.7  --with-build-devkit=/java/devtools/linux/devkit/gcc4.9.2-OEL6.4  --with-debug-level=release  --with-freetype-lib=/java/embedded/buildtools/freetype-2.6.2/build_linux-arm//lib  --with-freetype-include=/java/embedded/buildtools/freetype-2.6.2/build_linux-arm//include/freetype2  --disable-warnings-as-errors

Note: I had to apply this fix in order to build arm-vfp-sflt ABI profile.  This fix will be in the mainline soon.

   https://bugs.openjdk.java.net/browse/JDK-8175567


Bob.

> On Feb 28, 2017, at 5:11 AM, David Holmes <David.Holmes at oracle.com> wrote:
> 
> On 28/02/2017 7:35 PM, David Holmes wrote:
>> On 28/02/2017 6:51 PM, Zhu Yong wrote:
>>> Dear All,
>>> 
>>> I am testing cross compile OpenJDK-9+158 for our embedded system using
>>> buildroot, I can build server and client variants successfully, but the
>>> output compact1 profile file size is too big, then I tried to build
>>> minimal
>>> variant, failed when linking libjvm.so.
>>> 
>>> I checked build/linux-arm-normal-minimal-release/hotspot/variant-minimal/
>>> libjvm/objs/_BUILD_LIBJVM_objectfilenames.txt, jvmtiEnvBase.o
>>> and jvmtiEnvThreadState.o are not listed in the file (which is required
>>> from the error message below).
>> 
>> Right - JVM TI is not part of the Minimal VM. At the moment it looks
>> like some service has either been enabled when it should not have been,
>> or has not been correctly if'def in the source.
> 
> As far as I can see your error messages are complaining about missing functions that are called from the same sources as the functions that are missing! ie.
> 
> undefined reference to
> `JvmtiEnvBase::get_current_contended_monitor(JavaThread*, JavaThread*,
> _jobject**)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function `VM_GetOwnedMonitorInfo::doit()
> 
> but VM_GetOwnedMonitorInfo is defined in jvmtiEnv.cpp which should be included or excluded the same as jvmtiEnBase.cpp. Here's the logic in the makefile that controls this:
> 
> ifneq ($(call check-jvm-feature, jvmti), true)
>  JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0
>  JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \
>      jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
>      jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
>      jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
>      jvmtiClassFileReconstituter.cpp
> endif
> 
> Can you run with LOG=trace so that each compiled file is listed in the build log, then see if there are any jvmti* files listed there.
> 
> Thanks,
> David
> 
> 
> 
>> Can you provide the lines from your spec.gmk that define the
>> JVM_FEATURES_* variables please.
>> 
>> Thanks,
>> David
>> ------
>> 
>>> 
>>> === Output from failing command(s) repeated here ===
>>> * For target hotspot_variant-minimal_libjvm_objs_BUILD_LIBJVM_link:
>>> /tmp/cc27HS5M.ltrans0.ltrans.o: In function `VM_GetStackTrace::doit()
>>> [clone .local.640]':
>>> cc27HS5M.ltrans0.o:(.text+0xce5e): undefined reference to
>>> `JvmtiEnvBase::get_stack_trace(JavaThread*, int, int, _jvmtiFrameInfo*,
>>> int*)'
>>> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
>>> `VM_GetCurrentContendedMonitor::doit()
>>> [clone .local.639]':
>>> cc27HS5M.ltrans0.o:(.text+0xcec2): undefined reference to
>>> `JvmtiEnvBase::get_current_contended_monitor(JavaThread*, JavaThread*,
>>> _jobject**)'
>>> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
>>> `VM_GetOwnedMonitorInfo::doit()
>>> [clone .local.638]':
>>> cc27HS5M.ltrans0.o:(.text+0xcf26): undefined reference to
>>> `JvmtiEnvBase::get_owned_monitors(JavaThread*, JavaThread*,
>>> GrowableArray<_
>>> jvmtiMonitorStackDepthInfo*>*)'
>>> /tmp/cc27HS5M.ltrans0.ltrans.o: In function `VM_GetFrameCount::doit()
>>> [clone .local.637]':
>>> cc27HS5M.ltrans0.o:(.text+0xcf8a): undefined reference to
>>> `JvmtiEnvBase::get_frame_count(JvmtiThreadState*, int*)'
>>> /tmp/cc27HS5M.ltrans0.ltrans.o: In function `VM_SetFramePop::doit()
>>> [clone
>>> .local.636]':
>>> cc27HS5M.ltrans0.o:(.text+0xcfea): undefined reference to
>>> `JvmtiThreadState::count_frames()'
>>> cc27HS5M.ltrans0.o:(.text+0xd030): undefined reference to
>>> `JvmtiEnvThreadState::set_frame_pop(int)'
>>> /tmp/cc27HS5M.ltrans0.ltrans.o: In function `VM_GetFrameLocation::doit()
>>> [clone .local.641]':
>>>   ... (rest of output omitted)
>>> 
>>> 
>>> My configuration:
>>> 
>>> --with-jdk-variant=normal \
>>> --with-jvm-variants=minimal \
>>> --with-debug-level=release \
>>> --disable-warnings-as-errors \
>>> --disable-hotspot-gtest \
>>> --with-abi-profile=arm-vfp-sflt \
>>> --openjdk-target=$(GNU_TARGET_NAME) \
>>> --with-sys-root=$(STAGING_DIR) \
>>> --with-tools-dir=$(HOST_DIR) \
>>> --with-freetype-include=$(STAGING_DIR)/usr/include \
>>> --with-freetype-lib=$(STAGING_DIR)/usr/lib \
>>> --with-freetype=$(STAGING_DIR)/usr/ \
>>> --with-alsa-include=$(STAGING_DIR)/usr/include \
>>> --with-alsa-lib=$(STAGING_DIR)/usr/lib \
>>> --with-alsa=$(STAGING_DIR)/usr/ \
>>> --with-cups=$(STAGING_DIR)/usr/ \
>>> --with-x=$(STAGING_DIR)/usr/include \
>>> --with-extra-ldflags=--sysroot=$(STAGING_DIR) \
>>> --enable-headless-only \
>>> --disable-freetype-bundling \
>>> --enable-unlimited-crypto \
>>> --with-boot-jdk=/opt/java/jdk1.8.0_102
>>> 




More information about the build-dev mailing list