The hardcoded python CFLAGS and CLIBS are not working on Archlinux where default python is python3.
Changed to use PKG_CHECK_MODULES to detect CFLAGS and LDFLAGS of python.
Signed-off-by: Gris Ge cnfourt@gmail.com
Tried on python3, it fails. Hence updated the configure.ac to use python2 only.
This will affect Fedora soon since Fedora is changing /usr/bin/python pointing to python3.
/usr/bin/python
https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
Thanks for the patch.
Is it really necessary to use both AM_PATH_PYTHON and PKG_CHECK_MODULES here? It seems risky to look up the same software package with two completely independent mechanisms and to hope that they will both find exactly the same version.
AM_PATH_PYTHON
PKG_CHECK_MODULES
Gentoo has proposed a similar patch for Python3, where the include/library paths are indeed different (3.5m vs. 3.5), but volume_key currently doesn’t support Python 3 at all, so that difference is moot. Do the hard-coded paths for Python 2 not match on ArchLinux?
3.5m
3.5
volume_key
Yes. both are needed: AM_PATH_PYTHON and AC_PATH_PROGS are setting the PYTHON variable(and others) where swig will use. PKG_CHECK_MODULES is checking the existence of C header(python2-devel) for compiling python C extension.
AC_PATH_PROGS
python2-devel
The root cause of failure on Archlinux is not caused by hard-coded path, but caused by swig are using python3 folder since /usr/bin/python is pointing to python3 and PYTHON variable is empty.
PYTHON
Isn’t the AC_PATH_PROGS(PYTHON, …)+AM_PATH_PYTHON pair sufficient for AM_PATH_PYTHON to use Python 2, and the Python 2 include directories?
AC_PATH_PROGS(PYTHON, …)
Yes. They do.
The PKG_CHECK_MODULES is for checking C headers of python -- python2-devel rpm package.
BTW. The use of PKG_CHECK_MODULES is to eliminate the hard-coded CFLAGS and LDFLAGS for python C extention.
@mitr Any thing I could do to get this merged?
Just encountered this issue when packaging for NixOS. This patch looks great.
@mitr Why not consider making volume_key support Python 3?
@cathay4t This doesn't apply cleanly anymore to master. Can you rebase?
rebased onto 8eda66d3b734ea335e37cf9d7d173b9e8ebe2fd9
@flokli rebased.
Gentoo has proposed a similar patch for Python3, where the include/library paths are indeed different (3.5m vs. 3.5), but volume_key currently doesn’t support Python 3 at all, so that difference is moot.
This becomes issue also on Fedora (i.e. the path to Python 3 C headers is /usr/include/python3.6m instead of /usr/include/python3.6) and it can be resolved by python3-config, so PKG_CHECK_MODULES is not necessary.
/usr/include/python3.6m
/usr/include/python3.6
python3-config
volume_key now supports Python 3 only. I tried build it on Archlinux and it compiles smoothly. Can this pull request be closed?
Great. Closing.
Pull-Request has been closed by cathay4t
The hardcoded python CFLAGS and CLIBS are not working on Archlinux where
default python is python3.
Changed to use PKG_CHECK_MODULES to detect CFLAGS and LDFLAGS of python.
Signed-off-by: Gris Ge cnfourt@gmail.com