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

Build googletest with IntelLLVM compilers #4255

Closed
niranjan-nilakantan opened this issue May 24, 2023 · 0 comments
Closed

Build googletest with IntelLLVM compilers #4255

niranjan-nilakantan opened this issue May 24, 2023 · 0 comments
Assignees

Comments

@niranjan-nilakantan
Copy link
Contributor

Describe the issue

IntelLLVM (icx/icpx) is a clang-like compiler.

It has a few differences from the normal clang compiler,
and this requires passing in additional flags during build.

e.g. for floating point handling

explicit comparison with NaN in fast floating point mode [-Wtautological-constant-compare]

Steps to reproduce the problem

Install the oneapi-basekit,
https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2023-1/apt.html#GUID-497ED29B-51A5-4402-AEA1-EA9E86DD3226

and run this.

mkdir build

cd build

cmake -DCMAKE_CXX_COMPILER=icpx -DCMAKE_C_COMPILER=icx \
    -G "Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="Release;RelWithDebInfo;Debug" \
    -Dgtest_build_tests=ON -Dgmock_build_tests=ON \
    ..

cmake --build . --config=Release

What version of GoogleTest are you using?

git rev-parse HEAD

cb455a71fb23303e37ce8ee5b1cde6a2c18f66a5

What operating system and version are you using?

$ lsb_release -a

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 23.04
Release:	23.04
Codename:	lunar

What compiler and version are you using?

$ icpx -v

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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64

What build system are you using?

$ cmake --version
cmake version 3.25.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Additional context

No response

@dinord dinord self-assigned this May 30, 2023
kunitoki pushed a commit to kunitoki/googletest that referenced this issue Nov 4, 2023
Use the same flags as Clang if the compiler id is IntelLLVM.

IntelLLVM warns if a double constant is assigned to a float.

```
[build] .../googletest/googletest/include/gtest/gtest-printers.h:516:17: warning: implicit conversion between floating point types of different sizes [-Wimplicit-float-size-conversion]
[build]       mulfor6 = 1e1;
```

IntelLLVM uses fp-model=fast by default, breaking IsNan and IsInf tests.
Use -ffp-model=precise to fix this.

IntelLLVM does not support -Wchar-subscripts

Fixes google#4255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants