Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Old CMake with IntelLLVM: Unsupported command line options, multiple warnings #4315

Closed
al42and opened this issue Jul 14, 2023 · 4 comments

Comments

@al42and
Copy link

al42and commented Jul 14, 2023

Describe the issue

IntelLLVM is recognized only by CMake 3.20+: https://cmake.org/cmake/help/latest/release/3.20.html#compilers

When an older CMake is used, CMAKE_CXX_COMPILER_ID is set to Clang. This causes -Wchar-subscripts flag to be added to cxx_strict_flags, while a bunch of flags used to silence warnings are not added:

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(cxx_strict_flags "${cxx_strict_flags} -Wchar-subscripts")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise")
endif()

Steps to reproduce the problem

$ docker run --pull --rm -it docker.io/intel/oneapi:2023.1.0-devel-ubuntu20.04
<<< 4 GiB later >>>
# wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh
# bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/opt/
# git clone https://github.com/google/googletest.git && cd googletest
# /opt/bin/cmake -S . -B build/ -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
# /opt/bin/cmake --build build/
Scanning dependencies of target gtest
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
icpx: command line warning #10430: Unsupported command line options encountered
These options as listed are not supported.
For more information, use '-qnextgen-diag'.
option list: 
        -Wchar-subscripts
In file included from /googletest/googletest/src/gtest-all.cc:49:
/googletest/googletest/src/gtest.cc:1655:8: warning: explicit comparison with NaN in fast floating point mode [-Wtautological-constant-compare]
  if (!(std::isnan)(val1) && !(std::isnan)(val2) && abs_error > 0 &&
       ^~~~~~~~~~~~~~~~~~
/googletest/googletest/src/gtest.cc:1655:31: warning: explicit comparison with NaN in fast floating point mode [-Wtautological-constant-compare]
  if (!(std::isnan)(val1) && !(std::isnan)(val2) && abs_error > 0 &&
                              ^~~~~~~~~~~~~~~~~~
In file included from /googletest/googletest/src/gtest-all.cc:38:
In file included from /googletest/googletest/include/gtest/gtest.h:65:
In file included from /googletest/googletest/include/gtest/gtest-death-test.h:43:
In file included from /googletest/googletest/include/gtest/internal/gtest-death-test-internal.h:47:
In file included from /googletest/googletest/include/gtest/gtest-matchers.h:49:
/googletest/googletest/include/gtest/gtest-printers.h:512:25: warning: implicit conversion between floating point types of different sizes [-Wimplicit-float-size-conversion]
    FloatType mulfor6 = 1e10;
              ~~~~~~~   ^~~~
<<< and so on >>>

What version of GoogleTest are you using?

cc36671

What operating system and version are you using?

Ubuntu Linux 20.04

What compiler and version are you using?

Intel(R) oneAPI DPC++/C++ Compiler 2023.1.0 (2023.1.0.20230320)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm
Configuration file: /opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/../bin/icpx.cfg

What build system are you using?

cmake version 3.18.0

Additional context

The docker image used for reproducer ships with a newer CMake, but by default, Ubuntu 20.04 provides CMake 3.16.3

@derekmauro
Copy link
Member

https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md

IntelLLVM is not a supported compiler. We are open to patches from the community for this issue.

@tobbi
Copy link
Contributor

tobbi commented May 14, 2024

@derekmauro I might be missing something, but: Wouldn't adding a simple check for CMAKE_CXX_COMPILER==icpx together with a check for the current CMAKE version (as provided by CMAKE using the CMAKE_VERSION variable in

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(cxx_strict_flags "${cxx_strict_flags} -Wchar-subscripts")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
set(cxx_base_flags "${cxx_base_flags} -Wno-implicit-float-size-conversion -ffp-model=precise")
endif()
fix this issue?

EDIT: I'm on a roll when it comes to doing stuff on this project, so I'm gonna give it a try.

tobbi added a commit to tobbi/googletest that referenced this issue May 14, 2024
tobbi added a commit to tobbi/googletest that referenced this issue May 14, 2024
@tobbi
Copy link
Contributor

tobbi commented May 14, 2024

I've provided a fix for this issue in #4541. Please test this thoroughly (I've tested it using the VM provided in the initial comment.

tobbi added a commit to tobbi/googletest that referenced this issue May 14, 2024
@derekmauro
Copy link
Member

I'm closing this issue. If you want to use IntelLLVM with CMake, upgrade CMake.

@derekmauro derekmauro closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants