KeyError 'MACOSX_DEPLOYMENT_TARGET' in waf on kubuntu
Asked Answered
I

0

0

I'm trying to install pycairo on kubuntu 13.04, and it's giving me an error complaining about MACOSX_DEPLOYMENT_TARGET:

(virtualenv-3)naught101@naught101-chronos:/tmp/pycairo-1.10.0$ python waf configure
  ./options()
Setting top to                           : /tmp/pycairo-1.10.0 
Setting out to                           : /tmp/pycairo-1.10.0/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /home/naught101/.virtualenvs/virtualenv-3/bin/python 
Checking for python version              : (3, 3, 2, 'final', 0) 
Traceback (most recent call last):
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Scripting.py", line 93, in waf_entry_point
    run_commands()
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Scripting.py", line 145, in run_commands
    run_command(cmd_name)
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Scripting.py", line 138, in run_command
    ctx.execute()
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Configure.py", line 124, in execute
    super(ConfigurationContext,self).execute()
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Context.py", line 87, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Context.py", line 127, in recurse
    user_function(self)
  File "/tmp/pycairo-1.10.0/wscript", line 29, in configure
    ctx.check_python_headers()
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Configure.py", line 217, in fun
    return f(*k,**kw)
  File "/tmp/pycairo-1.10.0/.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6/waflib/Tools/python.py", line 131, in check_python_headers
    if dct[x]:
KeyError: 'MACOSX_DEPLOYMENT_TARGET'
(virtualenv-3)naught101@naught101-chronos:/tmp/pycairo-1.10.0$ 

Of course, I'm not on a Mac, so I have no idea why this is appearing. Any ideas?

Edit: build_directory/config.log:

# project pycairo (1.10.0) configured on Fri Oct  4 20:15:40 2013 by
# waf 1.6.4 (abi 98, python 30302f0 on linux)
# using waf configure
#
----------------------------------------
Setting top to
/tmp/pycairo-1.10.0
----------------------------------------
Setting out to
/tmp/pycairo-1.10.0/build_directory
----------------------------------------
Checking for 'gcc' (c compiler)
find program=['gcc', 'cc'] paths=['/home/naught101/.virtualenvs/virtualenv-3/bin', '/home/naught101/.pyenv/shims', '/home/naught101/.pyenv/bin', '~/bin', '/usr/lib/x86_64-linux-gnu/qt4/bin', '/home/naught101/bin', '/usr/lib/lightdm/lightdm', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/usr/brlcad/bin'] var='CC' -> '/usr/bin/gcc'
find program=['ar'] paths=['/home/naught101/.virtualenvs/virtualenv-3/bin', '/home/naught101/.pyenv/shims', '/home/naught101/.pyenv/bin', '~/bin', '/usr/lib/x86_64-linux-gnu/qt4/bin', '/home/naught101/bin', '/usr/lib/lightdm/lightdm', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/usr/brlcad/bin'] var='AR' -> '/usr/bin/ar'
ok
----------------------------------------
Checking for program python
/home/naught101/.virtualenvs/virtualenv-3/bin/python
find program=['python'] paths=['/home/naught101/.virtualenvs/virtualenv-3/bin', '/home/naught101/.pyenv/shims', '/home/naught101/.pyenv/bin', '~/bin', '/usr/lib/x86_64-linux-gnu/qt4/bin', '/home/naught101/bin', '/usr/lib/lightdm/lightdm', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/usr/brlcad/bin'] var='PYTHON' -> '/home/naught101/.virtualenvs/virtualenv-3/bin/python'
['/home/naught101/.virtualenvs/virtualenv-3/bin/python', '-c', 'import sys\nfor x in sys.version_info: print(str(x))']
out: 3
3
2
final
0

['/home/naught101/.virtualenvs/virtualenv-3/bin/python', '-c', "from distutils.sysconfig import get_python_lib\n\nprint(repr(get_python_lib(standard_lib=0, prefix='/usr/local') or ''))"]
out: '/usr/local/lib/python3.3/site-packages'

['/home/naught101/.virtualenvs/virtualenv-3/bin/python', '-c', "from distutils.sysconfig import get_python_lib\n\nprint(repr(get_python_lib(plat_specific=1, standard_lib=0, prefix='/usr/local') or ''))"]
out: '/usr/local/lib/python3.3/site-packages'

----------------------------------------
Checking for python version
(3, 3, 2, 'final', 0)
['/home/naught101/.virtualenvs/virtualenv-3/bin/python', '-c', "from distutils.sysconfig import get_config_var\n\nprint(repr(get_config_var('prefix') or ''))\nprint(repr(get_config_var('SO') or ''))\nprint(repr(get_config_var('LDFLAGS') or ''))\nprint(repr(get_config_var('LIBDIR') or ''))\nprint(repr(get_config_var('LIBPL') or ''))\nprint(repr(get_config_var('INCLUDEPY') or ''))\nprint(repr(get_config_var('Py_ENABLE_SHARED') or ''))\nprint(repr(get_config_var('MACOSX_DEPLOYMENT_TARGET') or ''))\nprint(repr(get_config_var('LDSHARED') or ''))\nprint(repr(get_config_var('CFLAGS') or ''))"]
out: '/home/naught101/.virtualenvs/virtualenv-3'
'.so'
"-L'/home/naught101/.pyenv/versions/3.3.2/lib'"
'/home/naught101/.pyenv/versions/3.3.2/lib'
'/home/naught101/.pyenv/versions/3.3.2/lib/python3.3/config-3.3m'
'/home/naught101/.pyenv/versions/3.3.2/include/python3.3m'
''
''
"gcc -pthread -shared -L'/home/naught101/.pyenv/versions/3.3.2/lib'"
'-Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes'

Configuration returned from ['/home/naught101/.virtualenvs/virtualenv-3/bin/python']:
"prefix = '/home/naught101/.virtualenvs/virtualenv-3'\nSO = '.so'"
Intestine answered 2/10, 2013 at 1:59 Comment(7)
waf usually leaves a log file named config.log in the build directory. If it did, can you upload it to pastebin or somewhere similar and add a link?Bondman
Meanwhile, the most likely cause seems to be a problem with your Python configuration. How did you install your Python? What does import sysconfig, distutils.sysconfig; print(sysconfig.get_config_var('MACOSX_DEPLOYMENT_HEADER')); print(distutils.sysconfig.get_config_var('MACOSX_DEPLOYMENT_HEADER')) say?Bondman
Oh, and since you're using a virtualenv, was that migrated from another machine, or built from scratch?Bondman
There is no log file after the error. If I run that code in python, I get None; None;. I built the virtualenv using pyenv on this machine, and I'm using virtualenvwrapper to use it.Intestine
You're sure there's no config.log in build_directory?Bondman
Ah, yes, there is. I'll add it to the question.Intestine
OK, so at the earlier stage in the configure, it's successfully checking for MACOSX_DEPLOYMENT_TARGET and finding '', as it should… so I have no idea why it's failing to look up the same thing later. It probably has something to do with how that dct gets built out of the config vars, but I can't think of anything obvious, and I don't want to read and debug that much code. Hopefully someone else has a clue.Bondman

© 2022 - 2024 — McMap. All rights reserved.