Opened 13 years ago

Closed 13 years ago

#28052 closed defect (fixed)

py26-gst-python: 'python' plugin does not work because libpython2.6 cannot be found

Reported by: lsinger@… Owned by: rmstonecipher@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc:
Port: py26-gst-python

Description

The plugin named "python", which is included in the gst-python package, needs to know where to find libpython2.x at run time.

To reproduce, first nuke your plugin registry:

$ rm -f ~/.gstreamer-0.10/registry.*.bin

Then, run gst-inspect on the "python" plugin as follows:

$ GST_DEBUG=2 gst-inspect --gst-plugin-path=/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10 python

You should get the following output (or something like it):

0:00:00.004724000  1735   0x606b00 WARN                pyplugin gstpythonplugin.c:373:plugin_init: Couldn't g_module_open libpython. Reason: dlopen(/usr/lib/libpython2.6.dylib, 10): image not found
0:00:00.004784000  1735   0x606b00 WARN      GST_PLUGIN_LOADING gstplugin.c:558:gst_plugin_register_func: plugin "/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10/libgstpython.so" failed to initialise
0:00:00.005348000  1735   0x606b00 WARN                pyplugin gstpythonplugin.c:373:plugin_init: Couldn't g_module_open libpython. Reason: dlopen(/usr/lib/libpython2.6.dylib, 10): image not found
0:00:00.005366000  1735   0x606b00 WARN      GST_PLUGIN_LOADING gstplugin.c:558:gst_plugin_register_func: plugin "/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10/libgstpython.so" failed to initialise
No such element or plugin 'python'

Now, apply the attached patch, then update py26-gst-python:

$ sudo port upgrade py26-gst-python

Then nuke your plugin registry again:

$ rm -f ~/.gstreamer-0.10/registry.*.bin

and run gst-inspect again:

$ GST_DEBUG=2 gst-inspect --gst-plugin-path=/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10 python

You should now get the following output, indicating that the "python" plugin was found and was loaded successfully:

Plugin Details:
  Name:			python
  Description:		loader for plugins written in python
  Filename:		/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10/libgstpython.so
  Version:		0.10.20
  License:		LGPL
  Source module:	gst-python
  Binary package:	GStreamer Python Bindings
  Origin URL:		http://gstreamer.freedesktop.org


  0 features:

If you have any Python element classes installed, then they will be listed under 'features'.

Similar patches could be applied to the ports py25-gst-python and py27-gst-python.

Attachments (4)

patch-Portfile (729 bytes) - added by lsinger@… 13 years ago.
proposed patch
Portfile-py25-gst-python.diff (729 bytes) - added by lsinger@… 13 years ago.
Portfile-py26-gst-python.diff (729 bytes) - added by lsinger@… 13 years ago.
Portfile-py27-gst-python.diff (729 bytes) - added by lsinger@… 13 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 13 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to rmstonecipher@…
Port: py26-gst-python added

Please remember to fill in the Port field and cc the maintainer.

Changed 13 years ago by lsinger@…

Attachment: patch-Portfile added

proposed patch

Changed 13 years ago by lsinger@…

Changed 13 years ago by lsinger@…

Changed 13 years ago by lsinger@…

comment:2 Changed 13 years ago by lsinger@…

I've added attachments for py25-gst-python, py26-gst-python, and py27-gst-python. I updated these patches against the recent version increment.

comment:3 Changed 13 years ago by rmstonecipher@…

Leo,
While I have confirmed that your method changes something, I'm a little concerned about ~/.gstreamer-0.10/.
I am not comfortable with the idea of having port remove a file in a user's home directory so that gstreamer can recreate that file.
Also, my results were not the same as yours:

euclid:~ ryan$ rm .gstreamer-0.10/registry.*
euclid:~ ryan$ gst-inspect --gst-plugin-path=/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10 python

(gst-plugin-scanner:76458): GStreamer-WARNING **: Failed to load plugin '/opt/local/lib/gstreamer-0.10/libgstcog.so': dlopen(/opt/local/lib/gstreamer-0.10/libgstcog.so, 2): Library not loaded: /opt/local/lib/libpng12.0.dylib
  Referenced from: /opt/local/lib/gstreamer-0.10/libgstcog.so
  Reason: image not found

(gst-plugin-scanner:76458): GStreamer-WARNING **: Failed to load plugin '/opt/local/lib/gstreamer-0.10/libgstopengl.so': dlopen(/opt/local/lib/gstreamer-0.10/libgstopengl.so, 2): Library not loaded: /opt/local/lib/libpng12.0.dylib
  Referenced from: /opt/local/lib/gstreamer-0.10/libgstopengl.so
  Reason: image not found
No such element or plugin 'python'

It looks like the above warnings are caused by shortcomings of files installed by gst-plugins-bad and gst-plugins-gl and would appreciate it if you would confirm that suspicion.
I should be able to commit your revisions this evening.

Cheers,
Ryan Stonecipher

comment:4 in reply to:  3 Changed 13 years ago by lsinger@…

Replying to rmstonecipher@…:

While I have confirmed that your method changes something, I'm a little concerned about ~/.gstreamer-0.10/.
I am not comfortable with the idea of having port remove a file in a user's home directory so that gstreamer can recreate that file.

But port doesn't delete the registry. I just added the instruction to delete it so that gst-inspect would be forced to attempt to load all plugins. If the plugin scanner fails to load a particular plugin, it will 'blacklist' it by making a note in the registry not to try to load it.

If you had previously run gst-inspect and it had not been able to load the plugin 'python', then you would see just the error message

No such element or plugin 'python'

Whereas if you start without a plugin registry then you should get this more informative version:

0:00:00.004724000  1735   0x606b00 WARN                pyplugin gstpythonplugin.c:373:plugin_init: Couldn't g_module_open libpython. Reason: dlopen(/usr/lib/libpython2.6.dylib, 10): image not found
0:00:00.004784000  1735   0x606b00 WARN      GST_PLUGIN_LOADING gstplugin.c:558:gst_plugin_register_func: plugin "/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10/libgstpython.so" failed to initialise
0:00:00.005348000  1735   0x606b00 WARN                pyplugin gstpythonplugin.c:373:plugin_init: Couldn't g_module_open libpython. Reason: dlopen(/usr/lib/libpython2.6.dylib, 10): image not found
0:00:00.005366000  1735   0x606b00 WARN      GST_PLUGIN_LOADING gstplugin.c:558:gst_plugin_register_func: plugin "/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10/libgstpython.so" failed to initialise
No such element or plugin 'python'

Also, my results were not the same as yours:

euclid:~ ryan$ rm .gstreamer-0.10/registry.*
euclid:~ ryan$ gst-inspect --gst-plugin-path=/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/gstreamer-0.10 python

(gst-plugin-scanner:76458): GStreamer-WARNING **: Failed to load plugin '/opt/local/lib/gstreamer-0.10/libgstcog.so': dlopen(/opt/local/lib/gstreamer-0.10/libgstcog.so, 2): Library not loaded: /opt/local/lib/libpng12.0.dylib
  Referenced from: /opt/local/lib/gstreamer-0.10/libgstcog.so
  Reason: image not found

(gst-plugin-scanner:76458): GStreamer-WARNING **: Failed to load plugin '/opt/local/lib/gstreamer-0.10/libgstopengl.so': dlopen(/opt/local/lib/gstreamer-0.10/libgstopengl.so, 2): Library not loaded: /opt/local/lib/libpng12.0.dylib
  Referenced from: /opt/local/lib/gstreamer-0.10/libgstopengl.so
  Reason: image not found
No such element or plugin 'python'

It looks like the above warnings are caused by shortcomings of files installed by gst-plugins-bad and gst-plugins-gl and would appreciate it if you would confirm that suspicion.

Is this with or without the patch?

The error messages about libgstcog and libgstopengl are not related to gst-python. They are error messages about different plugins. Both libgstcog and libgstopengl depend on libpng, which could not be found in /opt/local/lib.

I've seen that sort of error message about libpng before. Which version of the libpng port do you have installed? Is it possible that you built gst-plugins-bad and gst-plugins-gl against libpng 1.2 and later upgraded libpng to 1.4? This was the case with me; the name of the library changed from libpng12 to libpng14.

comment:5 Changed 13 years ago by lsinger@…

Just wanted to check on where this stands. I am working on a project that makes extensive use of Python plugins. I would like to be able to use the MacPorts distribution of GStreamer. Thanks!

comment:6 Changed 13 years ago by rmstonecipher@…

Resolution: fixed
Status: newclosed

Leo,
I committed your proposed changes in r76086.

Cheers,
Ryan Stonecipher

P.S. I used subversion's "changelist" command to commit revisions to these three python ports without committing other changes within my python directory.
Thanks for giving me a reason to learn that command.

Note: See TracTickets for help on using tickets.