Build of graphviz 2.46.1 fails to find Python.h from custom build of Python 3.9.2 in nonstandard location
I have multiple custom-built packages in /usr/sup. I have a new Python build in /usr/sup/Python-3.9.2. Based on #1693 (closed), I built a new version of swig, as my existing one is quite old; it's in /usr/sup/swig-4.0.2. There is nothing in /usr/local.
Steps to reproduce
export LDFLAGS=-L/usr/sup/Python-3.9.2/lib -L/usr/sup/lib64 -L/usr/sup/lib
export CPPFLAGS=-I/usr/sup/Python-3.9.2/include -I/usr/sup/Python-3.9.2/include/python3.9 -I/usr/sup/include
export CC=/usr/sup/bin/gcc
export CXX=/usr/sup/bin/g++
export LD_LIBRARY_PATH=/usr/sup/Python-3.9.2/lib:/usr/sup/lib64:/usr/sup/lib
export PKG_CONFIG_PATH=/usr/sup/lib64/pkgconfig:/usr/sup/lib/pkgconfig
export PATH=/usr/sup/Python-3.9.2/bin:/usr/sup/swig-4.0.2/bin:/usr/sup/bin:/bin:/usr/bin:/sbin:/usr/sbin
./configure --prefix=/usr/sup/graphviz-2.46.1 --disable-php --disable-python2
make
Expected Behaviour
A successful build of graphviz.
Actual Behaviour
Configure works; make consistently fails with:
swig -c++ -python -o gv_python3.cpp ./gv.i
CXX libgv_python3_la-gv_python3.lo
gv_python3.cpp:178:11: fatal error: Python.h: No such file or directory
178 | # include <Python.h>
| ^~~~~~~~~~
compilation terminated.
OS Version
RHEL 7.9, with a lot of additional custom stuff in /usr/sup.
Graphviz Version
I am trying to build graphviz-2.46.1.
Additional info
Most of the environment variables above I added in hopes of forcing things to find /usr/sup/Python-3.9.2/include/python3.9/Python.h. Earlier in the build, other things can find it. Unfortunately, that swig command is trying for the following, and completely ignores all the variables I've set. From strace:
[pid 56167] open("./Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../lib/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../lib/gvc/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../lib/common/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../lib/cgraph/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../lib/cdt/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] open("../../lib/pathplan/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/sup/gcc-9.1.0/include/c++/9.1.0/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/sup/gcc-9.1.0/include/c++/9.1.0/x86_64-pc-linux-gnu/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/x86_64-pc-linux-gnu/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/sup/gcc-9.1.0/include/c++/9.1.0/backward/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/backward/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/include/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/include/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/local/include/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/local/include/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/sup/gcc-9.1.0/include/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/sup/gcc-9.1.0/include/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/include-fixed/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/sup/gcc-9.1.0/lib/gcc/x86_64-pc-linux-gnu/9.1.0/include-fixed/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] lstat("/usr/include/Python.h", 0x7fffc0c50b40) = -1 ENOENT (No such file or directory)
[pid 56167] open("/usr/include/Python.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 56167] write(2, "gv_python3.cpp:178:11: fatal err"..., 130gv_python3.cpp:178:11: fatal error: Python.h: No such file or directory
It never tries where I've told it to try; instead it ignores all the variables I've set and runs the default list of places.
Is there some way to configure things to tell swig to look in other places?