Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Tuesday, April 7, 2009

ld: fatal: library -ljava: not found

Akhilesh reported these errors when they were relinking 10g RDBMS ORACLE_HOME:

$ORACLE_HOME/lib32:/opt/ORCLcluster/lib/ -Y P,:/opt/SUNWcluster/lib:/opt/ORCLcluster/lib/:/usr/ccs/lib:/usr/lib -Qy -lc -laio `cat $ORACLE_HOME/lib32/sysliblist` -R$ORACLE_HOME/lib32 -lm
ld: fatal: library -ljava: not found
ld: fatal: library -ljvm: not found
ld: fatal: File processing errors. No output written to $ORACLE_HOME/sysman/lib/libnmemso.so
*** Error code 1
make: Fatal error: Command failed for target `$ORACLE_HOME/sysman/lib/libnmemso.so'
Current working directory $ORACLE_HOME/sysman/lib
*** Error code 1
make: Fatal error: Command failed for target `libnmemso'
chmod 755 $ORACLE_HOME/bin
/usr/ccs/bin/make -f $ORACLE_HOME/sysman/lib/ins_sysman.mk relink_sharedobj SHAREDOBJ=libnmemso
/usr/ccs/bin/ld -o $ORACLE_HOME/sysman/lib/libnmemso.so -dy -M $ORACLE_HOME/sysman/lib32/libnmemso.def -G -z text -L$ORACLE_HOME/lib32 -L$ORACLE_HOME/lib -L$ORACLE_HOME/sysman/lib32/ -R$ORACLE_HOME/lib32/:$ORACLE_HOME/lib/:$ORACLE_HOME/sysman/lib32/ $ORACLE_HOME/sysman/lib32/libnmem.a $ORACLE_HOME/sysman/lib32/libnmer.a $ORACLE_HOME/sysman/lib32/libnmeu.a $ORACLE_HOME/sysman/lib32/libnmt.a $ORACLE_HOME/sysman/lib32/libnml.a $ORACLE_HOME/sysman/lib32/libnmee.a $ORACLE_HOME/sysman/lib32/libnmefmgr.a $ORACLE_HOME/sysman/lib32/libnmevr.a $ORACLE_HOME/sysman/lib32/libnmehu.a $ORACLE_HOME/sysman/lib32/libnmehl.a $ORACLE_HOME/sysman/lib32/libnmepm.a $ORACLE_HOME/sysman/lib32/libnmedc.a $ORACLE_HOME/sysman/lib32/libnmedt.a $ORACLE_HOME/sysman/lib32/libnmedm.a $ORACLE_HOME/sysman/lib32/libnmedr.a $ORACLE_HOME/sysman/lib32/libnmeb.a $ORACLE_HOME/sysman/lib32/libnmec.a $ORACLE_HOME/sysman/lib32/libnmesched.a $ORACLE_HOME/sysman/lib32/libnmectl.a $ORACLE_HOME/sysman/lib32/libnmejc.a $ORACLE_HOME/sysman/lib32/libnmej.a -L/erppgrt1/oracle/10.2.0/jdk/jre/lib/sparc/client -L/erppgrt1/oracle/10.2.0/jdk/jre/lib/sparc -z lazyload -ljava -ljvm -z nolazyload $ORACLE_HOME/sysman/lib32/libnmeclumgr.a $ORACLE_HOME/sysman/lib32/libnmecluster.a $ORACLE_HOME/sysman/lib32/libnmexml.a $ORACLE_HOME/sysman/lib32/libnmo.a -lxml10 -lcore10 -lnls10 -lcore10 -lnls10 -lcore10 -lunls10 -lclntsh -lnnz10 -lthread -lsocket -lnsl -lm -ldl -lkvm -lkstat -lelf -laio -lposix4 -R /opt/SUNWcluster/lib:$ORACLE_HOME/lib32:/opt/ORCLcluster/lib/ -Y P,:/opt/SUNWcluster/lib:/opt/ORCLcluster/lib/:/usr/ccs/lib:/usr/lib -Qy -lc -laio `cat $ORACLE_HOME/lib32/sysliblist` -R$ORACLE_HOME/lib32 -lm
ld: fatal: library -ljava: not found
ld: fatal: library -ljvm: not found
ld: fatal: File processing errors. No output written to $ORACLE_HOME/sysman/lib/libnmemso.so
*** Error code 1
make: Fatal error: Command failed for target `$ORACLE_HOME/sysman/lib/libnmemso.so'
Current working directory $ORACLE_HOME/sysman/lib32
*** Error code 1
make: Fatal error: Command failed for target `libnmemso'

I found metalink note 418557.1 which describes similar issue:

Cause

As the error indicates:

'/usr/bin/ld: cannot find -ljava
collect2: ld returned 1 exit status
Opatch is not able to find libjava.so file in the variable JRE_LIB_DIR in file env_sysman.mk and giving error

'/usr/bin/ld: cannot find -ljava'


Solution

To implement the solution, execute the following steps:

Continue with the patch installation when you receive thie error and complete it.

Search for file libjava.so on the system
For example you find it under the following directory

$ORACLE_HOME/jdk/jre/lib/i386

Backup and edit $ORACLE_HOME/sysman/lib/env_sysman.mk

Change : JRE_LIB_DIR=%JRE_HOME%/bin
To : JRE_LIB_DIR=$(ORACLE_HOME)/jdk/jre/lib/i386

Issue the failed relink command:

% make -f ins_sysman.mk relink_sharedobj SHAREDOBJ=libnmemso

However we did not have i386 directory inside $ORACLE_HOME/jdk/jre/lib, as we are on Solaris. Instead we had sparc and sparcv9 directories. The sparc directory had 32 bit libjava.so and sparcv9 had 64-bit libjava.so. Since our DB is 64-bit, sparcv9 would be the directory.

When we opened the $ORACLE_HOME/sysman/lib/env_sysman.mk file we found that the line was pointing to a directory in gold instance from which the current instance was cloned:

JRE_LIB_DIR=/gold11i/jdk/jre/lib/sparcv9

We changed this to the correct development path

JRE_LIB_DIR=/dev11i/jdk/jre/lib/sparcv9

and relinked again. It worked fine this time without issues.

No comments: