Package: repowerd
Version: 2022.01-3
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu lunar ubuntu-patch

Hi Mike,

The repowerd package fails to build from source when LTO is enabled, as seen
in Ubuntu on those archs that use LTO:

[...]
/usr/bin/c++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto 
-ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security 
-fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/repowerd-2022.01-3 -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -pthread -std=c++14 -Werror -Wall -Wnon-virtual-dtor 
-Wextra -pedantic -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects 
-Wl,-z,relro -Wl,-z,now -rdynamic CMakeFiles/repowerd.dir/main.cpp.o -o 
../bin/repowerd  core/librepowerd-core.a adapters/librepowerd-adapters.a 
librepowerd-default-daemon-config.a core/librepowerd-core.a 
adapters/librepowerd-adapters.a adapters/libsuspend/libsuspend.a 
-L/usr/lib/x86_64-linux-gnu -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgio-2.0 
-lgobject-2.0 -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgio-2.0 
-lgobject-2.0 -lglib-2.0 
[...]
In member function ‘__ct ’,
    inlined from ‘__ct ’ at 
/usr/src/repowerd-2022.01-3/src/core/handler_registration.cpp:32:7,
    inlined from ‘__ct ’ at 
/usr/src/repowerd-2022.01-3/src/default_daemon_config.cpp:65:57,
    inlined from ‘register_proximity_handler’ at 
/usr/src/repowerd-2022.01-3/src/default_daemon_config.cpp:116:16:
/usr/include/c++/12/bits/std_function.h:391:17: error: ‘<anonymous>’ may be 
used uninitialized [-Werror=maybe-uninitialized]
  391 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |                 ^
[...]

  (https://launchpad.net/ubuntu/+source/repowerd/2022.01-3/+build/24577522)

I have uploaded the attached patch in Ubuntu to fix the build failure there. 
Debian does not yet use LTO by default but it is being discussed, so I'm
upstreaming this patch for your consideration.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru repowerd-2022.01/debian/rules repowerd-2022.01/debian/rules
--- repowerd-2022.01/debian/rules       2022-07-19 15:23:13.000000000 -0700
+++ repowerd-2022.01/debian/rules       2023-02-16 21:08:12.000000000 -0800
@@ -6,7 +6,7 @@
 
 include /usr/share/dpkg/buildflags.mk
 # see FEATURE AREAS in dpkg-buildflags(1)
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
 
 %:
        dh $@

Reply via email to