BlackenedSun
BlackenedSun

Reputation: 51

waf build system can not find python libraries

i'm trying to build pycairo-1.0 for python3 and getting bad output

root@blackenedsun:/home/blackenedsun/Downloads/pycairo-1.10.0# ./waf configure --prefix=/usr 
  ./options()
Setting top to                           : /home/blackenedsun/Downloads/pycairo-1.10.0 
Setting out to                           : /home/blackenedsun/Downloads/pycairo-1.10.0/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/local/bin/python
Checking for python version              : (3, 3, 2, 'final', 0)
Checking for library python3.3 in LIBDIR : not found 
Checking for library python3.3 in python_LIBPL : not found 
Checking for library python3.3 in $prefix/libs : not found 
Checking for library python3.3m in LIBDIR      : yes 
Checking for program python3.3-config          : /usr/bin/python3.3-config 
command ['/usr/local/bin/python', '/usr/bin/python3.3-config', '--includes'] returned 1
root@blackenedsun:/home/blackenedsun/Downloads/pycairo-1.10.0# 

what can i do to find python3.3 libraries properly?

Upvotes: 4

Views: 3319

Answers (2)

I got the same problem. And I fixed by adding system variable like this:
['/usr/local/bin/python3.4', '/usr/local/bin/python3.4-config', '--includes'] returned 1

export PYTHON_CONFIG="/usr/local/lib/python3.4/config-3.4m/python-config.py"

Upvotes: 1

Michael Dussere
Michael Dussere

Reputation: 498

I get the same problem with python 3.4.

It is due to waf trying to execute python3.4-config with python while python3.4-config is a shell script.

In fact launching python3.4-config alone works perfectly.

    [dusserm@l92-ci-e pycairo-1.10.0]$ python3 /Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config --includes
      File "/Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config", line 7
        echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir"
                                                                                                                                    ^
    SyntaxError: invalid syntax
    [dusserm@l92-ci-e pycairo-1.10.0]$ /Produits/publics/x86_64.Linux.RH6/python/3.4.1/bin/python3.4-config --includes
    -I/nfs/nfs/Produits/publics/x86_64.Linux.RH6/python/3.4.1/include/python3.4m -I/nfs/nfs/Produits/publics/x86_64.Linux.RH6/python/3.4.1/include/python3.4m

The problem comes from waf not using python3.X-config correctly.

The workaround I found is to modify directly the hidden directory in which the waf scripts are unzipped (in my case .waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6). Go to this directory an change the file waflib/Tools/python.py to call python3.X-config directly without python.

--- waflib/Tools/python.py.old  2014-08-01 14:36:23.750613874 +0000
+++ waflib/Tools/python.py      2014-08-01 14:36:38.359627761 +0000
@@ -169,7 +169,7 @@
                conf.find_program('python-config-%s'%num,var='PYTHON_CONFIG',mandatory=False)
        includes=[]
        if conf.env.PYTHON_CONFIG:
-               for incstr in conf.cmd_and_log(conf.env.PYTHON+[conf.env.PYTHON_CONFIG,'--includes']).strip().split():
+               for incstr in conf.cmd_and_log([conf.env.PYTHON_CONFIG,'--includes']).strip().split():
                        if(incstr.startswith('-I')or incstr.startswith('/I')):
                                incstr=incstr[2:]
                        if incstr not in includes:

Upvotes: 2

Related Questions