← All tasks
cppgoogle/benchmark #1597Not a task: not reproduced

[BUG] cxx03_test Fails Due to C++ Version

envgap__google__benchmark-1597

01 / FAILURE SIGNATURE

As reported upstream

../test/cxx03_test.cc:8:2: error: C++11 or greater detected. Should be C++03.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
344117638c8ff7e239044fd0fa7085839fc03021
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

google/benchmark #1597 · read the original issue
**Describe the bug**

A clean build of the google benchmark library as described [here](https://github.com/google/benchmark#installation) fails with an error after the last command: "C++11 or greater detected. Should be C++03."



**System**

Which OS, compiler, and compiler version are you using:

  - OS: Windows 10

  - Compiler and version:

  ```$ clang++ --version

clang version 13.0.1

Target: x86_64-pc-windows-msvc

Thread model: posix

InstalledDir: C:\Program Files\LLVM\bin

```

 - CMake Version: 3.20.1

 - Ninja Version: 1.10.2



**To reproduce**

Steps to reproduce the behavior:

1. Checkout the repo to 318dd44

2. `cmake -E make_directory "build"`

3. `cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -GNinja -DCMAKE_BUILD_TYPE=Release ../`

4. `cmake --build "build" --config Release`

5. Uh-oh!

```

FAILED: test/CMakeFiles/cxx03_test.dir/cxx03_test.cc.obj

C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DBENCHMARK_STATIC_DEFINE -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -DHAVE_THREAD_SAFETY_ATTRIBUTES -DTEST_BENCHMARK_LIBRARY_HAS_NO_ASSERTIONS -I../include -Wall  -Wextra  -Wshadow  -Wfloat-equal  -Werror  -pedantic  -pedantic-errors  -Wshorten-64-to-32  -fstrict-aliasing  -Wno-deprecated-declarations  -Wno-deprecated  -Wstrict-aliasing  -Wthread-safety -O3  -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -fvisibility-inlines-hidden   -UNDEBUG -w -std=c++14 -MD -MT test/CMakeFiles/cxx03_test.dir/cxx03_test.cc.obj -MF test\CMakeFiles\cxx03_test.dir\cxx03_test.cc.obj.d -o test/CMakeFiles/cxx03_test.dir/cxx03_test.cc.obj -c ../test/cxx03_test.cc

../test/cxx03_test.cc:8:2: error: C++11 or greater detected. Should be C++03.

#error C++11 or greater detected. Should be C++03.

 ^

../test/cxx03_test.cc:12:2: error: C++11 or greater detected by the library. BENCHMARK_HAS_CXX11 is defined.

#error C++11 or greater detected by the library. BENCHMARK_HAS_CXX11 is defined.

 ^

2 errors generated.

```



**Expected behavior**

The library to build successfully and to be able to link against it.



**Additional context**

I noticed there were some other (closed) tickets with the same issue that didn't have satisfying resolutions for my situation, but they seemed to be using more unconventional compilers than me.

The Google benchmark library I _do_ have compiled from a couple years ago (835951a) complains about being built in debug mode when you run it, surely this would happen to anyone building the benchmark library how it's intended to be built and then linking their debug-mode code against it?  Maybe that's a bad idea to begin with on my part, not sure.

I also noticed that `-std=c++14` ends up in the command line that causes the error, I assume that's the cause but I didn't do anything to make it do that, this is just in its own folder.



Thanks 😄 
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]