This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Refactor finding python
ClosedPublic

Authored by marbre on Nov 10 2020, 11:47 AM.

Details

Summary

This drops the use of deprecated CMake modules to find python.

Diff Detail

Event Timeline

marbre created this revision.Nov 10 2020, 11:47 AM
marbre requested review of this revision.Nov 10 2020, 11:47 AM

LLVM already relies on find_package(Python3). Prior to the patch different Python versions are found on a system with multiple versions installed (here 3.9 and 3.7):

-- Found Python3: /usr/bin/python3.9 (found version "3.9.0") found components: Interpreter 
-- Constructing LLVMBuild project information
-- Linker detection: LLD
-- Found Git: /usr/bin/git (found version "2.26.2") 
-- Targeting X86
-- Performing Test C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION
-- Performing Test C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION - Success
-- Found PythonInterp: /usr/bin/python (found version "3.7.9") 
-- Found PythonLibs: /usr/lib64/libpython3.7m.so (found version "3.7.9") 
-- Found python include dirs: /usr/include/python3.7m
-- Found python libraries: /usr/lib64/libpython3.7m.so
-- Found PythonLibs: /usr/lib64/libpython3.7m.so
-- Found pybind11 v2.5.0: /usr/include;/usr/include;/usr/include/python3.7m
-- Python prefix = '', suffix = '', extension = '.cpython-37m-x86_64-linux-gnu.so

This is fixed with the proposed patch:

-- Found Python3: /usr/bin/python3.9 (found version "3.9.0") found components: Interpreter 
-- Constructing LLVMBuild project information
-- Linker detection: LLD
-- Found Git: /usr/bin/git (found version "2.26.2") 
-- Targeting X86
-- Performing Test C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION
-- Performing Test C_SUPPORTS_WERROR_IMPLICIT_FUNCTION_DECLARATION - Success
-- Found Python3: /usr/bin/python3.9 (found version "3.9.0") found components: Interpreter Development 
-- Found python include dirs: /usr/include/python3.9
-- Found python libraries: /usr/lib64/libpython3.9.so
-- Found PythonInterp: /usr/bin/python3.9 (found version "3.9") 
-- Found PythonLibs: /usr/lib64/libpython3.9.so
-- Found pybind11 v2.5.0: /usr/include;/usr/include;/usr/include/python3.9
-- Python prefix = '', suffix = '', extension = '.cpython-39-x86_64-linux-gnu.so
stellaraccident accepted this revision.Nov 10 2020, 12:07 PM
This revision is now accepted and ready to land.Nov 10 2020, 12:07 PM
This revision was landed with ongoing or failed builds.Nov 10 2020, 12:22 PM
This revision was automatically updated to reflect the committed changes.