The LLVM community decided to require Python in version 3.8 for the project and thus moved the requirement up from the previously required 3.6. However, Python 3.6 has been around for quite some time and is still the default for distributions which choose stability over newness. Two of those distributions are Red Hat Enterprise Linux (RHEL) 8 and SUSE Linux Enterprise Server (SLES) 15.
As a result the current upstream can no longer be built on such systems without installing “non-default” versions of Python. While somewhat trivial, it may be more noticeable in the case where one wants to distribute packages for the system. These would now introduce a new dependency and that is not always appreciated or wanted.
I spent some time to look at the issue, since our case requires to build the most recent LLVM while also being compatible with a default installation of both RHEL 8 and SLES 15. I looked at different options and finally arrived at the following — which appears to solve both issues. In particular, our build configuration includes the OpenMP runtime, which ships with a GDB plugin that is built and linked against the Python library. So, simply exporting everything Python 3.8 from a non-default installation will have the GDB plugin link against a non-default Python, and thus break compatibility.
Current Solution
In my current solution, I install a Python 3.8 from source into a path in /opt/python-38-install
(though the particular path should not matter too much) and then use a variable from the CMake find Python script to point CMake to the 3.8 interpreter. This is done via the additional -DPython3_EXECUTABLE=/opt/python-38-install/bin/python
added to the usual CMake configure line. The build process (and the test process) picks up the right Python interpreter, but just as important, the GDB plugin built for OMPD support still links against the system-installed libpython-3.6.so
and thus maintaining compatibility.
No responses yet