[Lldb-commits] [PATCH] D101903: [LLDB] Don't use the local python to set a default for LLDB_PYTHON_RELATIVE_PATH when cross compiling.

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 5 05:48:03 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: JDevlieghere.
Herald added a subscriber: mgorny.
mstorsjo requested review of this revision.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101903

Files:
  lldb/CMakeLists.txt


Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -31,15 +31,23 @@
 endif()
 
 if (LLDB_ENABLE_PYTHON)
-  execute_process(
-    COMMAND ${Python3_EXECUTABLE}
-        -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
-    OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  if (NOT CMAKE_CROSSCOMPILING)
+    execute_process(
+      COMMAND ${Python3_EXECUTABLE}
+          -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
+      OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+    file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH)
+  endif ()
 
-  file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH)
   set(LLDB_PYTHON_RELATIVE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH}
     CACHE STRING "Path where Python modules are installed, relative to install prefix")
+  if ("${LLDB_PYTHON_RELATIVE_PATH}" STREQUAL "")
+    message(FATAL_ERROR
+      "Crosscompiling with python requires manually setting
+      LLDB_PYTHON_RELATIVE_PATH.")
+  endif ()
 endif ()
 
 if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101903.343017.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210505/c9c4d60a/attachment.bin>


More information about the lldb-commits mailing list