Bug 76759 - [regression] build failure using python 3.4.0m
Summary: [regression] build failure using python 3.4.0m
Status: RESOLVED FIXED
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
: 91561 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-03-28 19:46 UTC by David Ronis
Modified: 2017-07-05 15:00 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description David Ronis 2014-03-28 19:46:22 UTC
I've tried to build pycairo 1.10.0 or today's git master with the same result.  I export several variables so that the correct version of python is found (I have 2.7 and 3.4 installed):

export PYTHON:=$(bindir)/python3
export PYVER:=3.4
export PYTHONPATH:=$(libdir)/python$(PYVER)/site-packages:$(libdir)/python$(PYVER)
export LIBPATH_PYEMBED:=$(PYTHONPATH)

and then run

$(PYTHON) ./waf configure --prefix=$(prefix)

(actually all this is done using a makefile).

I get:

  ./options()
Setting top to                           : /home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git 
Setting out to                           : /home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : /usr/bin/gcc 
Checking for program python              : /opt/garnome-3.12.0/bin/python3 
Checking for python version              : (3, 4, 0, 'final', 0) 
Checking for library python3.4 in LIBPATH_PYEMBED : Traceback (most recent call last):
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Scripting.py", line 97, in waf_entry_point
    run_commands()
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Scripting.py", line 153, in run_commands
    ctx=run_command(cmd_name)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Scripting.py", line 146, in run_command
    ctx.execute()
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Configure.py", line 128, in execute
    super(ConfigurationContext,self).execute()
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Context.py", line 87, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Context.py", line 128, in recurse
    user_function(self)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/wscript", line 36, in configure
    ctx.check_python_headers()
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Configure.py", line 224, in fun
    return f(*k,**kw)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Tools/python.py", line 177, in check_python_headers
    result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False,msg='Checking for library %s in LIBPATH_PYEMBED'%name)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Configure.py", line 224, in fun
    return f(*k,**kw)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Tools/c_config.py", line 376, in check
    ret=self.run_c_code(*k,**kw)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Configure.py", line 224, in fun
    return f(*k,**kw)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Tools/c_config.py", line 460, in run_c_code
    bld.compile()
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Build.py", line 196, in compile
    self.store()
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Utils.py", line 386, in f
    ret=fun(*k,**kw)
  File "/home/ronis/Project/notar/GNOME/garnome/svn/pycairo/work/main.d/pycairo-git/.waf3-1.7.8-77e2cdd38ea2930f982e3aabf335fdb7/waflib/Build.py", line 170, in store
    cPickle.dump(data,f,-1)
_pickle.PicklingError: Can't pickle <class 'waflib.Node.Context.__init__.<locals>.node_class'>: attribute lookup Context.__init__.<locals>.node_class on waflib.Node failed
Comment 1 Vladimír Čunát 2014-05-20 10:04:42 UTC
We're getting the same on x86-64. http://hydra.nixos.org/build/11113443/nixlog/1/tail-reload
Exactly the same build works with python-3.3.5.
Comment 2 Vladimír Čunát 2014-05-20 10:45:26 UTC
Ah, LFS patches solved that for me. http://www.linuxfromscratch.org/blfs/view/svn/general/python-modules.html#pycairo
Comment 3 Barry Warsaw 2015-08-05 22:07:45 UTC
We're getting exactly this crash now when trying to build py3cairo on Ubuntu.  I filed https://bugs.freedesktop.org/show_bug.cgi?id=91561 which seemed to fix the problem at first, but it's back now, and unless the patches linked in comment 2 have changed or I'm looking in the wrong place, they do not fix the problem (I also have a hard time seeing how they could, but waflib is a mystery to me atm).
Comment 4 David H. Gutteridge 2015-12-12 08:07:46 UTC
I've also recently encountered this problem on NetBSD 7.0/i386 with Python 3.5 (3.4 didn't exhibit this issue for me):

  File "/home/disciple/pkgsrc/graphics/py-cairo3/work/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Build.py", line 164, in store
    cPickle.dump(data,f)
AttributeError: Can't pickle local object 'Context.__init__.<locals>.node_class'
Checking for library python3.5 in LIBPATH_PYEMBED : *** Error code 2

While it doesn't address the underlying cause, my workaround to get it to build was this:

--- .waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Build.py.orig       2011-03-29 10:52:54.000000000 -0400
+++ .waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Build.py        
@@ -162,6 +162,8 @@
                        try:
                                f=open(db+'.tmp','wb')
                                cPickle.dump(data,f)
+                       except AttributeError as err:
+                               print(format(err))
                        finally:
                                if f:
                                        f.close()

This allows the build to complete, while still exposing that there's something quirky happening in the dependent waf code. A comparison of output from 3.4 (no pre-existing issue) and 3.5 (after my patch) shows that the build process is still able to determine what it needs to in order to continue despite the multiple exceptions thrown.

Python 3.4.3:

  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/pkg/bin/python3.4 
Checking for python version              : (3, 4, 3, 'final', 0) 
Checking for library python3.4 in LIBPATH_PYEMBED : yes 
Checking for program python3.4-config             : /usr/pkg/bin/python3.4-config 
Checking for header Python.h                      : yes 
Checking for program pkg-config                   : /home/disciple/pkgsrc/graphics/py-cairo3/work/.tools/bin/pkg-config 
Checking for 'cairo' >= 1.10.0                    : yes 
Configuration:
PREFIX                                   : /usr/pkg
LIBDIR                                   : /usr/pkg/lib
'configure' finished successfully (7.213s)

Python 3.5.1:

  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/pkg/bin/python3.5 
Checking for python version              : (3, 5, 1, 'final', 0) 
Can't pickle local object 'Context.__init__.<locals>.node_class'
Checking for library python3.5 in LIBPATH_PYEMBED : yes 
Checking for program python3.5-config             : /usr/pkg/bin/python3.5-config 
Can't pickle local object 'Context.__init__.<locals>.node_class'
Checking for header Python.h                      : yes 
Checking for program pkg-config                   : /home/disciple/pkgsrc/graphics/py-cairo3/work/.tools/bin/pkg-config 
Checking for 'cairo' >= 1.10.0                    : yes 
Configuration:
PREFIX                                   : /usr/pkg
LIBDIR                                   : /usr/pkg/lib
'configure' finished successfully (7.036s)

The basic test suite passes for me after building.

======================================================== test session starts =========================================================
platform netbsd7 -- Python 3.5.1, pytest-2.8.3, py-1.4.30, pluggy-0.3.1
rootdir: /home/disciple/pkgsrc/graphics/py-cairo3/work/pycairo-1.10.0/test, inifile: 
collected 7 items 

api_test.py ......
examples_test.py .

====================================================== 7 passed in 3.72 seconds ======================================================

So while it's not the most elegant solution, I can get it to build. Whether this workaround would address everyone else's problems I don't know.
Comment 5 David H. Gutteridge 2015-12-12 12:25:39 UTC
Someone's just pointed out to me that FreeBSD handled this problem a bit differently, by simply disabling the entire function that's an issue.

https://svnweb.freebsd.org/ports/head/graphics/py3-cairo/files/pycairo-1.10.0-waf-py3_5.patch?revision=401900&view=markup

(To each their own.)
Comment 6 Christoph Reiter 2017-07-05 14:58:14 UTC
Since 1.11 pycairo uses distutils for building. If there are any problems with the new system please file a bug: https://github.com/pygobject/pycairo/issues
Comment 7 Christoph Reiter 2017-07-05 15:00:00 UTC
*** Bug 91561 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.