pillow-7.2.0 build issue with homebrew libzip

26 views
Skip to first unread message

Zachary Scherr

unread,
Dec 15, 2020, 3:26:26 PM12/15/20
to sage-devel
I just tried building 9.3.beta4 and my build breaks at pillow-7.2.0 on Catalina 10.15.7.

The actual error is:

[pillow-7.2.0]   gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -O2 -g -g -DHAVE_OPENJPEG -DHAVE_LIBZ -DHAVE_LIBTIFF -DHAVE_XCB -DPILLOW_VERSION="7.2.0" -I/usr/local/Cellar/openjpeg/2.3.1/include/openjpeg-2.3 -I/Users/zscherr/sage/develop/local/var/tmp/sage/build/pillow-7.2.0/src/src/libImaging -I/usr/local/Cellar/jpeg/9d/include -I/usr/local/Cellar/libtiff/4.1.0_1/include -I/Users/zscherr/sage/develop/local/var/tmp/sage/build/pillow-7.2.0/src -I/usr/local/Cellar/freetype/2.10.4/include/freetype2 -I/usr/local/Cellar/little-cms2/2.11/include -I/Users/zscherr/sage/develop/local/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/include -I/usr/local/Cellar/freetype/2.10.4/include -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/Users/zscherr/sage/develop/local/include -I/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/decode.c -o build/temp.macosx-10.15-x86_64-3.9/src/decode.o
  [pillow-7.2.0]   src/decode.c:810:10: warning: non-portable path to file '"zip.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
  [pillow-7.2.0]   #include "Zip.h"
  [pillow-7.2.0]            ^~~~~~~
  [pillow-7.2.0]            "zip.h"
  [pillow-7.2.0]   src/decode.c:824:43: error: use of undeclared identifier 'ZIPSTATE'
  [pillow-7.2.0]       decoder = PyImaging_DecoderNew(sizeof(ZIPSTATE));
  [pillow-7.2.0]                                             ^
  [pillow-7.2.0]   src/decode.c:836:16: error: expected expression
  [pillow-7.2.0]       ((ZIPSTATE*)decoder->state.context)->interlaced = interlaced;
  [pillow-7.2.0]                  ^
  [pillow-7.2.0]   src/decode.c:836:7: error: use of undeclared identifier 'ZIPSTATE'
  [pillow-7.2.0]       ((ZIPSTATE*)decoder->state.context)->interlaced = interlaced;
  [pillow-7.2.0]         ^
  [pillow-7.2.0]   1 warning and 3 errors generated.
  [pillow-7.2.0]   gcc -bundle -undefined dynamic_lookup -L/usr/local/lib -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -L/Users/zscherr/sage/develop/local/lib -Wl,-rpath,/Users/zscherr/sage/develop/local/lib -O2 -g -g build/temp.macosx-10.15-x86_64-3.9/src/_imagingmath.o -L/usr/local/Cellar/jpeg/9d/lib -L/usr/local/Cellar/openjpeg/2.3.1/lib -L/usr/local/Cellar/libtiff/4.1.0_1/lib -L/Users/zscherr/sage/develop/local/var/tmp/sage/build/pillow-7.2.0/src -L/usr/local/Cellar/freetype/2.10.4/lib -L/usr/local/Cellar/little-cms2/2.11/lib -L/Users/zscherr/sage/develop/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.15-x86_64-3.9/PIL/_imagingmath.cpython-39-darwin.so
  [pillow-7.2.0]   error: command '/usr/bin/gcc' failed with exit code 1

------------------------------------------------

From what I can tell, I have libzip installed with homebrew, which puts a zip.h symlink in my /usr/local/include directory.  It would appear that the pillow makefile is picking up this zip.h as opposed to the Zip.h that comes with pillow.

I can fix this problem via

brew unlink libzip
make pillow
brew link libzip

so I'm guessing it probably requires an easy modification to the pillow makefile.

Matthias Koeppe

unread,
Dec 15, 2020, 8:30:45 PM12/15/20
to sage-devel
We had the same problem previously - https://trac.sagemath.org/ticket/29562
Have you set CPPFLAGS by any chance?

Zachary Scherr

unread,
Dec 15, 2020, 11:51:36 PM12/15/20
to sage-devel
I have not.  I just sourced .homebrew-build-env and then built in the normal way.  I haven't had this problem in the past, but I'm not sure when homebrew installed libzip on my laptop (I see it is a dependency of php).

I can see in the failing gcc command that -I/usr/local/include comes before -I/Users/zscherr/temp/sage/local/var/tmp/sage/build/pillow-7.2.0/src/src/libImaging so that could be why it finds zip.h before Zip.h

I took a look at the most recent version of Pillow and it seems like they solved the issue by renaming Zip.h to ZipCodecs.h.

Dima Pasechnik

unread,
Dec 16, 2020, 3:19:08 AM12/16/20
to sage-devel
On Wed, Dec 16, 2020 at 4:51 AM Zachary Scherr <zsc...@gmail.com> wrote:
>
> I have not. I just sourced .homebrew-build-env and then built in the normal way. I haven't had this problem in the past, but I'm not sure when homebrew installed libzip on my laptop (I see it is a dependency of php).
>
> I can see in the failing gcc command that -I/usr/local/include comes before -I/Users/zscherr/temp/sage/local/var/tmp/sage/build/pillow-7.2.0/src/src/libImaging so that could be why it finds zip.h before Zip.h
>
> I took a look at the most recent version of Pillow and it seems like they solved the issue by renaming Zip.h to ZipCodecs.h.

Indeed, in the current Pillow version [Zz]ip.h is no more.
How about updating?
A ticket is already there: https://trac.sagemath.org/ticket/30971
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/4e95ba68-cfb3-47f6-b40c-b90ed0c5325cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages