[Lldb-commits] [lldb] [LLDB][test] Fix cmd.exe detection on recent Windows versions (PR #99532)

Vladislav Dzhidzhoev via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 18 10:35:39 PDT 2024


https://github.com/dzhidzhoev created https://github.com/llvm/llvm-project/pull/99532

Since Windows 10 the case of 'windir' env variable was changed. Such error appears without that change:

```
make: \system32\cmd.exe: Command not found

Makefile.rules:628: recipe for target 'main.o' failed
```

>From 3ed6eecbb10421ada4b9e8e4355b91b21b31909b Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Thu, 18 Jul 2024 19:27:55 +0200
Subject: [PATCH] [LLDB][test] Fix cmd.exe detection on recent Windows
 versions.

Since Windows 10 the case of 'windir' env variable was changed.
Such error appears without that change:

```
make: \system32\cmd.exe: Command not found

Makefile.rules:628: recipe for target 'main.o' failed
```
---
 lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 3d562285ce9cc..4ade8c16b8e6f 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -80,8 +80,9 @@ endif
 # Also reset BUILDDIR value because "pwd" returns cygwin or msys path
 # which needs to be converted to windows path.
 #----------------------------------------------------------------------
-ifeq "$(OS)" "Windows_NT"
-	SHELL = $(WINDIR)\system32\cmd.exe
+ifeq "$(HOST_OS)" "Windows_NT"
+	# Windows 10 and later has the lower-case 'windir' env variable.
+	SHELL := $(or $(windir),$(WINDIR),C:\WINDOWS)\system32\cmd.exe
 	BUILDDIR := $(shell echo %cd%)
 endif
 



More information about the lldb-commits mailing list