[libc-commits] [libc] cc04ed6 - [libc] Stop passing `--version` to compiler when detecting target (#176680)
via libc-commits
libc-commits at lists.llvm.org
Thu Apr 30 08:23:02 PDT 2026
Author: Nico Weber
Date: 2026-04-30T11:22:56-04:00
New Revision: cc04ed68b5199539f7b8f4e2733222afeed0ea37
URL: https://github.com/llvm/llvm-project/commit/cc04ed68b5199539f7b8f4e2733222afeed0ea37
DIFF: https://github.com/llvm/llvm-project/commit/cc04ed68b5199539f7b8f4e2733222afeed0ea37.diff
LOG: [libc] Stop passing `--version` to compiler when detecting target (#176680)
This reverts c267501c155f9, and also adds a `-c` flag.
Both gcc and clang print the `Target:` line that we're trying to find
just find with just `-v`.
When passing `--version`, gcc passes `--version` to the system linker,
and when using gcc on macOS, the system linker does not understand
`--version`. Since `--version` does not seem to be necessary, drop it.
Also, passing `-c` lets gcc not print linker details, so add that too,
as a belt-and-suspenders fix.
---
Makes `cmake` succeed for me on my mac with
`/Applications/CMake.app/Contents/bin/cmake ../llvm-project/llvm -G
Ninja -DLLVM_ENABLE_PROJECTS="libc" -DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12` (with gcc-12 from
homebrew).
Added:
Modified:
libc/cmake/modules/LLVMLibCArchitectures.cmake
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 921057706c5e9..8ada45dd07cec 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -78,7 +78,7 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
set(${sys_var} ${target_sys} PARENT_SCOPE)
endfunction(get_arch_and_system_from_triple)
-execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version -v
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
RESULT_VARIABLE libc_compiler_info_result
OUTPUT_VARIABLE libc_compiler_info
ERROR_VARIABLE libc_compiler_info)
More information about the libc-commits
mailing list