Help with static linking and UnsatisfiedLinkError

Andrew Haley aph@cambridge.redhat.com
Mon Jul 22 09:11:00 GMT 2002


Suresh Raman writes:
 > 
 > Here it is, the ldd output of my .so
 > 
 > ldd libCRC.so
 > libgcc_s.so.1 => /usr/local/gcc31/lib/libgcc_s.so.1 (0x40003000)
 > libc.so.6 => /lib/libc.so.6 (0x4001c000)
 > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
 > 
 > Now, if I also copy libgcc_s.so.1 in the directory pointed to by
 > LD_LIBRARY_PATH, the program works fine.
 > 
 > Is that all you have to say O' master, or do you have more words of
 > your boundless wisdom for my humble self. :-)
Well, it looks to me like your .so needs libgcc_s.so.1 even if your
executable does not. It seems that your problem has been solved; you
will either need to link your .so statically with libgcc or include
libgcc_s.so with your program. What is the problem?
Andrew.
 > thanks,
 > --Suresh
 > 
 > --- Andrew Haley <aph@cambridge.redhat.com> wrote:
 > > Suresh Raman writes:
 > > > 
 > > > Hi,
 > > > 
 > > > I have a simple java program that uses JNI, thereby requiring a
 > > > loadLibrary call. It runs fine when I build it using the normal
 > > way.
 > > > (gcj --main=test test.java).
 > > > 
 > > > I build it using "-static" and it still runs fine, but only if my
 > > > LD_LIBRARY_PATH environment variable points to the gcc31
 > > installation's
 > > > lib directory (/usr/local/gcc31/lib).
 > > > 
 > > > The moment I remove /usr/local/gcc31/lib from my LD_LIBRARY_PATH,
 > > (the
 > > > path to my JNI implementation .so file is still there), I get a
 > > > UnsatisfiedLinkError in the System.loadLibrary() call.
 > > 
 > > What libraries does the native code use? What does "ldd" say about
 > > the .so?
 > > 
 > > Andrew.
 > 
 > __________________________________________________
 > Do You Yahoo!?
 > Yahoo! Health - Feel better, live better
 > http://health.yahoo.com


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /