Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

UnsatisfiedLinkError  while loading library using System.loadLibrary

Thread view: 
ratheesh.pai@gmail.com - 24 Nov 2006 05:35 GMT
I am facing a issue while trying to load a library using
System.loadLibrary

Sample Code:

public static void main(String[] args) {
 System.loadLibrary("xxx")

}

Throws the Exception:

libxxx.so:  undefined symbol: yyyyy

The libxxx.so file is present in $LD_LIBRARY_PATH
Platform: Red-Hat Linux
JAVA  version: 1.5

The file yyyyy.o is contained in some other archive files. I do not
want to include this .o in this library libxxx.so.  How to tell  JVM
about the location of this .o (inside a .a file) while it loads the
libxxx.so  library

Has anyone ever faced a similar problem, or has any clues regarding
this problem as to how to fix this
Gordon Beaton - 24 Nov 2006 06:03 GMT
> libxxx.so:  undefined symbol: yyyyy
>
> The libxxx.so file is present in $LD_LIBRARY_PATH
> Platform: Red-Hat Linux
> JAVA  version: 1.5

System.loadLibrary() didn't fail. It was your attempt to invoke the
non-existing function that caused the exception.

If the missing symbol is in libyyy.so then your libxxx.so is dependent
on libyyy.so, and you need to specify that when you link libxxx.so,
i.e.:

 gcc -shared -f libyyy.so x.o -o libxxx.so

Also, libyyy.so must be in LD_LIBRARY_PATH at runtime.

Use "readelf -d libxxx.so" to check that there is NEEDS entry
mentioning libyyy.so. Use "ldd -v libxxx.so" to confirm that it can be
resolved at runtime.

/gordon

Signature

[ don't email me support questions or followups ]
g o r d o n  +  n e w s  @  b a l d e r 1 3 . s e

Nigel Wade - 24 Nov 2006 10:52 GMT
> I am facing a issue while trying to load a library using
> System.loadLibrary
[quoted text clipped - 21 lines]
> Has anyone ever faced a similar problem, or has any clues regarding
> this problem as to how to fix this

Your criteria are mutually exclusive. You either link libxxx.so against the
other archive (and include the object in libxxx.so) or you are doomed to
failure.

There is no way to make an executable retrieve an object from an archive file.
The object must be included in the executable, or one of the DSOs it loads.
Since there is no way to modify the java executable to include the object in
that, your only choice is to include it in your DSO.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.