This is an archive of the discontinued LLVM Phabricator instance.

honor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake
ClosedPublic

Authored by robertu94 on Nov 16 2020, 5:45 AM.

Details

Summary

CMake's find_package(Python3) and find_package(Python2) packages have a PYTHON_EXECUTABLE, Python2_EXECUTABLE, and Python3_EXECUTABLE cmake variables which control which version of python is built against. As far as I can tell, the rest of LLVM honors these variables. This can cause the build process to fail when if the automatically selected version of Python can't run due to modifications of LD_LIBRARY_PATH when using spack. The corresponding Spack issue is https://github.com/spack/spack/issues/19908. The corresponding LLVM issue is 48180

I believe an appropriate fix is to add the variables to the list of PASSTHROUGH_VARIABLES in cmake/Modules/AddCompilerRT.cmake, and this fixed compilation errors for me.

This bug affects distributions like Gentoo and package managers like Spack which allow for combinatorial versioning.

Diff Detail

Event Timeline

robertu94 created this revision.Nov 16 2020, 5:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2020, 5:45 AM
Herald added subscribers: Restricted Project, mgorny. · View Herald Transcript
robertu94 requested review of this revision.Nov 16 2020, 5:45 AM
Meinersbur accepted this revision.Nov 17 2020, 2:57 PM

There might be other cmake configuration parameters used for introspection, such as ZLIB_INCLUDE_DIR (if using zlib), <PackageName>_ROOT etc.

In this case, it seems clear to me that the path to python should be passed to the inner build configuration. LGTM.

If you need someone to commit this, please say so.

This revision is now accepted and ready to land.Nov 17 2020, 2:57 PM

I don't have commit privileges.

Thank you for you the fix!