#1132300 libbenchmark1.9.1: ***WARNING*** Library was built as DEBUG. Timings may be affected.

Package:
libbenchmark1.9.1
Source:
libbenchmark1.9.1
Description:
Microbenchmark support library, shared library
Submitter:
Marius Mikucionis
Date:
2026-10-06 07:40:04 UTC
Severity:
normal
Tags:
#1132300#5
Date:
2026-03-30 10:10:00 UTC
From:
To:
Dear Maintainer,

I am getting the warning that the benchmark library was built as DEBUG,
which basically defeats the purpose of benchmarking the optimized builds
(the majority of use cases, while debugging the benchmark library is really niche).

I used the following `bm_test.cpp`:

```c++
#include <benchmark/benchmark.h>
#include <string>

static void bm_string(benchmark::State& state) {
  for (auto _ : state) {
    auto text = std::string{"Hello world!"};
    benchmark::DoNotOptimize(text);
    benchmark::ClobberMemory();
  }
}
BENCHMARK(bm_string);
BENCHMARK_MAIN();
```

Compile and run:

```shell
g++ -std=c++11 -pedantic -Wall -Wextra -O3 -DNDEBUG -o bm_test bm_test.cpp -lbenchmark
./bm_test
```

Observe the output:

```text
2026-03-30T12:02:02+02:00
Running ./bm_test
Run on (4 X 2600 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x2)
  L1 Instruction 32 KiB (x2)
  L2 Unified 256 KiB (x2)
  L3 Unified 4096 KiB (x1)
Load Average: 0.43, 0.89, 1.21
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
***WARNING*** Library was built as DEBUG. Timings may be affected.
-----------------------------------------------------
Benchmark           Time             CPU   Iterations
-----------------------------------------------------
bm_string        1.94 ns         1.94 ns    360112507
```

I do not expect to see the "Librry was built as DEBUG" warning.
I expect the library to be built with -O3 -DNDEBUG (which does not produce such warning).

Bes regards,
Marius

#1132300#10
Date:
2026-10-06 07:39:40 UTC
From:
To:
tags 1132300 + patch
thanks

Hello,

after some investigation I found that the commit from 2022 does introduce the switch from release to debug here:
https://salsa.debian.org/science-team/benchmark/-/commit/f80dc6ea135428b97df2c271ec2815a729e5ff78

This is because google benchmark defaults to debug and the commit removed the explicit `-DCMAKE_BUILD_TYPE=Release`.

The attached patch should fix the problem though I cannot completely test it because I have no means to trigger the
debian CI to run a test pipeline.
Please note that everything since 1.7.0 was affected, so everything since (and including) bookworm.

Best regards,
Georg