Skip to content

Building with Homebrew llvm/clang fails with error: 'TARGET_OS_IPHONE' is not defined #5622

@dimpase

Description

@dimpase

What did you do?

On latest Homebrew on macOS 11.4 (x86_64) installed llvm package, and tried to build Pillow with
clang/clang++ it provides.

What did you expect to happen?

that it just works (many Python packages build just fine in such a setup)

What actually happened?

error: 'TARGET_OS_IPHONE' is not defined quite early in the build, compiling _imaging.c
In more detail,

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DHAVE_LIBJPEG -DHAVE_OPENJPEG -DHAVE_LIBZ -DHAVE_LIBTIFF -DHAVE_XCB -DPILLOW_
VERSION="8.4.0.dev0" -I/usr/local/Cellar/openjpeg/2.4.0/include/openjpeg-2.4 -I/usr/local/Cellar/jpeg/9d/include -I/usr/local/Cellar/libtiff/4.3.0/include -I/Users/dima/software/Pillow -I/usr/local/Cellar
/freetype/2.10.4/include/freetype2 -I/usr/local/Cellar/fribidi/1.0.10/include/fribidi -I/usr/local/Cellar/little-cms2/2.12/include -I/usr/local/Cellar/ntl/11.5.1/include -I/usr/local/Cellar/readline/8.1/i
nclude -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/3.9/include -I/usr/local/Cellar/freetype/2.10.4/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/D
eveloper/SDKs/MacOSX.sdk/usr/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_imaging.c -o build/temp.macosx-10.9-x86_64-3.9/src/_imaging.o
In file included from src/_imagingft.c:22:
In file included from /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or
 _Null_unspecified) [-Wnullability-completeness]
        unsigned char   *_base;
                        ^
... [many similar warning]

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, o
r _Null_unspecified) [-Wnullability-completeness]
        struct __sFILEX *_extra; /* additions to FILE to not break ABI */
In file included from src/_webp.c:2:
In file included from /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.hIn file included from src/_imagingft.c:22:
In file included from /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220::5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
                        ^
93:16: warning: #if TARGET_OS_IPHONE
    ^

... [more similar warnings and errorrs]
... 

What are your OS, Python and Pillow versions?

  • OS: macOS 11.4
  • Python: python3: 3.9.6 , python2 2.7.16
  • Pillow: current master 426b730, and also with 8.1.2
brew install llvm
export PATH=/usr/local/opt/llvm/bin:$PATH
CC=clang CXX=clang++ make install

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions