Debian Bug report logs - #1015370
cmocka: ftbfs with LTO (link time optimization) enabled

version graph

Package: binutils; Maintainer for binutils is Matthias Klose <[email protected]>; Source for binutils is src:binutils (PTS, buildd, popcon).

Affects: cmocka

Reported by: Matthias Klose <[email protected]>

Date: Tue, 19 Jul 2022 16:54:58 UTC

Severity: minor

Tags: experimental, sid, trixie

Found in version binutils/2.41.50.20231206-1

Forwarded to https://sourceware.org/bugzilla/show_bug.cgi?id=24415

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to David Prévot <[email protected]>:
Bug#1015370; Package src:cmocka. (Tue, 19 Jul 2022 16:54:59 GMT) (full text, mbox, link).


Acknowledgement sent to Matthias Klose <[email protected]>:
New Bug report received and forwarded. Copy sent to David Prévot <[email protected]>. (Tue, 19 Jul 2022 16:55:00 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Matthias Klose <[email protected]>
To: [email protected]
Subject: cmocka: ftbfs with LTO (link time optimization) enabled
Date: Tue, 19 Jul 2022 16:50:59 +0000
Package: src:cmocka
Version: 1.1.5-2
Severity: minor
Tags: sid bookworm
User: [email protected]
Usertags: ftbfs-lto

This package currently fails to build (at least on the amd64
architecture) with link time optimizations enabled.  For a background
for LTO please see

https://wiki.debian.org/ToolChain/LTO

The goal is to enable this optimization by default in an upcoming
Debian release in dpkg-buildflags for 64bit architectures.  The goal
is to get this package to build with link time optimizations, or to
explicitly disable link time optimizations for this package build.

To reproduce the build failure, enable the lto optimization in
testing/unstable by adding "optimize=+lto" to DEB_BUILD_MAINT_OPTIONS
in the debian/rules file, or if this macro is unset, just set it:

export DEB_BUILD_MAINT_OPTIONS = optimize=+lto

Please try to fix the build with lto enabled, fixing the packaging or
forwarding the issue upstream. If the issue cannot be fixed,
explicitly disallow building the package with lto by adding to your
rules file:

export DEB_BUILD_MAINT_OPTIONS = optimize=-lto

or adding that string to your existing setting of DEB_BUILD_MAINT_OPTIONS.

The full build log can be found at:
http://qa-logs.debian.net/2022/06/09/dpkglto/cmocka_1.1.5-2_unstable_dpkglto.log
The last lines of the build log are at the end of this report.

[...]
make  -f example/CMakeFiles/assert_module_test.dir/build.make example/CMakeFiles/assert_module_test.dir/build
make[3]: Entering directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make  -f example/mock/chef_wrap/CMakeFiles/waiter_test_wrap.dir/build.make example/mock/chef_wrap/CMakeFiles/waiter_test_wrap.dir/build
make[3]: Entering directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
/usr/bin/cc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now CMakeFiles/allocate_module_test.dir/allocate_module.c.o CMakeFiles/allocate_module_test.dir/allocate_module_test.c.o -o allocate_module_test  -Wl,-rpath,/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/src ../src/libcmocka.so.0.7.0 /usr/lib/x86_64-linux-gnu/librt.so 
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[ 83%] Building C object example/CMakeFiles/assert_macro_test.dir/assert_macro.c.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example && /usr/bin/cc  -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example -I/<<PKGBUILDDIR>>/example -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -MD -MT example/CMakeFiles/assert_macro_test.dir/assert_macro.c.o -MF CMakeFiles/assert_macro_test.dir/assert_macro.c.o.d -o CMakeFiles/assert_macro_test.dir/assert_macro.c.o -c /<<PKGBUILDDIR>>/example/assert_macro.c
[ 84%] Building C object example/CMakeFiles/assert_module_test.dir/assert_module.c.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example && /usr/bin/cc  -DUNIT_TESTING=1 -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example -I/<<PKGBUILDDIR>>/example -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -MD -MT example/CMakeFiles/assert_module_test.dir/assert_module.c.o -MF CMakeFiles/assert_module_test.dir/assert_module.c.o.d -o CMakeFiles/assert_module_test.dir/assert_module.c.o -c /<<PKGBUILDDIR>>/example/assert_module.c
[ 86%] Building C object example/mock/chef_wrap/CMakeFiles/waiter_test_wrap.dir/waiter_test_wrap.c.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/chef_wrap && /usr/bin/cc  -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/chef_wrap -I/<<PKGBUILDDIR>>/example/mock/chef_wrap -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -MD -MT example/mock/chef_wrap/CMakeFiles/waiter_test_wrap.dir/waiter_test_wrap.c.o -MF CMakeFiles/waiter_test_wrap.dir/waiter_test_wrap.c.o.d -o CMakeFiles/waiter_test_wrap.dir/waiter_test_wrap.c.o -c /<<PKGBUILDDIR>>/example/mock/chef_wrap/waiter_test_wrap.c
[ 86%] Built target test_exception_handler
make  -f example/mock/uptime/CMakeFiles/test_uptime.dir/build.make example/mock/uptime/CMakeFiles/test_uptime.dir/depend
make[3]: Entering directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /<<PKGBUILDDIR>> /<<PKGBUILDDIR>>/example/mock/uptime /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/uptime /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/uptime/CMakeFiles/test_uptime.dir/DependInfo.cmake --color=
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[ 87%] Linking C executable test_strmatch
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/tests && /usr/bin/cmake -E cmake_link_script CMakeFiles/test_strmatch.dir/link.txt --verbose=1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make  -f example/mock/uptime/CMakeFiles/test_uptime.dir/build.make example/mock/uptime/CMakeFiles/test_uptime.dir/build
make[3]: Entering directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[ 87%] Built target simple_test
/usr/bin/cc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now CMakeFiles/test_strmatch.dir/test_strmatch.c.o -o test_strmatch  ../src/libcmocka-static.a 
[ 90%] Building C object example/CMakeFiles/assert_macro_test.dir/assert_macro_test.c.o
[ 90%] Building C object example/CMakeFiles/assert_module_test.dir/assert_module_test.c.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example && /usr/bin/cc  -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example -I/<<PKGBUILDDIR>>/example -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -MD -MT example/CMakeFiles/assert_module_test.dir/assert_module_test.c.o -MF CMakeFiles/assert_module_test.dir/assert_module_test.c.o.d -o CMakeFiles/assert_module_test.dir/assert_module_test.c.o -c /<<PKGBUILDDIR>>/example/assert_module_test.c
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example && /usr/bin/cc  -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example -I/<<PKGBUILDDIR>>/example -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -MD -MT example/CMakeFiles/assert_macro_test.dir/assert_macro_test.c.o -MF CMakeFiles/assert_macro_test.dir/assert_macro_test.c.o.d -o CMakeFiles/assert_macro_test.dir/assert_macro_test.c.o -c /<<PKGBUILDDIR>>/example/assert_macro_test.c
[ 92%] Building C object example/mock/uptime/CMakeFiles/test_uptime.dir/test_uptime.c.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/uptime && /usr/bin/cc  -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/uptime -I/<<PKGBUILDDIR>>/example/mock/uptime -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Wimplicit-fallthrough -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat -Wformat-security -Werror=format-security -fno-common -fstack-protector-strong -fstack-clash-protection -MD -MT example/mock/uptime/CMakeFiles/test_uptime.dir/test_uptime.c.o -MF CMakeFiles/test_uptime.dir/test_uptime.c.o.d -o CMakeFiles/test_uptime.dir/test_uptime.c.o -c /<<PKGBUILDDIR>>/example/mock/uptime/test_uptime.c
[ 93%] Building C object example/mock/chef_wrap/CMakeFiles/waiter_test_wrap.dir/chef.c.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/chef_wrap && /usr/bin/cc  -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/chef_wrap -I/<<PKGBUILDDIR>>/example/mock/chef_wrap -I/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu -I/<<PKGBUILDDIR>>/include -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIE -MD -MT example/mock/chef_wrap/CMakeFiles/waiter_test_wrap.dir/chef.c.o -MF CMakeFiles/waiter_test_wrap.dir/chef.c.o.d -o CMakeFiles/waiter_test_wrap.dir/chef.c.o -c /<<PKGBUILDDIR>>/example/mock/chef_wrap/chef.c
[ 95%] Linking C executable assert_macro_test
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example && /usr/bin/cmake -E cmake_link_script CMakeFiles/assert_macro_test.dir/link.txt --verbose=1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[ 96%] Linking C executable assert_module_test
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example && /usr/bin/cmake -E cmake_link_script CMakeFiles/assert_module_test.dir/link.txt --verbose=1
[ 98%] Linking C executable waiter_test_wrap
/usr/bin/cc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now CMakeFiles/assert_macro_test.dir/assert_macro.c.o CMakeFiles/assert_macro_test.dir/assert_macro_test.c.o -o assert_macro_test  -Wl,-rpath,/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/src ../src/libcmocka.so.0.7.0 /usr/lib/x86_64-linux-gnu/librt.so 
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/chef_wrap && /usr/bin/cmake -E cmake_link_script CMakeFiles/waiter_test_wrap.dir/link.txt --verbose=1
[ 98%] Built target allocate_module_test
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
/usr/bin/cc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now CMakeFiles/assert_module_test.dir/assert_module.c.o CMakeFiles/assert_module_test.dir/assert_module_test.c.o -o assert_module_test  -Wl,-rpath,/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/src ../src/libcmocka.so.0.7.0 /usr/lib/x86_64-linux-gnu/librt.so 
/usr/bin/cc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -Wl,--wrap=chef_cook CMakeFiles/waiter_test_wrap.dir/waiter_test_wrap.c.o CMakeFiles/waiter_test_wrap.dir/chef.c.o -o waiter_test_wrap  -Wl,-rpath,/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/src ../../../src/libcmocka.so.0.7.0 /usr/lib/x86_64-linux-gnu/librt.so 
[ 98%] Built target test_cmockery
[100%] Linking C executable test_uptime
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/example/mock/uptime && /usr/bin/cmake -E cmake_link_script CMakeFiles/test_uptime.dir/link.txt --verbose=1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
/usr/bin/cc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now  -Wl,--wrap=uptime CMakeFiles/test_uptime.dir/test_uptime.c.o -o test_uptime  -Wl,-rpath,/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/src ../../../src/libcmocka.so.0.7.0 /usr/lib/x86_64-linux-gnu/librt.so 
[100%] Built target assert_macro_test
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[100%] Built target waiter_test_wrap
[100%] Built target assert_module_test
/usr/bin/ld: /tmp/ccRysoKW.ltrans0.ltrans.o: in function `calc_uptime':
./obj-x86_64-linux-gnu/example/mock/uptime/./example/mock/uptime/uptime.c:35: undefined reference to `__wrap_uptime'
collect2: error: ld returned 1 exit status
make[3]: *** [example/mock/uptime/CMakeFiles/test_uptime.dir/build.make:102: example/mock/uptime/test_uptime] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:1865: example/mock/uptime/CMakeFiles/test_uptime.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[100%] Built target test_strmatch
make[2]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[1]: *** [Makefile:169: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
dh_auto_build: error: cd obj-x86_64-linux-gnu && make -j8 "INSTALL=install --strip-program=true" VERBOSE=1 returned exit code 2
make: *** [debian/rules:10: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2



Added tag(s) trixie. Request was from Sebastian Ramacher <[email protected]> to [email protected]. (Sun, 11 Jun 2023 15:47:33 GMT) (full text, mbox, link).


Removed tag(s) bookworm. Request was from Andreas Beckmann <[email protected]> to [email protected]. (Fri, 13 Oct 2023 10:30:11 GMT) (full text, mbox, link).


Added tag(s) experimental. Request was from Andreas Beckmann <[email protected]> to [email protected]. (Fri, 13 Oct 2023 10:30:12 GMT) (full text, mbox, link).


Information forwarded to [email protected], David Prévot <[email protected]>:
Bug#1015370; Package src:cmocka. (Tue, 19 Dec 2023 14:48:02 GMT) (full text, mbox, link).


Acknowledgement sent to Hefee <[email protected]>:
Extra info received and forwarded to list. Copy sent to David Prévot <[email protected]>. (Tue, 19 Dec 2023 14:48:02 GMT) (full text, mbox, link).


Message #16 received at [email protected] (full text, mbox, reply):

From: Hefee <[email protected]>
To: [email protected]
Subject: Re: cmocka: ftbfs with LTO (link time optimization) enabled
Date: Tue, 19 Dec 2023 15:38:50 +0100
[Message part 1 (text/plain, inline)]
Control: reassign -1 binutils 2.41.50.20231206-1
Control: affects -1 cmocka
Control: forwarded -1  https://sourceware.org/bugzilla/show_bug.cgi?id=24415
Control: retitle ld.gold - -Wl,--wrap not supported with LTO and optimization

Hey,

this is not a bug in cmocka. It is actually an bug in ld.gold , that does not 
correctly handles - -Wl,--wrap with LTO together correctly:

https://gitlab.com/cmocka/cmocka/-/issues/20

The workaround is to disable building examples, as it is the only place where 
this feature is used. 

Current state is that ld.bfd and ld.lld are fixed. But ld.gold fails :(

https://sourceware.org/bugzilla/show_bug.cgi?id=24415

Regards,

hefee
[signature.asc (application/pgp-signature, inline)]

Bug reassigned from package 'src:cmocka' to 'binutils'. Request was from Hefee <[email protected]> to [email protected]. (Tue, 19 Dec 2023 14:48:02 GMT) (full text, mbox, link).


No longer marked as found in versions cmocka/1.1.5-2. Request was from Hefee <[email protected]> to [email protected]. (Tue, 19 Dec 2023 14:48:02 GMT) (full text, mbox, link).


Marked as found in versions binutils/2.41.50.20231206-1. Request was from Hefee <[email protected]> to [email protected]. (Tue, 19 Dec 2023 14:48:03 GMT) (full text, mbox, link).


Added indication that 1015370 affects cmocka Request was from Hefee <[email protected]> to [email protected]. (Tue, 19 Dec 2023 14:48:03 GMT) (full text, mbox, link).


Set Bug forwarded-to-address to 'https://sourceware.org/bugzilla/show_bug.cgi?id=24415'. Request was from Hefee <[email protected]> to [email protected]. (Tue, 19 Dec 2023 14:48:04 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 13:06:56 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.