Hello,

This really has nothing to do with JPRT.

What you are introducing is a new kind of native test binary that has a dependency on libjvm.so. So far we haven't had any of these, so the native jtreg compilation does not depend on building hotspot first, and the LDFLAGS used for linking do not add the directory of the libjvm. Fixing this is non trivial and further shows the necessity of a flags cleanup we have planned for a while, but not yet had time for. I've made an attempt at just fixing this particular LDFLAG here:

http://cr.openjdk.java.net/~erikj/native-tests-depend-on-libjvm/webrev.01/

There are warnings in the build of invoke.c so I had to disable warnings are errors to get it to work. (I also had to fix TestFilesCompilation.gmk to actually honor disabling warnings as errors).

Please see if this works for you.

/Erik

On 2016-05-17 15:26, Gerald Thornbrugh wrote:
Hi Everyone

I am trying to fix JDK-8144278 which is a bug to convert a "c" source file test from being built at test run time to being built and included in the test bundle. The test relies on the "jvm" library to call JVM functions from a
"c" program.

Here are my changes to JtregNative.gmk:

diff -r 13a7f3426b89 make/test/JtregNative.gmk
--- a/make/test/JtregNative.gmk Thu Apr 14 20:43:16 2016 -0700
+++ b/make/test/JtregNative.gmk Mon May 09 07:51:26 2016 -0700
@@ -59,6 +59,15 @@
     $(HOTSPOT_TOPDIR)/test/runtime/ThreadSignalMask
 endif

+ifeq ($(OPENJDK_TARGET_OS), linux)
+BUILD_HOTSPOT_JTREG_NATIVE_SRC += \
+    $(HOTSPOT_TOPDIR)/test/runtime/StackGuardPages
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), linux)
+    BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread
+endif
+
 ifeq ($(TOOLCHAIN_TYPE), solstudio)
     BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc
 endif



The current test sets LD_LIBRARY_PATH like this:

LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH


Here is the JPRT job:

http://scaaa637.us.oracle.com//archive/2016/05/2016-05-09-131846.gthornbr.jdk9

It looks like when the "-ljvm" option is being specified at link time correctly but the "jvm" library cannot be found (see the red text below).

Linking executable invoke
( /opt/jprt/jib-data/install/jpg/infra/builddeps/devkit-linux_x64/gcc4.9.2-OEL6.4+1.0/devkit-linux_x64-gcc4.9.2-OEL6.4+1.0.tar.gz/bin/gcc -Wl,-z,defs -Wl,-O1 -Wl,--allow-shlib-undefined -ljvm -lpthread --sysroot=/opt/jprt/jib-data/install/jpg/infra/builddeps/devkit-linux_x64/gcc4.9.2-OEL6.4+1.0/devkit-linux_x64-gcc4.9.2-OEL6.4+1.0.tar.gz/x86_64-unknown-linux-gnu/sysroot -o /scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/bin/invoke /scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/support/exeinvoke/exeinvoke.o > >(/usr/bin/tee /scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/support/exeinvoke/BUILD_TEST_invoke_link.log) 2> >(/usr/bin/tee /scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/support/exeinvoke/BUILD_TEST_invoke_link.log >&2) || ( exitcode=$? && /usr/bin/cp /scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/support/exeinvoke/BUILD_TEST_invoke_link.log /scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/make-support/failure-logs/support_test_hotspot_jtreg_native_support_exeinvoke_BUILD_TEST_invoke_link.log && exit $exitcode ) ) JtregNative.gmk:85: recipe for target '/scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/bin/invoke' failed make[3]: Leaving directory '/scratch/opt/jprt/T/P1/131846.gthornbr/s/hotspot/make/test' make/Main.gmk:377: recipe for target 'build-test-hotspot-jtreg-native' failed /scratch/opt/jprt/jib-data/install/jpg/infra/builddeps/devkit-linux_x64/gcc4.9.2-OEL6.4+1.0/devkit-linux_x64-gcc4.9.2-OEL6.4+1.0.tar.gz/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -ljvm
collect2: error: ld returned 1 exit status
make[3]: *** [/scratch/opt/jprt/T/P1/131846.gthornbr/s/build/linux-x64/support/test/hotspot/jtreg/native/bin/invoke] Error 1
make[2]: *** [build-test-hotspot-jtreg-native] Error 1
make[2]: *** Waiting for unfinished jobs....


So it looks like LD_LIBRARY_PATH needs to include the jvm library.

Is there a way I can do this in the hotspot/make/test/JtregNative.gmk file?

What is the JPRT path I need to use to include the jvm library?

Thanks!

Jerry

Reply via email to