Subject: Fighting gst-plugins
To: None <tech-pkg@NetBSD.org>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-pkg
Date: 04/05/2004 14:16:04
Hi all,

maybe this is not the best list to ask (which one do you suggest?), but as
this is related to pkgsrc... I need help! ;-)

I'm trying to solve multiple problems in the gst-plugins package (aside of
splitting it in several individual packages for finer granularity of
dependencies and easier debugging).  Consider the following problem:

-----
[dawn gst-plugins-esound] $ gst-inspect esdsink
/usr/pkg/lib/gstreamer-0.8/libgstesd.so: Undefined PLT symbol "gst_audio_clock_new" (symnum = 31)
-----

Eww.  Searching for that function, I see it's defined in the libgstaudio.so
file, under /usr/pkg/lib/gstreamer-0.8:

-----
[dawn gstreamer-0.8] $ nm libgstaudio.so | grep gst_audio_clock_new
00001c60 T gst_audio_clock_new
[dawn gstreamer-0.8] $ nm libgstesd.so | grep gst_audio_clock_new
         U gst_audio_clock_new
-----

And that library is supposed to be loaded by libgstesd.so automatically
(according to its code, plugin_init function).  So, to be sure, I added
some printf's and ld.elf_so debugging code.  As a result, with the same
call above (the one calling gst-inspect), setting LD_DEBUG=yes, I get:

-----
[...]
Loading gstaudio
 added path "/usr/pkg/lib"
 added path "/usr/pkg/lib/python2.2/config"
 added path "/usr/X11R6/lib"
  0x48440000 .. 0x48443fff: /usr/pkg/lib/gstreamer-0.8/libgstaudio.so
load by name libintl.so.0 0x4805e000
 Searching for "libintl.so.0" (0x48063800)
  Trying "/usr/lib/libintl.so.0"
doing non-PLT relocations
doing lazy PLT binding
fixing up PLTGOT
Loaded gstaudio
/usr/pkg/lib/gstreamer-0.8/libgstesd.so: Undefined PLT symbol "gst_audio_clock_new" (symnum = 31)
-----

According to this, the library has been loaded in the program's space (using
the g_module_load provided by glib, with lazy binding).  And I guess it should
be able to access the function; isn't it??  (it does in linux, where all
this works...)

So I tried with LD_PRELOAD.  Aside from libgstaudio.so, I also had to pass
a shared library in the variable, which seems more strange.  But it worked:

-----
[dawn gstreamer-0.8] $ LD_PRELOAD=libgstaudio.so:../libgstreamer-0.8.so gst-inspect esdsink 
Factory Details:
  Long name:    Esound audio sink
  Class:        Sink/Audio
  Description:  Plays audio to an esound server
  Author(s):    Richard Boulton <richard-gst@tartarus.org>
  Rank:         none
[...]
-----

The plugins are built with -module -avoid-version and -export-dynamic.

I'm getting crazy.  Can anybody give me any pointers about what can be
wrong?

Thank you!

-- 
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/