Porting JNA to HP-UX 11i23 IA64

399 views
Skip to first unread message

Sam.Park

unread,
Jan 31, 2012, 10:31:19 PM1/31/12
to Java Native Access


Hi .

I am trying to port JNA to HP-UX 11i IA64 platform at this time .

I couldn't get success to make JNA library 32bit. but i can get 64bit
JNA library with 98.37%

success rate on unit test. all Failure of unit test come from
CallbacksTest I have 4 failures below :

CallbacksTest testCallbackThreadDefaults Failure Timed out waiting for
callback, invoked 0 times so far

junit.framework.AssertionFailedError: Timed out waiting for callback,
invoked 0 times so far
at com.sun.jna.CallbacksTest.callThreadedCallback(CallbacksTest.java:
923)
at
com.sun.jna.CallbacksTest.testCallbackThreadDefaults(CallbacksTest.java:
946)
5.016
CallbacksTest testCustomizeCallbackThread Failure Timed out waiting
for callback, invoked 0 times so far

junit.framework.AssertionFailedError: Timed out waiting for callback,
invoked 0 times so far
at com.sun.jna.CallbacksTest.callThreadedCallback(CallbacksTest.java:
923)
at
com.sun.jna.CallbacksTest.testCustomizeCallbackThread(CallbacksTest.java:
981)
5.026
CallbacksTest testCallbackThreadPersistence Failure Timed out waiting
for callback, invoked 0 times so far

junit.framework.AssertionFailedError: Timed out waiting for callback,
invoked 0 times so far
at com.sun.jna.CallbacksTest.callThreadedCallback(CallbacksTest.java:
923)
at
com.sun.jna.CallbacksTest.testCallbackThreadPersistence(CallbacksTest.java:
1011)
5.010
CallbacksTest testDynamicCallbackThreadPersistence Failure Timed out
waiting for callback, invoked 0 times so far

junit.framework.AssertionFailedError: Timed out waiting for callback,
invoked 0 times so far
at com.sun.jna.CallbacksTest.callThreadedCallback(CallbacksTest.java:
923)
at
com.sun.jna.CallbacksTest.testDynamicCallbackThreadPersistence(CallbacksTest.java:
1037)

And 3 Error . this errors make jvm crash.

CallbacksTest testCallNativeMappedCallback Error Forked Java VM exited
abnormally. Please note the time in the report does not reflect the
time until the VM exit.

junit.framework.AssertionFailedError: Forked Java VM exited
abnormally. Please note the time in the report does not reflect the
time until the VM exit.
0.003
LastErrorTest testThrowLastError Error Forked Java VM exited
abnormally. Please note the time in the report does not reflect the
time until the VM exit.

junit.framework.AssertionFailedError: Forked Java VM exited
abnormally. Please note the time in the report does not reflect the
time until the VM exit.
0.001
LibraryLoadTest testLoadLibraryWithUnicodeName Error Unable to load
library 'флсву': Mmap failed for the library</var/tmp/lib?????.so> :
Permission denied.

java.lang.UnsatisfiedLinkError: Unable to load library 'флсву': Mmap
failed for the library</var/tmp/lib?????.so> : Permission denied.
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:169)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:242)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:205)
at
com.sun.jna.LibraryLoadTest.testLoadLibraryWithUnicodeName(LibraryLoadTest.java:
114)


Because I will not use any callback features on native library . I can
use jna without any problem .
Please tell me what i can do to pas all failed and errored test If you
need any more information
I will do

Below are the changes i made to build jna

Build.xml

Added :

<condition property="os.prefix" value="hpux-${os.arch}">
<os name="HP-UX"/>
</condition>

native/Makefiles

I used gcc 4.1.0 and gmake

Added :
CC+= -mlp64
LD +=-mlp64

I added environment variable to mek jvm 64bit

export ANT_OPTS=-d64


Thanks
Park

Timothy Wall

unread,
Feb 1, 2012, 8:29:33 AM2/1/12
to jna-...@googlegroups.com
See comments below

On Jan 31, 2012, at 10:31 PM, Sam.Park wrote:

>
>
> Hi .
>
> I am trying to port JNA to HP-UX 11i IA64 platform at this time .
>
> I couldn't get success to make JNA library 32bit. but i can get 64bit
> JNA library with 98.37%
>
> success rate on unit test. all Failure of unit test come from
> CallbacksTest I have 4 failures below :

Since the other callback tests do not fail, it would appear that the native test code (libtest.so) is not able to properly spawn a new thread. It assumes the pthreads is available. There may be some extra stuff required on HP-UX to init/spawn new threads, or maybe it has different defaults than other platforms.

>
> CallbacksTest testCallbackThreadDefaults Failure Timed out waiting for
> callback, invoked 0 times so far

> CallbacksTest testCustomizeCallbackThread Failure Timed out waiting
> for callback, invoked 0 times so far

> CallbacksTest testCallbackThreadPersistence Failure Timed out waiting
> for callback, invoked 0 times so far

> CallbacksTest testDynamicCallbackThreadPersistence Failure Timed out
> waiting for callback, invoked 0 times so far
>

> And 3 Error . this errors make jvm crash.
>
> CallbacksTest testCallNativeMappedCallback

> LastErrorTest testThrowLastError

Please run each of these tests standalone and post the crash log.
e.g. java -Djna.library.path=build/native -cp build/test-classes:build/classes:lib/junit.jar com.sun.jna.CallbacksTest

> LibraryLoadTest testLoadLibraryWithUnicodeName Error Unable to load
> library 'флсву': Mmap failed for the library</var/tmp/lib?????.so> :
> Permission denied.

Are you sure this one crashed? it looks like there's a disagreement between Java and the system about how to map UTF16 filenames.

Timothy Wall

unread,
Feb 1, 2012, 8:34:18 AM2/1/12
to jna-...@googlegroups.com
You probably need to set the gcc "-mt"/"-pthread" flag on GCC in addition to -mlp64 when compiling libtest.so and libjnidispatch.so. Did you set -milp32 when attempting to compile for 32-bit?

Sam.Park

unread,
Feb 2, 2012, 4:08:39 AM2/2/12
to Java Native Access
Hi T.

I tried to set the gcc -mt/-pthread but it didn't work as expected.

When i tested callback tests It emited this error : JNA: Can't attach
native thread to VM for callback: -1;

I think it's coming from callback.c

else {
attach_status = (*jvm)->AttachCurrentThread(jvm, (void *)&env,
&args);
}
if (attach_status != JNI_OK) {
fprintf(stderr, "JNA: Can't attach native thread to VM for
callback: %d\n", attach_status);
return;
}

And you were right testLoadLibraryWithUnicodeName test doesn't make
jvm crash. I agree with you.

Thanks

Timothy Wall

unread,
Feb 3, 2012, 5:39:50 PM2/3/12
to jna-...@googlegroups.com
Well, that solved the issue of the test code being able to properly spawn a thread. Make sure you do a clean build so all object files are compiled with this option.

On Feb 2, 2012, at 4:08 AM, Sam.Park wrote:

> Hi T.
>
> I tried to set the gcc -mt/-pthread but it didn't work as expected.
>
> When i tested callback tests It emited this error : JNA: Can't attach
> native thread to VM for callback: -1;
>
> I think it's coming from callback.c
>
> else {
> attach_status = (*jvm)->AttachCurrentThread(jvm, (void *)&env,
> &args);
> }
> if (attach_status != JNI_OK) {
> fprintf(stderr, "JNA: Can't attach native thread to VM for
> callback: %d\n", attach_status);
> return;
> }

Perhaps the test thread init/spawn needs to have different/additional options? see if there are any issues specific to hp-ux with respect to attaching the VM to an existing native thread. The other callback tests work because the thread is already attached (the initial call starts in java).

Joe Smith

unread,
Jan 25, 2016, 3:12:59 PM1/25/16
to Java Native Access
It looks like back in 2012 you did a JNA build on HP-UX Itanium.
I am currently trying to get this done without much success.
Any advice you can provide would be appreciated.
Thanks,

Timothy Wall

unread,
Jan 25, 2016, 3:27:24 PM1/25/16
to jna-...@googlegroups.com
Post the build results/errors here, I’ll see what I can pick out.
> --
> You received this message because you are subscribed to the Google Groups "Java Native Access" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages