Subject: dlopen()'s second argument and Undefined PLT symbol (was: libdl and
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 02/28/2001 09:54:19
I am using NetBSD 1.5.1_ALPHA under i386.

The DLFCN(3) manual page says that dlopen()'s second argument "has
currently no effect, but should be set to DL_LAZY for future
compatibility."

I am trying to debug why Ogg Vorbis doesn't work under NetBSD by adding a
bunch of printf's to the library code. This helped me track down which
routines are working.

Basically, the ogg encoder never sees my available libao "oss" driver:

$ file /usr/local/lib/ao/liboss.so
/usr/local/lib/ao/liboss.so: symbolic link to liboss.so.0.0
$ file /usr/local/lib/ao/liboss.so.0.0
/usr/local/lib/ao/liboss.so.0.0: ELF 32-bit LSB shared object, Intel
80386, version 1, not stripped

        void *handle;
        handle = dlopen(plugin_file, RTLD_NOW);
        printf ("plugin_file: %s\n", plugin_file);
        if (handle) {
          printf ("got here 2\n");

The handle is always NULL.

So I changed it to use DL_LAZY instead of RTLD_NOW and it worked (at least
didn't return NULL) and ogg123 (using libao) found my driver "oss".

So it appears that the second argument does matter. (Also, where
are these /usr/include/dlfcn.h definitions explained?)

Now to figure out my next problem:
 /usr/local/lib/ao/liboss.so: Undefined PLT symbol "_oss_ioctl" (reloc
 type = 7, symnum = 13)

Using google's usenet search results in many NetBSD references. But I have
no clue what it ("Undefined PLT symbol") means or where to start. Any
suggestions?

Thanks,

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