Skip to content

Commit 4e4a3fd

Browse files
committed
Define Python_FIND_VIRTUALENV in addition to Python3_FIND_VIRTUALENV
MLIR searches for both Python3 and Python. If both variables are not defined equally and there multiple python version on the system, CMake may behave really weirdly. More details here: llvm/llvm-project#126162
1 parent 6da8588 commit 4e4a3fd

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

build_tools/e2eshark_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ cmake -S "$repo_root/externals/llvm-project/llvm" -B "$build_dir" \
2121
-GNinja \
2222
-DCMAKE_BUILD_TYPE=Release \
2323
-DPython3_FIND_VIRTUALENV=ONLY \
24+
-DPython_FIND_VIRTUALENV=ONLY \
2425
-DLLVM_ENABLE_PROJECTS=mlir \
2526
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
2627
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \

build_tools/python_deploy/build_windows_ci.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ cmake -GNinja -Bbuild \
3333
-DLLVM_TARGETS_TO_BUILD=host \
3434
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
3535
-DPython3_FIND_VIRTUALENV=ONLY \
36+
-DPython_FIND_VIRTUALENV=ONLY \
3637
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
3738
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \
3839
-DPython3_EXECUTABLE="$(which python)" \

docs/development.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ sudo apt install clang ccache lld
105105
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
106106
-DLLVM_ENABLE_ASSERTIONS=ON \
107107
-DPython3_FIND_VIRTUALENV=ONLY \
108+
-DPython_FIND_VIRTUALENV=ONLY \
108109
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
109110
-DLLVM_TARGETS_TO_BUILD=host \
110111
`# For building LLVM "in-tree"` \
@@ -123,6 +124,7 @@ sudo apt install clang ccache lld
123124
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
124125
-DLLVM_ENABLE_ASSERTIONS=ON \
125126
-DPython3_FIND_VIRTUALENV=ONLY \
127+
-DPython_FIND_VIRTUALENV=ONLY \
126128
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
127129
-DLLVM_TARGETS_TO_BUILD=host \
128130
`# For building LLVM "out-of-tree"` \

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def cmake_build(self, cmake_build_dir):
113113
f"-DCMAKE_BUILD_TYPE={CMAKE_BUILD_TYPE}",
114114
f"-DPython3_EXECUTABLE={sys.executable}",
115115
f"-DPython3_FIND_VIRTUALENV=ONLY",
116+
f"-DPython_EXECUTABLE={sys.executable}",
117+
f"-DPython_FIND_VIRTUALENV=ONLY",
116118
f"-DMLIR_ENABLE_BINDINGS_PYTHON=ON",
117119
f"-DLLVM_TARGETS_TO_BUILD=host",
118120
f"-DLLVM_ENABLE_ZSTD=OFF",

0 commit comments

Comments
 (0)