Community Packages

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#57492 - [python-pillow] Pillow headers should not be (indiscriminately) installed to /usr/include/python3.6m

Attached to Project: Community Packages
Opened by Antony Lee (anntzer) - Tuesday, 13 February 2018, 17:49 GMT
Last edited by Antonio Rojas (arojas) - Monday, 04 April 2022, 09:24 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Kyle Keen (keenerd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



Currently, the Arch package for python-pillow copies the headers in src/libImaging to /usr/include/python3.6m. In particular, this means it installs raqm.h there (vendored by Pillow), even though /usr/include/raqm.h is also provided by the raqm package (also packaged in Arch as libraqm).

When building my own Python C++ extension module that links to raqm but is totally unrelated to Pillow (, the standard approach of setuptools is to put /usr/include/python3.6m relatively early in the include search path. Thus, this means that it'll pick up the raqm.h shipped by python-pillow and patched by the Pillow team, rather than the upstream one shipped by libraqm.

But that patched-by-Pillow version of raqm.h is actually unsuitable; in particular it contains lines such as

#ifndef bool
typedef int bool;
#ifndef uint32_t
typedef UINT32 uint32_t;

which expands to typedefs which are invalid ("types" are not #ifdef'd so the typedefs are included, redefining "bool" to "int" is invalid in C++, and UINT32 is a Windows-only thing). Basically, the header shipped by python-pillow shadows the one shipped by libraqm but is invalid.

While this may be considered an upstream issue ("they should fix their headers"), I don't think it is one because these headers were probably not intended for third-party use to start with, but only so that they can themselves build Pillow binaries. Even if you consider that these binaries should be packaged by Arch, I would suggest either
- moving them to a subdirectory, e.g. /usr/include/python3.6m/pillow (similarly to how python-numpy does), or
- at least don't include raqm.h there.

Additional info:
* python-pillow 5.0.0

Steps to reproduce:
$ sudo pacman -S libraqm python-pillow
$ sudo pacman -S python-{cairo,matplotlib} # mplcairo dependencies
$ git clone
$ cd mplcairo && MPLCAIRO_USE_LIBRAQM=1 python build
This task depends upon

Closed by  Antonio Rojas (arojas)
Monday, 04 April 2022, 09:24 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-pillow 8.2.0
Comment by Antony Lee (anntzer) - Friday, 20 April 2018, 21:39 GMT
Kindly requesting for a fix, as this bug makes it overly difficult to build extensions depending on raqm. The following patch should suffice:

diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 5b01d84..62dc113 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -56,9 +56,6 @@ package_python-pillow() {
cd "$srcdir/$_appname-$pkgver"
python3 install --root="$pkgdir/" --optimize=1
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
- install -dm755 "$pkgdir/usr/include/python$_py3basever/"
- install -m644 -t "$pkgdir/usr/include/python$_py3basever/" src/libImaging/*.h

package_python2-pillow() {
@@ -73,7 +70,4 @@ package_python2-pillow() {
cd "$srcdir/${_appname}-$pkgver"
python2 install --root="$pkgdir/" --optimize=1
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
- install -dm755 "$pkgdir/usr/include/python$_py2basever/"
- install -m644 -t "$pkgdir/usr/include/python$_py2basever/" src/libImaging/*.h
Comment by Kyle Keen (keenerd) - Sunday, 22 April 2018, 03:07 GMT
Apologies for the delay, this is not a simple bug to fix correctly. Those headers were added to allow other packages to compile. See  FS#37293  for the example that caused it to be added.
Comment by Antony Lee (anntzer) - Sunday, 22 April 2018, 03:32 GMT
Fair enough (I'd argue that's a packaging issue with minecraft-overviewer-git, but that'll get us nowhere). Can you at least `rm $pkgdir/usr/include/python$_pyXbasever/raqm.h` then, as it is *clearly* a broken header that's shadowing a correct system header?
Comment by Antony Lee (anntzer) - Friday, 20 July 2018, 09:49 GMT
Kindly bumping.