GNOME Bugzilla – Bug 634082
[0.10] gst-python does not compile if python 3 is default compiler
Last modified: 2012-12-17 11:40:51 UTC
I have python 3 as the default python on my system. I have 2 problems with this: * I can't find any configuration option to specify the python version, the only check that is done is that the python version > 2.3. Looks like it is not possible to build for a non-default python version (if python2 is also installed next to python3) * Build on python 3 does not work. configure passes but gives some ugly output, compile failes: checking for python... /usr/bin/python checking for python version... 3.1 checking for python platform... linux2 checking for python script directory... ${prefix}/lib/python3.1/site-packages checking for python extension module directory... ${exec_prefix}/lib/python3.1/site-packages checking for python >= 2.3... okay checking for headers required to compile python extensions... File "<string>", line 1 import sys; print sys.prefix ^ SyntaxError: invalid syntax
+ Trace 224508
import sys; print sys.exec_prefix
found ... Building against GStreamer core 0.10.30 , ignoring API additions if needed checking for GST_BASE... yes checking for GST_CONTROLLER... yes checking for GST_NET... yes checking for GST_DP... yes checking for GST_PLUGINS_BASE... yes checking for PYGOBJECT... yes yes checking for PYGOBJECT_2_12... yes yes checking for PYGOBJECT_2_16... yes yes ... checking for libraries required to embed python... File "<string>", line 1 import distutils.sysconfig as s; print s.get_python_lib(standard_lib=1) ^ SyntaxError: invalid syntax yes error for build: make[3]: Entering directory `/home/tvermeir/devel/jhbuild_root/gst-python/gst' CC _gst_la-gstmodule.lo gstmodule.c:153:1: warning: return type defaults to 'int' gstmodule.c: In function 'DL_EXPORT': gstmodule.c:154:1: error: expected declaration specifiers before 'init_gst' gstmodule.c:417:1: error: expected '{' at end of input make[3]: *** [_gst_la-gstmodule.lo] Error 1
Created attachment 174520 [details] [review] build: check for python>2.3
The patch is not enough afaiu. What is giving errors during configure are our own custom checks in acinclude.m4. Also, as far as I can see, AM_PATH_PYTHON and AS_PATH_PYTHON do the same thing, except that the latter looks like it hasn't been updated for a while. I'll try to compile with python3 as the default python and post an update.
Indeed, this fixes only building with the non-default python2 compiler. It doesn't pickes the default 3.0 compiler. But this is also used in gnonlin, so I guess it's better than current implementation. Probably this should be better synchronized between different gst* modules.
The fix for this would be to add braces around print, i.e: print (s.get_python_lib(standard_lib=1)) Another easy option would be to run 2to3 ( http://docs.python.org/library/2to3.html ), but not certain about the backward compatibility.
Can this be worked around by setting the PYTHON environment variable when calling configure?
how about let the installer script call 'python2' instead of 'python'. I think that's the most right way. and separate pygst2 and pygst3
*** Bug 681558 has been marked as a duplicate of this bug. ***
Created attachment 220915 [details] Compilation failure log I tried to compile and failed with the attached log. I also tried patching this configure and after autoconf, ./configure I get the same error during make. My python is changed so that it points to python2 instead of 3, so the other fix fails as well: $ ls -l /usr/bin/python lrwxrwxrwx 1 root root 7 07-26 21:34 /usr/bin/python -> python2 Any ideas? I would like to build pitivi with ges, but can't because of gst-python which is dependency...
Closing this bug now, gst-python is only an extension module to pygi now and this bug doesn't make much sense anymore in this context. Also Tim changed many things to work with Python 3 lately.