[llvm] [LLVM][CMake] Set LANG to "C" before linker detection. (PR #95913)
Carlo Bramini via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 08:22:39 PDT 2024
https://github.com/carlo-bramini updated https://github.com/llvm/llvm-project/pull/95913
>From 3fc65c5f17a64369127106db9a88709b0cd13916 Mon Sep 17 00:00:00 2001
From: Carlo Bramini <carlo_bramini at users.sourceforge.net>
Date: Tue, 18 Jun 2024 14:46:37 +0200
Subject: [PATCH] [LLVM][CMake] Set LANG to "C" before linker detection.
This PR fixes issue #62634
---
llvm/cmake/modules/AddLLVM.cmake | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 03f4e1f190fd9..53da043a61c1d 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -220,8 +220,14 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
separate_arguments(flags UNIX_COMMAND "${CMAKE_EXE_LINKER_FLAGS}")
set(command ${CMAKE_C_COMPILER} ${flags} ${version_flag} -o ${DEVNULL})
endif()
+
+ # The LANG environment variable controls the way that tools use
+ # localization information, which allows to work with different
+ # national conventions.
+ # For this reason, it must be forced to a known value, otherwise
+ # the linker may reply with something different than expected.
execute_process(
- COMMAND ${command}
+ COMMAND ${CMAKE_COMMAND} -E env LANG=C ${command}
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr
)
More information about the llvm-commits
mailing list