#1015599 python-lz4: ftbfs with LTO (link time optimization) enabled

#1015599#5
Date:
2022-07-19 16:58:39 UTC
From:
To:
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/python-lz4_4.0.0+dfsg-1_unstable_dpkglto.log
The last lines of the build log are at the end of this report.

[...]
dh clean --with python3 --buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:239: python3.9 setup.py clean
running clean
removing '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.9' does not exist -- can't clean it
I: pybuild base:239: python3.10 setup.py clean
running clean
removing '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.10' does not exist -- can't clean it
   dh_autoreconf_clean -O--buildsystem=pybuild
   dh_clean -O--buildsystem=pybuild
 debian/rules binary
dh binary --with python3 --buildsystem=pybuild
   dh_update_autotools_config -O--buildsystem=pybuild
   dh_autoreconf -O--buildsystem=pybuild
   dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:239: python3.9 setup.py config
running config
I: pybuild base:239: python3.10 setup.py config
running config
   dh_auto_build -O--buildsystem=pybuild
I: pybuild base:239: /usr/bin/python3.9 setup.py build
running build
running build_py
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4
copying lz4/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4
copying lz4/version.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4/block
copying lz4/block/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4/block
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4/frame
copying lz4/frame/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4/frame
running build_ext
building 'lz4._version' extension
creating build
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/lz4
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c lz4/_version.c -o build/temp.linux-x86_64-3.9/lz4/_version.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.9/lz4/_version.o -llz4 -o /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_lz4/build/lz4/_version.cpython-39-x86_64-linux-gnu.so
/usr/bin/ld: /tmp/ccf7sC0u.ltrans0.ltrans.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
E: pybuild pybuild:369: build: plugin distutils failed with: exit code=1: /usr/bin/python3.9 setup.py build
I: pybuild base:239: /usr/bin/python3 setup.py build
running build
running build_py
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4
copying lz4/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4
copying lz4/version.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4/block
copying lz4/block/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4/block
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4/frame
copying lz4/frame/__init__.py -> /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4/frame
running build_ext
building 'lz4._version' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/lz4
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.10 -c lz4/_version.c -o build/temp.linux-x86_64-3.10/lz4/_version.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.10/lz4/_version.o -llz4 -o /<<PKGBUILDDIR>>/.pybuild/cpython3_3.10_lz4/build/lz4/_version.cpython-310-x86_64-linux-gnu.so
/usr/bin/ld: /tmp/ccY9Q0vV.ltrans0.ltrans.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
E: pybuild pybuild:369: build: plugin distutils failed with: exit code=1: /usr/bin/python3 setup.py build
dh_auto_build: error: pybuild --build -i python{version} -p "3.9 3.10" returned exit code 13
make: *** [debian/rules:10: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2