Subject: Re: dlopen()'s second argument and Undefined PLT symbol (was: libdl
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 02/28/2001 11:07:38
On Wed, 28 Feb 2001, Todd Vierling wrote:

> We need to update the manpage; if you'd like, submit a PR on it.  The
> dlopen() man page *should* contain the RTLD_* constants, but doesn't yet.

I just did a send-pr (but no patch). (I would have done it sooner, but we
just had a minor earthquake 35 miles north of Seattle.)

> : Now to figure out my next problem:
> :  /usr/local/lib/ao/liboss.so: Undefined PLT symbol "_oss_ioctl" (reloc
> :  type = 7, symnum = 13)
> 
> This means that you haven't linked liboss.so against libossaudio.so (found
> in /usr/lib).  On NetBSD, OSS is a compatibility system found in a library,
> which contains _oss_ioctl (a function that intercepts ioctl() calls).  So,
> when linking your liboss.so, you need to do something like this:
> 
> cc -shared -o liboss.so ... -lossaudio
> 
> That will add the necessary shared library dependency, and your liboss.so
> will load into memory properly.

It uses a Makefile generated by a configure script. It doesn't seem to do
anything directly like your example. I did try adding -lossaudio to
several parts, but I couldn't get any changes.

I think it is using ld to create the liboss.so. I need to learn more about
this :)

Here is the relevant information from a make:

/bin/sh ../../../libtool --mode=compile gcc
-DPACKAGE=\"libao\" -DVERSION=\"0.6.0\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4
-DSIZEOF_LONG=4 -DHAVE_SOUNDCARD_H=1 -DHAVE_SOUNDCARD_H=1
-I. -I. -I../../.. -I../../../include    -O20 -D__NO_MATH_INLINES
-fsigned-char -DAO_PLUGIN_PATH=\"/usr/local/lib/ao\" -c ao_oss.c
gcc -DPACKAGE=\"libao\" -DVERSION=\"0.6.0\" -DSIZEOF_SHORT=2
-DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DHAVE_SOUNDCARD_H=1 -DHAVE_SOUNDCARD_H=1
-I. -I. -I../../.. -I../../../include -O20 -D__NO_MATH_INLINES
-fsigned-char -DAO_PLUGIN_PATH=\"/usr/local/lib/ao\" -c ao_oss.c  -fPIC
-DPIC -o ao_oss.lo
/bin/sh ../../../libtool --mode=link gcc  -O20 -D__NO_MATH_INLINES
-fsigned-char -DAO_PLUGIN_PATH=\"/usr/local/lib/ao\"  -o liboss.la -rpath
/usr/local/lib/ao -export-dynamic -avoid-version ao_oss.lo  
rm -fr .libs/liboss.la .libs/liboss.* .libs/liboss.*
(cd . && ln -s ao_oss.lo ao_oss.o)
/usr/bin/ld -Bshareable  ao_oss.lo   -o .libs/liboss.so.0.0
(cd .libs && rm -f liboss.so.0 && ln -s liboss.so.0.0 liboss.so.0)
(cd .libs && rm -f liboss.so && ln -s liboss.so.0.0 liboss.so)
(cd .libs && rm -f liboss.so && ln -s liboss.so.0.0 liboss.so)
creating liboss.la
(cd .libs && rm -f liboss.la && ln -s ../liboss.la liboss.la)

Thanks for you help.

   Jeremy C. Reed
   http://www.reedmedia.net/