Forum OpenACS Q&A: make error in nsjava

Collapse
Posted by Gilbert Wong on
I get the following error message when I tried to compile nsjava. I'm on HPUX 11 with jdk 1.17.
gcc -shared nsjava.o log.o set.o pg.o db.o javaevaltcl.o methods.o 
tclcalljava.o -lpthread  -lpthread -L/opt/java/lib -
ljava /home/aol30/sources/aolserver_src/aolserver/tcl8.3.2/unix/libtcl
8.3g.a /home/aol30/sources/aolserver_src/aolserver/thread/libnsthread.
a -o libnsjava.so 
/usr/ccs/bin/ld: Can't find library for -ljava
collect2: ld returned 1 exit status
make[1]: *** [libnsjava.so] Error 1
make[1]: Leaving directory `/home/aol30/sources/nsjava-0.0.9/src'
make: *** [all] Error 1
I checked and these arguments that follow -ljava exist in my path. What is the problem. Thanks. My command line for configure:
./configure --with-aolserver-
src=/home/aol30/sources/aolserver_src/aolserver --prefix=/home/aol30 -
-with-jdk=/opt/java
Collapse
Posted by Dan Wickstrom on
Well I've never had access to an HP machine, so I've never tested it on HPUX.  Does libjava.so actually exist in /opt/java/lib?  Most of the java distrubutions that I've worked with actually have libjava.so located in a subdirectory of lib/java.  On my solaris machine it's located in the jdk1.1.8/lib/sparc/native_threads directory.  On redhat 6.2 it's located in the jdk1.1.8_v1/lib/i686/native_threads directory.  Geneerally it follows the pattern of lib/architecture/threads_version (green or native).  You should also upgrade your jdk to 1.1.8, as I think that the 1.1.7 version had some threading problems.  Make sure that you also get a native threads jdk version.
Collapse
Posted by Gilbert Wong on
Dan,

Thanks.  It's in:  /opt/java/lib/PA_RISC/native_threads

How do I make this location known to the compiler?  I'll upgrade to the new version of the JDK before I recompile.  Thanks.

Collapse
Posted by Dan Wickstrom on
set your LD_LIBRARY_PATH environment variable to include the directory where libjava.so is located.
Collapse
Posted by Gilbert Wong on
I set the LD_LIBRARY_PATH variable and it didn't carry through so I edited the Makefile.global and changed it there. I just noticed that the files in the native_threads directory uses .sl instead of the .so extension. The compiler comes back with this error:
gcc -shared nsjava.o log.o set.o pg.o db.o javaevaltcl.o methods.o tclcalljava.o -lpthread  
-lpthread -L/opt/java/lib/PA_RISC/native_threads 
-ljava /home/aol30/sources/aolserver_src/aolserver/tcl8.3.2/unix/libtcl8.3g.a 
/home/aol30/sources/aolserver_src/aolserver/thread/libnsthread.a -o libnsjava.so 
/usr/ccs/bin/ld: DP relative code in file /var/tmp/ccs45s09.o - shared library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status
make[1]: *** [libnsjava.so] Error 1
make[1]: Leaving directory `/home/aol30/sources/nsjava-0.0.9/src'
make: *** [all] Error 1
Any ideas? I got this problem before and I can't remember how I fixed it. Thanks. Gilbert
Collapse
Posted by Dan Wickstrom on
Well this is good.  With your help, we can get nsjava to compile on hpux.  It sounds like the configure script is not detecting the hpux platform correctly.  Could you run configure again and post the output?
Collapse
Posted by Gilbert Wong on
Here's the output:
bitstc /home/aol30/sources/nsjava-0.0.9: ./configure --with-aolserver-src=/home/aol30/sources/aolserver_src/aolserver --prefix=/home/aol30
creating cache ./config.cache
checking prefix... /home/aol30
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking looking for aolserver ns.h include file... /home/aol30/sources/aolserver_src/aolserver/include/ns.h
checking looking for aolserver nsd.h include file... /home/aol30/sources/aolserver_src/aolserver/nsd/nsd.h
checking for javac... /opt/java/bin/javac
checking checking for java... Java found at /opt/java
checking for zip or jar files to include on CLASSPATH... "/opt/java/lib/classes.zip"
checking for the java runtime... /opt/java/bin/java
checking for the java compiler... /opt/java/bin/javac
checking for the java header program... /opt/java/bin/javah
checking for the java archive program... /opt/java/bin/jar
checking for the java debugger program... /opt/java/bin/jdb
checking for jni.h include file... /opt/java/include/jni.h.
checking for jdk version... Looks like you are using a 1.1 JVM
checking for jni_md.h include file... /opt/java/include/hp-ux/jni_md.h
checking the jdk arch lib directory... checking how to run the C preprocessor... gcc -E
checking for unistd.h... yes
checking for working const... yes
checking for ANSI C header files... yes
checking for size_t... yes
checking for ANSI C header files... (cached) yes
checking for strerror... yes
checking for strstr... yes
checking for strlen... yes
checking platform specific compile options... hp11

        NSJAVA version 0.0.9 configured successfully.

Using c-compiler:      gcc
JDK Version:           1.1
Install libnsjava.so:  /home/aol30/bin
Aolserver Version:     3_0_PLUS
Aolserver include:     /home/aol30/sources/aolserver_src/aolserver/include
Aolserver nsd include: /home/aol30/sources/aolserver_src/aolserver/nsd
jdk include:           /opt/java/include
jdk platform include:  /opt/java/include/hp-ux
libjava.so dir:        /opt/java/lib/PA_RISC/native_threads
java classpath:        "/opt/java/lib/classes.zip"

CFLAGS: ' -D__hp11 -pipe -fPIC -Wall -Wno-unused -DUSE_DLSHL=1'

LIBS:   ' -lpthread  -lpthread -L/opt/java/lib -ljava'

updating cache ./config.cache
creating ./config.status
creating Makefile.global
The -L option gets set to /opt/java/lib every time I run configure even though I set the LD_LIBRARY_PATH variable. I have to hack the makefile to change it. Thanks.