1. Ronald Oussoren
  2. pyobjc
  3. Issues

Issues

Issue #30 resolved

pyobjc-core fails to install due to problem with libffi

Ken Hagler
created an issue

I attempted to install the latest PyObj, starting with pip install -U pyobjc-core. This failed with the following output:

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c libffi-src/x86/x86-ffi64.c -o build/temp.macosx-10.6-intel-2.7/libffi-src/x86/x86-ffi64.o -DPyObjC_STRICT_DEBUGGING -DMACOSX -DPyObjC_BUILD_RELEASE=1008 -DMACOSX -g -fexceptions -Wall -Wstrict-prototypes -Wmissing-prototypes -Wformat=2 -W -Wpointer-arith -Wmissing-declarations -Wnested-externs -W -Wno-import -DPyObjC_BUILD_RELEASE=1008 -isysroot / -Ibuild/codegen/ -Ilibffi-src/include -Ilibffi-src/powerpc
libffi-src/x86/x86-ffi64.c:32:20: error: stdarg.h: No such file or directory
libffi-src/x86/x86-ffi64.c:49: warning: function declaration isnt a prototype
libffi-src/x86/x86-ffi64.c: In function classify_argument:
libffi-src/x86/x86-ffi64.c:188: warning: empty body in an else-statement
libffi-src/x86/x86-ffi64.c: At top level:
libffi-src/x86/x86-ffi64.c:432: warning: function declaration isnt a prototype
libffi-src/x86/x86-ffi64.c:615: warning: ignoring #pragma clang diagnostic
libffi-src/x86/x86-ffi64.c:616: warning: ignoring #pragma clang diagnostic
libffi-src/x86/x86-ffi64.c:623: warning: ignoring #pragma clang diagnostic
libffi-src/x86/x86-ffi64.c:624: warning: no previous prototype for ffi_closure_unix64_inner
lipo: can't figure out the architecture type of: /var/folders/st/_4cq6zhm8xlcwm001s7p48nh0000gn/T//ccAOqKVU.out
error: command 'gcc-4.2' failed with exit status 1

This on Mac OS X 10.8.2, Python 2.7.3.

I Googled around a bit and found several references to this problem going back as far as 2009, but no solutions.

Comments (8)

  1. Ronald Oussoren repo owner

    Which version of python do you use? It it one of the binary installers on the pyt#hon.org website?

    Could you try installing with:

     $ env CC=clang pip install -U pyobjc-core
    

    I suspect that this is a compiler issue. I haven't noticed this myself because I haven't used a binary installer in a long time. If using clang does actually fix this issue I'll (1) change PyObjC's setup.py file to detect this issue, and (2) work on a patch for the python source tree to fix the issue there as well. Distutils already contains a lot of code to work around toolchain issues on OSX, one more hack won't be a problem.

    BTW. You are the first person that actually reported the issue to me, thanks for that.

  2. Ken Hagler reporter

    Yes, it's from the installer on python.org.

    Installing with your suggested change worked. Once that was done, I found that the same thing was needed for pyobjc:

    env CC=clang pip install -U pyobjc
    
  3. Ronald Oussoren repo owner

    Which version of Xcode do you use? I'm using Xcode 4.5.2 and that doesn't have a gcc-4.2 at all.

    That is, when I try to compile with 'CC=gcc-4.2' I get an error because the compiler cannot be found at all:

    $ CC="gcc-4.2 -arch i386" python setup.py build_ext
    running build_ext 
    building 'objc._objc' extension
    gcc-4.2 -arch i386 -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c libffi-src/ffi.c -o build/temp.macosx-10.8-intel-2.7/libffi-src/ffi.o -DPyObjC_STRICT_DEBUGGING -DMACOSX -DPyObjC_BUILD_RELEASE=1008 -DMACOSX -g -fexceptions -Wall -Wstrict-prototypes -Wmissing-prototypes -Wformat=2 -W -Wpointer-arith -Wmissing-declarations -Wnested-externs -W -Wno-import -DPyObjC_BUILD_RELEASE=1008 -isysroot / -Ibuild/codegen/ -Ilibffi-src/include -Ilibffi-src/powerpc
    gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
    gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
    lipo: can't figure out the architecture type of:    /var/folders/1y/743yv1f91d3d2jtgq6m01nxr0000gp/T//cct1pLwp.out
    error: command 'gcc-4.2' failed with exit status 255
    
  4. Ken Hagler reporter

    I have the same version of Xcode, but I also have gcc-4.2, installed via Homebrew:

    brew install apple-gcc42
    

    I'd installed it as part of a lengthy effort to get the latest version of Ruby, which apparently suffers from the same problem described in that Python bug.

  5. Ronald Oussoren repo owner

    The problem is that Apple changes the way their compiler toolchain works about every other release. We try to hide that in Python's distutils, but there will always be a window where the change to distutils hasn't landed yet.

    The 32-bit installer for Python is even more fun, it is not possible at all to build extensions for that on OSX 10.8 because Apple no longer ships a compiler that can create PPC code.

  6. Log in to comment