After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 616592 - plugin_init confuses filename extensions for libpython
plugin_init confuses filename extensions for libpython
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-python
0.10.28
Other Mac OS
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-23 05:41 UTC by Daniel Macks
Modified: 2011-10-29 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tentative patch: don't assume G_MODULE_SUFFIX is identical to the suffix for shared libs (1.76 KB, patch)
2010-06-03 12:38 UTC, Tim-Philipp Müller
none Details | Review

Description Daniel Macks 2010-04-23 05:41:37 UTC
Spawned from Bug #616553, which is aimed at determining the location of the runtime libpython...

gst-python-0.10.18/plugin/gstpythonplugin.c plugin_init() has:

>  GST_LOG ("Checking to see if libpython is already loaded");
>  g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LOCAL), "Py_None",
>      &has_python);
>  if (has_python) {
>    GST_LOG ("libpython is already loaded");
>  } else {
>    GST_LOG ("loading libpython");
>    libpython =
>        g_module_open (PY_LIB_LOC "/libpython" PYTHON_VERSION "."
>        G_MODULE_SUFFIX, 0);
>    if (!libpython) {
>      GST_WARNING ("Couldn't g_module_open libpython. Reason: %s",
>          g_module_error ());
>      return FALSE;
>    }
>  }

That makes the platform assumption that the filename extension used for loadable modules is the same as that used for dyld libraries. Not true on OS X. For me, a shared library is libFOO.dylib whereas things built using the libtool "-module" flag (which is what G_MODULE_SUFFIX is) have the extension ".so". And if python were built as a framework, it may not have an extension at all.

No problem on linux and similar platforms: both are .so. But just luck or (robust build tools:) that I guess plugin_init is always called from within a runtime situation that already has libpython loaded (modules linked against it, or parent-process is linked against it).

Minor user-experience//debugging improvement for when things go wrong here: have the GST_WARNING include the actual filename trying to access rather than just "libpython"?

I don't know how to interrogate libtool or other parts of the build toolchain to determine the proper extension here. Maybe there's a variable available in lt's autoconf bits.
Comment 2 Tim-Philipp Müller 2010-06-03 12:38:17 UTC
Created attachment 162642 [details] [review]
tentative patch: don't assume G_MODULE_SUFFIX is identical to the suffix for shared libs

    Don't use G_MODULE_SUFFIX when trying to load libpython in the python
    plugin loader. On OSX, the standard suffix for modules is '.so' while
    it's '.dylib' for libraries.
    
    Fixes #616592.

(Completely untested.)
Comment 3 Sebastian Dröge (slomo) 2011-05-25 19:04:30 UTC
This is already fixed differently since some time and should work just fine on OS X with the latest release.