[clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 14:59:42 PDT 2024


MaskRay wrote:

> Hi @Endilll
> 
> I did a git bisect that pointed to this change as the one blocking my compilation on an Ubuntu docker image with clang 14.0
> 
> The error I see:
> 
> ```
> CMake Error at /test_radsan/llvm-project/compiler-rt/cmake/Modules/CheckSectionExists.cmake:72 (message):
>   cc: error: unrecognized command-line option
>   '-Wcovered-switch-default'; did you mean
>   '-Wno-switch-default'?
> 
>   cc: error: unrecognized command-line option
>   '-Wstring-conversion'; did you mean
>   '-Wsign-conversion'?
> 
> Call Stack (most recent call first):
>   /test_radsan/llvm-project/compiler-rt/lib/builtins/CMakeLists.txt:923 (check_section_exists)
> ```
> 
> My compiler info, printed from CMake:
> 
> ```
>   CMAKE_CXX_COMPILER_VERSION: 14.0.0
>   CMAKE_CXX_COMPILER_ID: Clang
> ```
> 
> More info from the command line:
> 
> ```
> $ clang --version
> Ubuntu clang version 14.0.0-1ubuntu1.1
> Target: aarch64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
> $ uname -a
> Linux 18728bf50582 6.5.11-linuxkit #1 SMP PREEMPT Mon Dec  4 11:30:00 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
> $ cmake --version
> cmake version 3.22.1
> ```
> 
> Let me know what other information may be helpful, or if this is user error. It seems from your godbolt links above, clang 5.0 and higher should work, so I'm surprised that 14.0 is dying in this environment

`unrecognized command-line option` is from GCC. Your build environment might conflate GCC with Clang (`CMAKE_CXX_COMPILER_ID: Clang`).
```
% gcc -Wxxxxxxxxxxxxx -c a.c
gcc: error: unrecognized command-line option ‘-Wxxxxxxxxxxxxx’
% clang -Wxxxxxxxxxxxxx -c a.c
warning: unknown warning option '-Wxxxxxxxxxxxxx' [-Wunknown-warning-option]
1 warning generated.
```

https://github.com/llvm/llvm-project/pull/92953


More information about the cfe-commits mailing list