public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* finding libgcj
@ 2000-04-01  0:00 George Lawton
  2000-04-01  0:00 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: George Lawton @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

Hello world

I just built gcc-2.95.2 and libgcj-2.95.1 on Redhat Linux 6.0.   Used

--enable-shared
--with-gnu-as
--with-gnu-ld
--enable-threads

gcc installed binaries in /usr/local/bin and libgcj installed libraries in
/usr/local/lib

Then I wrote everyone's favorite HelloWorld class and did

gcj --main=HelloWorld -o HelloWorld HelloWorld.java
./HelloWorld
with the following result:
./HelloWorld: error in loading shared libraries:  libgcj.so.o: cannot open
shared object file:  No such file or directory

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

If someone has a quick answer, I'd really appreciate it.

George Lawton






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: finding libgcj
  2000-04-01  0:00 finding libgcj George Lawton
@ 2000-04-01  0:00 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: George Lawton; +Cc: java-discuss

>>>>> "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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 finding libgcj George Lawton
2000-04-01  0:00 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).