Error: Can't find libjava.so

Jeremy Chadwick koitsu at FreeBSD.org
Tue Sep 16 04:33:25 UTC 2008


On Mon, Sep 15, 2008 at 09:34:39PM +0200, Marcel Grandemange wrote:
> > > I do realize this is probably better suited for freebsd-questions ,
> > however
> > > haven't received any response and was simply hoping someone would be
> kind
> > > enough.
> > > 
> > > I recently obtained a very decent ups, however it is not supported by
> NUT.
> > > 
> > > It does however come with winpower software that does run on FreeBSD.
> > > 
> > > However it rewuired java.
> > > 
> > > So installed from ports
> > > 
> > > And was presented with following error:
> > > 
> > > Error: can't find libjava.so
> > > 
> > > This is on system in folder
> > "/usr/local/Diablo-jre1.6.0/lib/amd64/libjava.so
> > 
> > >Can you provide the output of "ldconfig -r" from that box?  I have
> > >a feeling the ld.so pathing hints might lack a directory or two.
> > 
> > 
> > /var/run/ld-elf.so.hints:
> > 	search directories: /lib:/usr/lib:/usr/lib/compat:/usr/local/lib
> 
> >This is the problem as I see it.  ld.so, which is used for finding and
> >loading shared libraries, is not configured to look in
> >/usr/local/Diablo-jre1.6.0/lib/amd64 for libraries.
> 
> >I'd like to know which port you installed, and how you installed it.
> 
> I did a cvsup on ports to update to latest on FreeBSD7.0 release amd64
> Used port /usr/ports/java/Diablo-jre16
> Simply did
> Make
> Make install
> Make clean
> 

Can you please apply the below patch and tell me if it solves your
problem?  Proper procedure should be:

# cd /usr/ports/java/diablo-jre16
# patch < /wherever/the/patch/is
# make clean
# make
# make deinstall
# make install

After this is done, use "ldconfig -r" and look at the search path
shown at the top; hopefully /usr/local/diablo-jre1.6.0/lib/amd64
will be there, and libjava.so should be found (hopefully).

> >Regarding the problem itself: there are ways to work around this by
> >using the environment variable LD_LIBRARY_PATH.  I do not recommend
> >this, though -- properly configuring the ld.so search path when a
> >program (or port) is installed is the proper method.
> 
> Could you advise me how to do this? Hope you don't mind!

Set the LD_LIBRARY_PATH environment variable to the search paths
you desire.  Colon-delimited, and it overrides the defaults.  E.g.

export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/diablo-jre1.6.0/lib/amd64"

But the below patch, assuming it works (and I got the paths right),
should not require you to do that.  LD_LIBRARY_PATH is somewhat evil,
and it's not recommended you use it.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/java/diablo-jre16/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- Makefile	20 Aug 2008 04:13:02 -0000	1.3
+++ Makefile	16 Sep 2008 04:24:27 -0000
@@ -43,6 +43,8 @@
 
 INSTALL_DIR=	${PREFIX}/${PKGNAMEPREFIX}jre${JRE_VERSION}
 
+USE_LDCONFIG=	${PREFIX}/${PKGNAMEPREFIX}jre${JRE_VERSION}/lib/${ARCH}
+
 .include <bsd.port.pre.mk>
 
 .if ${OSVERSION} >= 700000


More information about the freebsd-hackers mailing list