Homebrew-core: Consistent error installing ansible 2.2

Created on 23 Nov 2016  Â·  14Comments  Â·  Source: Homebrew/homebrew-core

  • [x] Ran brew update and retried your prior step?
  • [x] Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • [x] If you're seeing permission errors tried running sudo chown -R $(whoami) $(brew --prefix)? (not applicable)

Bug reports:

Cannot install ansible 2.2 (ansible-2.2.0.0.tar.gz). Consistently failing on the step that installs cffi (==> /Users/austin/.brew/Cellar/ansible/2.2.0.0_1/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed /private/tmp/ansible--cffi-20161123-84131-1ww9fzl/cffi-1.8.3). I am using brew-installed Python, built --universal:

☺ 7042 ‣ which python
/Users/austin/.brew/bin/python

I have previously installed Ansible through Homebrew with no problems, and was successfully running Ansible 2.1. Only since Ansible 2.2 have I been unable to upgrade or install, generally failing at this point. pip install ansible seems to work just fine.

The install logs have been gisted.

Most helpful comment

Agreed. For the reporters, you can work around this by installing the CLT package with xcode-select --install. I wonder why this fails?

The failure is

    clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/Users/austin/.brew/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.12-intel-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>

The superenv shim shows

clang called with: -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/Users/austin/.brew/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.12-intel-2.7/c/_cffi_backend.o
superenv removed:  -arch i386 -arch x86_64 -g -O3 -Wall -Wstrict-prototypes
superenv added:    -pipe -w -Os -march=native --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -isystem/Users/austin/.brew/include -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/apache2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -I/Users/austin/.brew/opt/[email protected]/include
superenv executed: clang -pipe -w -Os -march=native -fno-strict-aliasing -fno-common -dynamic -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -fwrapv -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/Users/austin/.brew/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.12-intel-2.7/c/_cffi_backend.o -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -isystem/Users/austin/.brew/include -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/apache2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -I/Users/austin/.brew/opt/[email protected]/include

The file exists as /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/ffi/ffi.h.

I would have anticipated that the combination of -I/usr/include/ffi and --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk would successfully locate the header.

All 14 comments

Been seeing same issue for several weeks. gisted files

@tdsmith Looks like a possible Xcode-only problem finding libffi?

Agreed. For the reporters, you can work around this by installing the CLT package with xcode-select --install. I wonder why this fails?

The failure is

    clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/Users/austin/.brew/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.12-intel-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>

The superenv shim shows

clang called with: -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/Users/austin/.brew/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.12-intel-2.7/c/_cffi_backend.o
superenv removed:  -arch i386 -arch x86_64 -g -O3 -Wall -Wstrict-prototypes
superenv added:    -pipe -w -Os -march=native --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -isystem/Users/austin/.brew/include -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/apache2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -I/Users/austin/.brew/opt/[email protected]/include
superenv executed: clang -pipe -w -Os -march=native -fno-strict-aliasing -fno-common -dynamic -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -fwrapv -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/Users/austin/.brew/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.12-intel-2.7/c/_cffi_backend.o -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -isystem/Users/austin/.brew/include -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/apache2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -I/Users/austin/.brew/opt/[email protected]/include

The file exists as /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/ffi/ffi.h.

I would have anticipated that the combination of -I/usr/include/ffi and --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk would successfully locate the header.

It looks like I misunderstood the interaction of -I and --sysroot; the gcc behavior (which I assume clang is emulating?) is:

-I dir
Add the directory dir to the list of directories to be searched for header files. Directories named by -I are searched before the standard system include directories. If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated . __If dir begins with =, then the = will be replaced by the sysroot prefix; see --sysroot and -isysroot.__

This seems like something superenv should be aware of.

Installing CLT per @tdsmith worked, and I now have ansible 2.2.0.0 installed. Thanks.

Adding this to the shim breaks the cffi build on my machine with a clang "can't find ffi.h" error, heh:

sysroot_search = val.start_with?("/usr/include/") ? "=" : ""
args << "-I#{sysroot_search}#{val}" if keep?(path) && @iset.add?(path)

sysroot_search = val.start_with?("/usr/include/") ? "#{sysroot}/" : "" works on a CLT-ful system, anyway.

@tdsmith your proposed work around seemed to help. I uninstalled ansible, ran xcode-select --install, and reinstalled ansible, and it worked.

@ilovezfs Any thoughts here?

It is definitely _not_ an "acceptable" workaround to require CLT given all the needed files are in Xcode.app's SDK

iMac-TMP:~ joe$ find /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk|grep 'ffi/'|grep -E '\.h$'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/ffi_common.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/fficonfig.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/ffitarget.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/ppc-darwin.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/ppc-ffitarget.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi/x86-ffitarget.h

I think there is universal agreement on that point.

@tdsmith I wouldn't be so sure: https://github.com/Homebrew/brew/pull/965.

It seems the only thing needed to fix this is

    ENV.prepend "CPPFLAGS", "-I#{MacOS.sdk.path}/usr/include/ffi"

since the include is #include <ffi.h> not #include <ffi/ffi.h>

Closed via #8992.

Was this page helpful?
0 / 5 - 0 ratings