installation of `Pillow` fails in EESSI (2023.06)

EESSI Version (required): 2023.06

Machine architecture (required): all CPU targets (x86_64/* and aarch64/*)

Operating system (required): (doesn't matter)

Software affected (optional): Pillow

Description of problem (required):

The installation of Pillow as required dependency for matplotlib fails in EESSI 2023.06 with EasyBuild v4.8.1.

The problem is that the setup.py script of Pillow tries to find zlib.h, and considers "standard locations" like /usr/include by default.

Without using the --disable-platform-guessing option (which was added in easyconfigs PR #18881), the installation of Pillow fails because /usr/include/stdio.h is picked up from the host, which leads to errors like:

/usr/include/stdio.h:781:10: fatal error: bits/sys_errlist.h: No such file or directory

When --disable-platform-guessing is used (by using --from-pr 18881)), Pillow's setup.py complains about not being able to find zlib.h:

The headers or library files could not be found for zlib