From bd140e01f775ac082ed1787706aec90b89183efd Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 4 Jun 2021 08:35:49 -0700 Subject: [PATCH] fix Python.h discovery on Ubuntu 18.04 in CI MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The Autotools build system looks for the C header Python.h to determine the include path for the local Python installation. However, on Ubuntu 18.04 it was not finding it. The reason is that the libpython3-dev package on Ubuntu 18.04 installs Python 3.6 under a “python3.6m” prefix that it does not add to C/C++ include paths. This seems to be a deliberate choice in the structure of this package for Ubuntu 18.04, to avoid conflicts with default Python 2. A reasonable question to ask is then why Python 3 detection succeeds on the CI Ubuntu 18.04 jobs. The answer is that libpython2-dev is installed. That is, the Python 3 detection finds the Python.h from the libpython2-dev installation and incorrectly assumes it has found the Python 3 header. This confusion may play a role in #227 and #1042. This coincidental alignment of headers is exposed when libpython2-dev is removed and Python 3 detection starts failing. This commit pre-empts this failure in upcoming changes that remove Python 2 support by explicitly making the Python 3 Python.h findable. Related to #1992. --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a688fc783..32b56f580 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,10 @@ portable-source: tags: - linux image: "$CI_REGISTRY_IMAGE/ubuntu-18.04:$CI_COMMIT_SHA" + before_script: + # Make Python.h findable + - export C_INCLUDE_PATH="/usr/include/python3.6m" + - export CPLUS_INCLUDE_PATH="/usr/include/python3.6m" script: - ./autogen.sh - ./configure --enable-man-pdfs @@ -285,6 +289,10 @@ ubuntu18-04-build: artifacts: false - job: portable-source artifacts: true + before_script: + # Make Python.h findable + - export C_INCLUDE_PATH="/usr/include/python3.6m" + - export CPLUS_INCLUDE_PATH="/usr/include/python3.6m" tags: - linux variables: -- 2.40.0