diff mbox series

[1/1] package/xz: fix musl static build

Message ID 20240723215041.771843-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [1/1] package/xz: fix musl static build | expand

Commit Message

Fabrice Fontaine July 23, 2024, 9:50 p.m. UTC
For an unknown reason, runnning autoreconf is needed to avoid the
following static build failure on musl which is raised because LDFLAGS
(which contains -static) is not passed:

/home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/../../../../armeb-buildroot-linux-musleabi/bin/ld: /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/libgcc.a(_dvmd_lnx.o): in function `__aeabi_idiv0':
/home/autobuild/autobuild/instance-16/output-1/build/host-gcc-final-13.3.0/build/armeb-buildroot-linux-musleabi/libgcc/../../../libgcc/config/arm/lib1funcs.S:1499:(.text+0x8): undefined reference to `raise'

This build failure is raised by autobuilders since bump to version 5.6.2
in commit d1d77eb274761d1f2d24ee4b55a374e917c67a8e but it can also be
reproduced on version 5.4.7 (but not on 5.4.6). There is probably an
issue with these two official autotools tarballs which have been
released the same day (on May 29 2024).

Fixes: 40240ac30afc4c6af765794f38e6815162ca61fa
 - http://autobuild.buildroot.org/results/344813b202644a23c166920aa7e861ebf408536b

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/xz/xz.mk | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Petazzoni July 24, 2024, 4:33 p.m. UTC | #1
On Tue, 23 Jul 2024 23:50:41 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> For an unknown reason, runnning autoreconf is needed to avoid the
> following static build failure on musl which is raised because LDFLAGS
> (which contains -static) is not passed:
> 
> /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/../../../../armeb-buildroot-linux-musleabi/bin/ld: /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/libgcc.a(_dvmd_lnx.o): in function `__aeabi_idiv0':
> /home/autobuild/autobuild/instance-16/output-1/build/host-gcc-final-13.3.0/build/armeb-buildroot-linux-musleabi/libgcc/../../../libgcc/config/arm/lib1funcs.S:1499:(.text+0x8): undefined reference to `raise'
> 
> This build failure is raised by autobuilders since bump to version 5.6.2
> in commit d1d77eb274761d1f2d24ee4b55a374e917c67a8e but it can also be
> reproduced on version 5.4.7 (but not on 5.4.6). There is probably an
> issue with these two official autotools tarballs which have been
> released the same day (on May 29 2024).
> 
> Fixes: 40240ac30afc4c6af765794f38e6815162ca61fa
>  - http://autobuild.buildroot.org/results/344813b202644a23c166920aa7e861ebf408536b
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/xz/xz.mk | 2 ++
>  1 file changed, 2 insertions(+)

Thanks for the investigation. However, I'd like to have a little bit
better understanding than "unknown reason". Could you compare the
build/link command lines used by xz without/with the AUTORECONF = YES,
to see what's different?

What puzzles me is that the build failures are related to libgcc.a
missing some symbols. So do we have a xz issue here, or do we have an
actual host-gcc-final issue that somehow gets worked-around by doing
XZ_AUTORECONF = YES ? That is what worries me about merging this fix
without a slightly better understanding of what's going on.

Thomas
Fabrice Fontaine July 24, 2024, 6:02 p.m. UTC | #2
Le mer. 24 juil. 2024 à 18:33, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Tue, 23 Jul 2024 23:50:41 +0200
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > For an unknown reason, runnning autoreconf is needed to avoid the
> > following static build failure on musl which is raised because LDFLAGS
> > (which contains -static) is not passed:
> >
> > /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/../../../../armeb-buildroot-linux-musleabi/bin/ld: /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/libgcc.a(_dvmd_lnx.o): in function `__aeabi_idiv0':
> > /home/autobuild/autobuild/instance-16/output-1/build/host-gcc-final-13.3.0/build/armeb-buildroot-linux-musleabi/libgcc/../../../libgcc/config/arm/lib1funcs.S:1499:(.text+0x8): undefined reference to `raise'
> >
> > This build failure is raised by autobuilders since bump to version 5.6.2
> > in commit d1d77eb274761d1f2d24ee4b55a374e917c67a8e but it can also be
> > reproduced on version 5.4.7 (but not on 5.4.6). There is probably an
> > issue with these two official autotools tarballs which have been
> > released the same day (on May 29 2024).
> >
> > Fixes: 40240ac30afc4c6af765794f38e6815162ca61fa
> >  - http://autobuild.buildroot.org/results/344813b202644a23c166920aa7e861ebf408536b
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> >  package/xz/xz.mk | 2 ++
> >  1 file changed, 2 insertions(+)
>
> Thanks for the investigation. However, I'd like to have a little bit
> better understanding than "unknown reason". Could you compare the
> build/link command lines used by xz without/with the AUTORECONF = YES,
> to see what's different?

Without autoreconf:

libtool: link: /home/fabrice/buildroot/output/host/bin/armeb-buildroot-linux-musleabi-gcc
-fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self
-Wmissing-include-dirs -Wshift-overflow=2 -Wstrict-overflow=3
-Walloc-zero -Wduplicated-cond -Wfloat-equal -Wundef -Wshadow
-Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wdate-time
-Wsign-conversion -Wfloat-conversion -Wlogical-op -Waggregate-return
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
-Wmissing-declarations -Wredundant-decls -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O0 -g2 -o xzdec
xzdec-xzdec.o xzdec-tuklib_progname.o xzdec-tuklib_exit.o
../../src/liblzma/.libs/liblzma.a -lpthread -pthread

With autoreconf:

libtool: link: /home/fabrice/buildroot/output/host/bin/armeb-buildroot-linux-musleabi-gcc
-fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self
-Wmissing-include-dirs -Wshift-overflow=2 -Wstrict-overflow=3
-Walloc-zero -Wduplicated-cond -Wfloat-equal -Wundef -Wshadow
-Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wdate-time
-Wsign-conversion -Wfloat-conversion -Wlogical-op -Waggregate-return
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
-Wmissing-declarations -Wredundant-decls -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O0 -g2 -static -static
-o xzdec xzdec-xzdec.o xzdec-tuklib_progname.o xzdec-tuklib_exit.o
../../src/liblzma/.libs/liblzma.a -lpthread -pthread

So as you can see, the only difference is the addition of -static -static.

>
> What puzzles me is that the build failures are related to libgcc.a
> missing some symbols. So do we have a xz issue here, or do we have an
> actual host-gcc-final issue that somehow gets worked-around by doing
> XZ_AUTORECONF = YES ? That is what worries me about merging this fix
> without a slightly better understanding of what's going on.

The "undefined reference to raise" is the usual error when -static is
not passed when building statically with musl.
You even opened a ticket on musl mailing list back in 2018:
https://inbox.vuxu.org/musl/20180509112932.1a3176b0@windsurf.home/T/

>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Best Regards,

Fabrice
Thomas Petazzoni Aug. 2, 2024, 6:08 p.m. UTC | #3
On Tue, 23 Jul 2024 23:50:41 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> For an unknown reason, runnning autoreconf is needed to avoid the
> following static build failure on musl which is raised because LDFLAGS
> (which contains -static) is not passed:
> 
> /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/../../../../armeb-buildroot-linux-musleabi/bin/ld: /home/autobuild/autobuild/instance-16/output-1/host/lib/gcc/armeb-buildroot-linux-musleabi/13.3.0/libgcc.a(_dvmd_lnx.o): in function `__aeabi_idiv0':
> /home/autobuild/autobuild/instance-16/output-1/build/host-gcc-final-13.3.0/build/armeb-buildroot-linux-musleabi/libgcc/../../../libgcc/config/arm/lib1funcs.S:1499:(.text+0x8): undefined reference to `raise'
> 
> This build failure is raised by autobuilders since bump to version 5.6.2
> in commit d1d77eb274761d1f2d24ee4b55a374e917c67a8e but it can also be
> reproduced on version 5.4.7 (but not on 5.4.6). There is probably an
> issue with these two official autotools tarballs which have been
> released the same day (on May 29 2024).
> 
> Fixes: 40240ac30afc4c6af765794f38e6815162ca61fa
>  - http://autobuild.buildroot.org/results/344813b202644a23c166920aa7e861ebf408536b
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/xz/xz.mk | 2 ++
>  1 file changed, 2 insertions(+)

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/package/xz/xz.mk b/package/xz/xz.mk
index 8dfd76f8b9..9fb93ff4d6 100644
--- a/package/xz/xz.mk
+++ b/package/xz/xz.mk
@@ -12,6 +12,8 @@  XZ_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
 XZ_LICENSE = Public Domain, BSD-0-Clause, GPL-2.0+, GPL-3.0+, LGPL-2.1+
 XZ_LICENSE_FILES = COPYING COPYING.0BSD COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1
 XZ_CPE_ID_VENDOR = tukaani
+# autoreconf needed to fix a musl static build failure
+XZ_AUTORECONF = YES
 
 # The package is a dependency to ccache so ccache cannot be a dependency
 HOST_XZ_ADD_CCACHE_DEPENDENCY = NO