Troubles with dlopen()-ing plugins after GStreamer relocation in Mac OS X
Andoni Morales
ylatuya at gmail.com
Mon Jan 14 15:16:33 PST 2013
2013/1/14 4ernov <4ernov at gmail.com>:
> Hello,
>
> I suffer some troubles concerning GStreamer plugin loading process
> after I relocated GStreamer framework in Mac OS X so that to deploy it
> in my app bundle.
>
> First I tried osxrelocator.py from cerbero tools, but it unfortunately
> doesn't change id of libgstreamer library and everything fails.
> Then I tried to do it manually, I changed all the id's and links of
> *.dylib from lib/ directory and *.so from lib/gstreamer-0.10 directory
> to @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib.
> The program image gets linked correctly, but when GStreamer tries to
> load its plugins on ititialization, dyld refuses to load them like
> this:
>
> dyld: loaded: /Users/User/devel/image/myapp/Contents/Frameworks/GStreamer.framework/Versions/0.10/lib/gstreamer-0.10/libgstvp8.so
> dyld: unloaded:
> /Users/User/devel/image/myapp/Contents/Frameworks/GStreamer.framework/Versions/0.10/lib/gstreamer-0.10/libgstvp8.so
>
> (gst-plugin-scanner:92322): GStreamer-WARNING **: Failed to load
> plugin '/Users/User/devel/image/myapp/Contents/Frameworks/GStreamer.framework/Versions/0.10/lib/gstreamer-0.10/libgstvp8.so':
> dlopen(/Users/User/devel/image/myapp/Contents/Frameworks/GStreamer.framework/Versions/0.10/lib/gstreamer-0.10/libgstvp8.so,
> 2): Library not loaded:
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgstbasevideo-0.10.23.dylib
> Referenced from:
> /Users/User/devel/image/myapp/Contents/Frameworks/GStreamer.framework/Versions/0.10/lib/gstreamer-0.10/libgstvp8.so
> Reason: image not found
>
> Still ../Frameworks/GStreamer.framework/Versions/0.10/lib/libgstbasevideo-0.10.23.dylib
> exists and contains these dynamic info:
>
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgstbasevideo-0.10.23.dylib
> (compatibility version 24.0.0, current version 24.0.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgstvideo-0.10.0.dylib
> (compatibility version 26.0.0, current version 26.0.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgstbase-0.10.0.dylib
> (compatibility version 31.0.0, current version 31.0.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgstreamer-0.10.0.dylib
> (compatibility version 31.0.0, current version 31.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 125.2.11)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgobject-2.0.0.dylib
> (compatibility version 3401.0.0, current version 3401.2.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libffi.5.dylib
> (compatibility version 6.0.0, current version 6.10.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgmodule-2.0.0.dylib
> (compatibility version 3401.0.0, current version 3401.2.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libgthread-2.0.0.dylib
> (compatibility version 3401.0.0, current version 3401.2.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libxml2.2.dylib
> (compatibility version 11.0.0, current version 11.0.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libz.1.2.7.dylib
> (compatibility version 1.0.0, current version 1.2.7)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libglib-2.0.0.dylib
> (compatibility version 3401.0.0, current version 3401.2.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libintl.8.dylib
> (compatibility version 10.0.0, current version 10.1.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/libiconv.2.dylib
> (compatibility version 8.0.0, current version 8.1.0)
> @executable_path/../Frameworks/GStreamer.framework/Versions/0.10/lib/liborc-0.4.0.dylib
> (compatibility version 17.0.0, current version 17.0.0)
>
>
> My guess is that @executable_path becomes different when dlopen() is
> used to load a library. Is there any solution for this?
Hi,
That's something we need to fix in the future with a different
relocation technique, using @rpath and adding several relative paths.
The problem here is that @executable_path gets replaced with the path
of the application dlopen'ing it, which in gst_init is
gst-plugin-scanner, located at $ROOT/libexec/gstreamer-0.10/ and not
the real application.
The simplest option is setting DYLD_FALLBACK_LIBRARY_PATH, which do
not require any relocation.
This is the script I use in LongoMatch, Modify it at your needs:
#!/bin/sh
CUR_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PREFIX=$CUR_DIR/../Home
# GStreamer
export GST_PLUGIN_PATH="$PREFIX/lib/gstreamer-0.10"
export GST_PLUGIN_SCANNER="$PREFIX/libexec/gstreamer-0.10/gst-plugin-scanner"
# Python
export PYTHONPATH="$PREFIX/lib/python2.7/site-packages${PYTHONPATH:+:$PYTHONPATH}"
# Gio
export GIO_EXTRA_MODULES="$PREFIX/lib/gio/modules"
# Gtk
export GTK_PATH="$PREFIX"
export GTK_EXE_PREFIX=$PREFIX
export GTK_DATA_PREFIX=$PREFIX
export GTK2_RC_FILES=$PREFIX/etc/gtk-2.0/gtkrc
# To prevent a crash in GSettings
export XDG_DATA_DIRS=$PREFIX/share
export XDG_CONFIG_DIRS=$PREFIX/etc/xdg
export GDK_PIXBUF_MODULEDIR=$PREFIX/lib/gdk-pixbuf-2.0/2.10.0/loaders/
export GDK_PIXBUF_MODULE_FILE=$PREFIX/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
export DYLD_FALLBACK_LIBRARY_PATH=$PREFIX/lib:/usr/lib
cd $PREFIX/lib
./LongoMatchGtk
Andoni
> Thanks in advance,
> Alexey Chernov
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
--
Andoni Morales Alastruey
LongoMatch:The Digital Coach
http://www.longomatch.ylatuya.es
More information about the gstreamer-devel
mailing list