finding libgcj

Tom Tromey tromey@cygnus.com
Sat Apr 1 00:00:00 GMT 2000


>>>>> "George" == George Lawton <gwlawton@email.msn.com> writes:

George> ./HelloWorld: error in loading shared libraries:  libgcj.so.o: cannot open
George> shared object file:  No such file or directory

George> libgcj.so.0 is there (as a link to libgcj.so.0.0.0.)  I've
George> tried several "obvious" things including environmental
George> variables (LD_RUN_PATH, LD_LIBRARY_PATH) and several different
George> compiler and linker flags but I can't get HelloWorld to find
George> the library.

LD_LIBRARY_PATH works for me.
It ought to work for you too.

    creche. gcj --main=HelloWorld -o HelloWorld HelloWorld.java
    creche. ./HelloWorld
    ./HelloWorld: error in loading shared libraries
    libgcj.so.1: cannot open shared object file: No such file or directory
    creche. LD_LIBRARY_PATH=/x1/egcs/install/lib ./HelloWorld
    Hello World!

(I configured both packages with --prefix=/x1/egcs/install)

Otherwise you can try use -rpath when you compile:

    creche. gcj --main=HelloWorld -o HelloWorld HelloWorld.java -Wl,-rpath,/x1/egcs/install/lib
    creche. ./HelloWorld
    Hello World!

Or you can add /usr/local/lib to your ld.so cache using ldconfig.

Or you can link statically, though this doesn't always work.

Tom


More information about the Java mailing list