1754021 Members
7783 Online
108811 Solutions
New Discussion

gcc on HP-UX 11.0

 
sha_1
Occasional Contributor

gcc on HP-UX 11.0

hi, all

I have the same trouble as Scott T. LaBounty .
i down-loaded gcc2.95.2 and binutils2.9.1 for hp-ux11.0.
bu i still can not use jni.
please tell me the parametes of the compile and link.
this is my screen showing.

HPserver 85: make
/opt/TWWfsw/gcc29/bin/gcc -I/opt/java/include -I/opt/java/include/hp-ux -shared -c cImpl.c
/usr/local/bin/ar r libcImpl.sl cImpl.o
/usr/local/bin/ranlib libcImpl.sl
HPserver 86: !java
java TestJavaCallingNative
error: java.lang.UnsatisfiedLinkError: /home/sha/webnavi/test/libcImpl.sl: Exec format error
HPserver 87:

thank you very much.
1 REPLY 1
Andy Bennett
Valued Contributor

Re: gcc on HP-UX 11.0

You are not building the shared library properly. ar and ranlib are for archive libraries. With gcc, I think the syntax is (add in extra flags as necessary):

- For each source file

gcc -fpic -c sourcefile.c

- To produce the shared library

gcc -fpic -shared -o liba.sl sourcefile1.o sourcefile2.o ...