1838163 Members
3425 Online
110124 Solutions
New Discussion

Re: JNI and -AA

 
SOLVED
Go to solution
cactuar
Occasional Contributor

JNI and -AA

Hi, I have a Hello World program using JNI taken from this page:
http://www.hp.com/products1/unix/java/infolibrary/prog_guide/JNI_java2.html

It builds fine and runs fine.

But when I add -AA to my compile line, I get this error.
error: java.lang.UnsatisfiedLinkError: libaCCImpl.sl: Unresolved external

Here are my build lines:
aCC -AA +DA2.0W +z +u4 -c -D_HPUX -D_POSIX_C_SOURCE=199506L -I${JAVA_HOME}/include -I${JAVA_HOME}/include/hp-ux aCCImpl.cpp

aCC +DA2.0W -b -o libaCCImpl.sl aCCImpl.o -lstd -lstream -lCsup -lm

Can someone tell me how to resolve this problem?


uname -a
HP-UX hp11i B.11.11 U 9000/800 524736557 unlimited-user license
10 REPLIES 10
Dennis Handly
Acclaimed Contributor

Re: JNI and -AA

You need to read the documentation about aC++ plugins:
http://www.docs.hp.com/en/7762/5991-4874/distributing.htm#linking

And for -AA: -lstd_v2 -lCsup_v2 -lm
cactuar
Occasional Contributor

Re: JNI and -AA

Thank you for your help. I have a shared library that is built with -ldld -lstd -lstream -lCsup. It is compiled with -AA. When I link this library into my JNI sample program, it hangs. Should this shared library be built with -lstd_v2 -lCsup_v2 too? Thank you.
Dennis Handly
Acclaimed Contributor

Re: JNI and -AA

>Should this shared library be built with -lstd_v2 -lCsup_v2

You can't mix -AA and -AP. So if you have one lib with -AA, all libs have to be built that way.

While you don't need to add -lstd_v2 -lCsup_v2 to all shlibs, it may not be worthwhile trying to optimize that.
cactuar
Occasional Contributor

Re: JNI and -AA

I am now questioning this for HP Itanium.

In the JNI page, I see this:

On Itanium, create the shared library using:

$ aCC -b -o libaCCImpl.so aCCImpl.o \
-lstd_v2 -lCsup -lunwind -lm

On Itanium, -lstd_v2 is necessary, otherwise, running the program will result in UnsatisfiedLinkErrors.

Is this for -AP or -AA? Do we need to use -lCsup_v2 or -AA? Can you mix v2 and non-v2 libraries? Are they compatible?

Thank you for your help.
Dennis Handly
Acclaimed Contributor

Re: JNI and -AA

>On Integrity, create the shared library using:

This is correct.

>Is this for -AP or -AA? Do we need to use -lCsup_v2 or -AA? Can you mix v2 and non-v2 libraries?

Yes, -AA. There no such thing as -lCsup_v2.
No, you can't mix -AA with -AP.

Read the appropriate web page:
http://docs.hp.com/en/10946/distributing.htm#linking
cactuar
Occasional Contributor

Re: JNI and -AA

Thank you. So the Csup_v2 does not exist on Itanium. That clarifies my question. :)

I understand we cannot fix -AA and -AP. I was wondering if I can mix like -lstd_v2 and -lCsup. Can you do that on the HP risk machine? Our C++ only application seem to work when we compile with -AA and link in -lstd -lstream -lCsup, so we were wondering if we should be using _v2 libraries, or it is ok to use non-v2 libraries.

Thank you very much for your help.
Dennis Handly
Acclaimed Contributor

Re: JNI and -AA

>So the Csup_v2 does not exist on Itanium. That clarifies my question. :)

(Then why ask about it below? ;-)

>I was wondering if I can mix like -lstd_v2 and -lCsup.

If you read that link, that's what it says. You are NOT mixing. libCsup is -AA/-AP neutral.

>Can you do that on PA-RISC?

No, we were not smart enough to get it right a decade ago. :-(

>Our C++ only application seem to work when we compile with -AA and link in -lstd -lstream -lCsup,

No, you are mixing -AP and -AA and that's not supported.

>so we were wondering if we should be using _v2 libraries, or it is ok to use non-v2 libraries.

Don't make assumptions based on _v2. The libs are -AA or -AP. With the contents listed on the appropriate web pages.
cactuar
Occasional Contributor

Re: JNI and -AA

>(Then why ask about it below? ;-)
I was wondering about PA-RISC. Sorry for a confusion. The libCsup_v2 exists on PA-RISC, but not Itanium, right?

>libCsup is -AA/-AP neutral.
I see. Thank you.
Dennis Handly
Acclaimed Contributor

Re: JNI and -AA

>The libCsup_v2 exists on PA-RISC, but not Integrity, right?

Yes.
Dennis Handly
Acclaimed Contributor
Solution

Re: JNI and -AA

You have not assigned any points yet. If the answers you got were helpful, please read the following:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33