Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Mar 2011 21:58:30 +0000
From:      Jim <stapleton.41@gmail.com>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>, freebsd-questions@freebsd.org
Subject:   Re: opening a shared object / failing with Undefined Symbol.
Message-ID:  <AANLkTim5DTnrrROpn_Ne7J3nxJXw_2zsTHO%2B-_yLbPOL@mail.gmail.com>
In-Reply-To: <AANLkTinSvV-Rt5tWBJASyFcpgHE6gEp8tOp73N4y1MYW@mail.gmail.com>
References:  <AANLkTi=tyuVJBDN7qRLe7O_a3i3d09sbEis-zoCH14tY@mail.gmail.com> <AANLkTinSvV-Rt5tWBJASyFcpgHE6gEp8tOp73N4y1MYW@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 26, 2011 at 11:31 PM, Giorgos Keramidas
<keramida@ceid.upatras.gr> wrote:
> On Tue, Mar 22, 2011 at 2:28 PM, Jim <stapleton.41@gmail.com> wrote:
>> I have an application that opens two .so files with dlopen(3):
>> =A0/usr/local/lib/libag_core.so
>> =A0/usr/local/lib/libag_gui.so
>>
>> Both files exist
>> Running nm(1) against each produces a lot of output, showing all the
>> symbols I know to exist in each library.
>>
>> My application gets a null return from dlopen on the libag_gui.so.
>>
>> dlerror produces the following string:
>> =A0"/usr/local/lib/libag_gui.so Undefined symbol "agTimingLock"
>>
>> $ nm /usr/local/lib/libag_gui.so | grep agTiming
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 U agTimingLock
>>
>> I'm guessing that means that agTimingLock is used in that library but
>> not defined?
>>
>> $ nm /usr/local/lib/libag_core.so | grep agTiming
>> 0000000000141c00 B agTimingLock
>>
>> And this would mean that it is defined in libag_core.so?
>
> Yes, but it's in the uninitialized data section:
>
> % man nm
> ...
> =A0 =A0 =A0 =A0 =A0 "B"
> =A0 =A0 =A0 =A0 =A0 "b" The symbol is in the uninitialized data section (=
known as BSS).
>
> What is the "ag" library? Which version are you using? What sort of
> dlopen() call did you try to run?
>

The "ag" library is libagar ( http://libagar.org/ ):

The code amounts to the following:
void * coredl =3D dlopen("/usr/local/lib/libag_core.so", 0)
void * guidl =3D dlopen("/usr/local/lib/libag_gui.so", 0)

and the function:
int (*AG_InitCore)(const char * title, int flags);
int (*AG_InitGraphics)(const char * drv);

*((void *)AG_InitCore) =3D dlsym(coredl, "AG_InitCore");
*((void *)AG_InitGraphics) =3D dlsym(guidl, "AG_InitGraphics");


The prototypes for the AG_* functions match.


Thanks,
-Jim Stapleton



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim5DTnrrROpn_Ne7J3nxJXw_2zsTHO%2B-_yLbPOL>