PyObjC fails to compile on MacOS X 10.10/XCode 7.2

Issue #151 closed
wooque
created an issue

I failed during building wheel for pyobjc-framework-Cocoa, relevant part from error log:

    copying PyObjCTest/test_weirdness.py -> build/lib.macosx-10.10-x86_64-2.7/PyObjCTest
    running build_ext
    building 'CoreFoundation._inlines' extension
    creating build/temp.macosx-10.10-x86_64-2.7/Modules
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibuild/temp.macosx-10.10-x86_64-2.7/pyobjc-include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Modules/_Core
Foundation_inlines.m -o build/temp.macosx-10.10-x86_64-2.7/Modules/_CoreFoundation_inlines.o -DPyObjC_BUILD_RELEASE=1010 -Wno-deprecated-declarations -isysroot /
    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.10-x86_64-2.7/Modules/_CoreFoundation_inlines.o -o build/lib.macosx-10.10-x86_64-2.7/CoreFoundation/_inlines.so -framework CoreFoundation -isysroot /
    building 'CoreFoundation._CoreFoundation' extension
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibuild/temp.macosx-10.10-x86_64-2.7/pyobjc-include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Modules/_Core
Foundation.m -o build/temp.macosx-10.10-x86_64-2.7/Modules/_CoreFoundation.o -DPyObjC_BUILD_RELEASE=1010 -Wno-deprecated-declarations -isysroot /
    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.10-x86_64-2.7/Modules/_CoreFoundation.o -o build/lib.macosx-10.10-x86_64-2.7/CoreFoundation/_CoreFoundation.so -framework CoreFoundation -isysroot /
    building 'Foundation._inlines' extension
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibuild/temp.macosx-10.10-x86_64-2.7/pyobjc-include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Modules/_Foun
dation_inlines.m -o build/temp.macosx-10.10-x86_64-2.7/Modules/_Foundation_inlines.o -DPyObjC_BUILD_RELEASE=1010 -Wno-deprecated-declarations -isysroot /
    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.10-x86_64-2.7/Modules/_Foundation_inlines.o -o build/lib.macosx-10.10-x86_64-2.7/Foundation/_inlines.so -framework Foundation -isysroot /
    building 'Foundation._Foundation' extension
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ibuild/temp.macosx-10.10-x86_64-2.7/pyobjc-include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Modules/_Foun
dation.m -o build/temp.macosx-10.10-x86_64-2.7/Modules/_Foundation.o -DPyObjC_BUILD_RELEASE=1010 -Wno-deprecated-declarations -isysroot /
    In file included from Modules/_Foundation.m:15:
    Modules/_Foundation_protocols.m:14:28: error: cannot find protocol declaration for 'NSProgressReporting'
        p = PyObjC_IdToPython(@protocol(NSProgressReporting)); Py_XDECREF(p);
                               ^
    Modules/_Foundation_protocols.m:15:28: error: cannot find protocol declaration for 'NSURLSessionStreamDelegate'
        p = PyObjC_IdToPython(@protocol(NSURLSessionStreamDelegate)); Py_XDECREF(p);
                               ^
    2 errors generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/Users/vuk/cherryfile_desktop/virtualenv/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/6k/f3sz7z452c9ft_twr7mssmww0000gn/T/pip-build-VbNvbj/pyobjc-framework-Cocoa/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__)
.read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6k/f3sz7z452c9ft_twr7mssmww0000gn/T/pip-XhWLQr-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/vuk/cherryfile_desktop/virtualenv/bin/../incl
ude/site/python2.7/pyobjc-framework-Cocoa" failed with error code 1 in /private/var/folders/6k/f3sz7z452c9ft_twr7mssmww0000gn/T/pip-build-VbNvbj/pyobjc-framework-Cocoa/

Comments (24)

  1. Andrew Kulidjian

    I have the same issue with 10.11.4 and Xcode Version 7.3 (7D175). I get:

    1. Failed building wheel for pyobjc-framework-CoreLocation
    2. Failed building wheel for pyobjc-framework-MapKit
    3. Failed building wheel for pyobjc-framework-Quartz

    3 errors generated. error: command 'clang' failed with exit status 1

    I also get this error:

    error: command 'gcc' failed with exit status 1

    ,when I try 'pip install -U pyobjc' instead of 'env CC=clang pip install -U pyobjc'

  2. Ronald Oussoren repo owner

    What python version are you using? In particular, are you using Anaconda or a Python where sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') returns an OSX release before 10.6?

    If so: set "MACOSX_DEPLOYMENT_TARGET=10.6" before installing (or even set it to 10.10 if you don't intend to install the binaries on older OSX releases).

    PyObjC 3.2 will have a proper fix for this.

  3. wooque reporter

    Latest Python from Homebrew, unfortunately I'm currently on vacation til May 4th, but as soon as I come back I will check what sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') is returning

  4. Marc C

    I ran into the exact same issue trying to install pyatom. Per https://github.com/pyatom/pyatom/issues/106 I had to install pyobj-core (which worked) then pyobj ( did not work, had the exact same stacktrace as described above).

    sw_vers

    ProductName: Mac OS X / ProductVersion: 10.10.5 / BuildVersion: 14F1713

    xcodebuild -version

    Xcode 7.2.1 / Build version 7C1002

    python --version

    2.7.10

    python

    import sysconfig

    sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')

    10.6

    Command that led to the same stacktrace:

    pip install -U pyobjc

    Per stdout, this is installing version "3.1.1".

    Any timeline for when will PyObjC 3.2 be released ?

  5. Nate McFeters

    Having the exact same issue as the others. To answer your question to Marc C, I'm not using homebrew for this... I have pyenv to manage my instances, and I'm having issues with all instances. I believe that this behavior changed when I recently updated xcode.

  6. Ronald Oussoren repo owner

    This is annoying: I cannot reproduce the issue with HomeBrow. In a freshly installed HomeBrew installation on OSX 10.10.5:

    $ brew install python
    $ pip install pyobjc-core
    $ pip install pyobjc
    

    This results in a successful installation of PyObjC.

    @wooque: Do you have a different compiler installed with HomeBrew?

  7. wooque reporter

    Nope. If it means something this is the output of gcc, clang and cc versions.

    $ gcc -v
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin14.5.0
    Thread model: posix
    $ clang -v
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin14.5.0
    Thread model: posix
    $ cc -v
    Apple LLVM version 7.0.2 (clang-700.1.81)
    Target: x86_64-apple-darwin14.5.0
    Thread model: posix
    

    Also this is the list of things installed via Homebrew

    $ brew list
    cloc            gdbm            git             gnutls          libevent        libtasn1        openconnect     pcre            python          qt              readline        sqlite          tmux            xz
    cmake           gettext         gmp             htop            libmagic        nettle          openssl         pyside          python3         ranger          shiboken        tcl-tk          wget            zsh
    
  8. wooque reporter

    Well I solved the problem by installing from source from tip. Problem is that version from PyPi - 3.1.1 doesn't have NSURLSessionStreamDelegate and NSProgressReporting in pyobjc / pyobjc-framework-Cocoa / Modules / _Foundation_protocols.m guarded with PyObjC_BUILD_RELEASE >=1011 but with >=1010, this is already fixed by commit fc965d3 dated 2016-03-31.

  9. David C

    I'm having the same problem as well. However I don't understand the fix. I'm a novice here. Per wooque's last comment, what exactly needs to be updated to get pyobjc to install correctly?

  10. wooque reporter

    Fix is to install from source. There are instruction on project overview, but if you don't have Mercurial installed (hg) you can download latest source from Downlaod/Tags/tip

  11. Log in to comment