Package: libbenchmark-dev
Version: 1.6.0-1
Severity: serious
Tag: patch

Dear maintainer,

the latest version of libbenchmark-dev has a regression that breaks the
libbenchmark_main.a static library for users who do not use
link-time-optimzation. This is very similar to bug #968461:
https://bugs.debian.org/968461

Relevant excerpt from a build log:

 /usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libbenchmark_main.a(benchmark_main.cc.o): plugin 
needed to handle lto object
 /usr/bin/ld: 
/usr/lib/x86_64-linux-gnu/libbenchmark_main.a(benchmark_main.cc.o): plugin 
needed to handle lto object
 /usr/bin/ld: 
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o: in 
function `_start':
 (.text+0x20): undefined reference to `main'

The static library has no actual object code in it, only the
intermediate code used for link-time optimization. You need to
replace the -flto flag with -ffat-lto-objects to ensure that both
the intermediate code AND the actual object code will be emitted:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6b2b81..8effea8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -215,7 +215,7 @@ else()
# Link time optimisation
   if (BENCHMARK_ENABLE_LTO)
-    add_cxx_compiler_flag(-flto)
+    add_cxx_compiler_flag(-ffat-lto-objects)
     add_cxx_compiler_flag(-Wno-lto-type-mismatch)
     if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
       find_program(GCC_AR gcc-ar)


Cheers
Timo

--
⢀⣴⠾⠻⢶⣦⠀   ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling                                       │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀   ╰────────────────────────────────────────────────────╯

Attachment: signature.asc
Description: PGP signature

Reply via email to