Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CentOS 8 compilation - fatal error: Imaging.h: No such file or directory #1761

Closed
BenKennish opened this issue Apr 25, 2020 · 6 comments
Closed

Comments

@BenKennish
Copy link

BenKennish commented Apr 25, 2020

I followed the instructions to compile from source on CentOS 8 (as there are no CentOS 8 RPMs available yet - see #1677 ) and I get the following...

$ sudo yum install python3-pillow python3-numpy python3-devel
(packages all install without a problem)
$ python3 setup.py build
running build
running build_py
copying overviewer_core/overviewer_version.py -> build/lib.linux-x86_64-3.6/overviewer_core
running build_ext
building 'overviewer_core.c_overviewer' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I/usr/lib64/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c overviewer_core/src/main.c -o build/temp.linux-x86_64-3.6/overviewer_core/src/main.o -Wno-unused-variable -Wno-unused-function -Wdeclaration-after-statement -Werror=declaration-after-statement
In file included from overviewer_core/src/main.c:18:
overviewer_core/src/overviewer.h:40:10: fatal error: Imaging.h: No such file or directory
 #include <Imaging.h>
          ^~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 127, in _compile
    extra_postargs)
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 273, in run
    build.run(self)
distutils.errors.CompileError: command 'gcc' failed with exit status 1

Failed to build Overviewer!
Please review the errors printed above and the build instructions
at <http://docs.overviewer.org/en/latest/building/>.  If you are
still having build problems, file an incident on the github tracker
or find us in IRC.

I did a bit of digging and it seems that Imaging.h is a PIL header file but the python3-pillow package doesn't seem to install any header files. Am I on the right track? I did a yum "whatprovides" search for Imaging.h and can't find any packages that provide it.

Thanks in advance for any advice 🙂

@Auron956
Copy link
Contributor

Try installing python3-pillow-devel also, I believe that should provide Imaging.h

@BenKennish
Copy link
Author

Doesn't appear to be available...

$ sudo yum install python3-pillow-devel
Last metadata expiration check: 0:00:23 ago on Sat 25 Apr 2020 09:23:05 AM UTC.
No match for argument: python3-pillow-devel
Error: Unable to find a match: python3-pillow-devel
[ben@new ~]$ sudo yum search pillow
Last metadata expiration check: 0:00:32 ago on Sat 25 Apr 2020 09:23:05 AM UTC.
===================================================================================== Name Matched: pillow ======================================================================================
python3-pillow.x86_64 : Python 3 image processing library
python3-pillow.x86_64 : Python 3 image processing library

@Auron956
Copy link
Contributor

Apologies, the description of the python3-pillow package suggested to me that python3-pillow-devel existed, but that doesn't appear to be the case!

Doubt this is an ideal method, however I've managed to get it building on CentOS 8.1.1911 by using the below commands to download the source of the python3-pillow package & extract into a directory, following which the specific directory containing Imaging.h can be included during compilation (assuming the present working directory is that containing setup.py):

yum install yum-utils
export tmpPillow=$(mktemp -d)
pushd $tmpPillow
yumdownloader --source python-pillow
rpm2cpio python-pillow-*.src.rpm | cpio -idmv
tar xf Pillow-*.tar.gz
popd
CPPFLAGS='-I'$(readlink -f ${tmpPillow}/Pillow-*/src/libImaging) python3 setup.py build
rm -r $tmpPillow
unset tmpPillow

@BenKennish
Copy link
Author

Sorry for taking so long to get back to you. Your instructions worked a treat, the build completed successfully and it's rendering now! 😁

@DarkArc
Copy link

DarkArc commented Aug 15, 2021

I've mentioned the absence of the devel package to RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1993690

@DarkArc
Copy link

DarkArc commented Aug 15, 2021

Interestingly enough the spec file already contains the spec for the relevant devel package. Here are some alternative instructions that will integrate with the package manger:

First setup rpm-build

sudo dnf install rpm-build redhat-rpm-config rpmdevtools
sudo useradd --no-create-home --system mockbuild
sudo groupadd mock
rpmdev-setuptree

Then build the actual packages(dist .el8_2 might need changed base this off the Release field of dnf info python3-pillow):

sudo dnf builddep python-pillow
dnf download --source python3-pillow
rpmbuild --rebuild --define 'dist .el8_2' python-pillow-*

The new packages (including the devel package) will be available at:

~/rpmbuild/RPMS/x86_64

If using auter and not actively monitoring the server, I'd strongly advise adding either PACKAGEMANAGEROPTIONS="--nobest" or PACKAGEMANAGEROPTIONS="--allowerasing".

--nobest should ensure auter can still download and apply updates even if a new version of python-pillow ships -- python pillow will just be held/back skipped.

Likewise --allowerasing will allow auter to simply remove the broken devel package and move python-pillow forward. (This is potentially a more dangerous option in the sense that it could result in auter breaking the system.

Perhaps best is simply removing the devel pacakge after building :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants