Message ID | 878rxeebh6.fsf@gmx.com |
---|---|
State | Accepted |
Headers | show |
Series | [bug#52066,core-updates-frozen,RFC] Fix static guile on aarch64 | expand |
Context | Check | Description |
---|---|---|
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
Hi Pierre, Pierre Langlois <pierre.langlois@gmx.com> skribis: > The root of the issue seems to be that the make-guile-static procedure > isn't actually producing a static binary on aarch64. Digging into it > more, we do pass the -all-static flag to libtool, but the gcc command > doesn't actually do any static linking: > > /tmp/guix-build-guile-static-3.0.7.drv-0/guile-3.0.7$ make V=1 > ... > ../libtool --tag=CC --mode=link gcc -std=gnu11 -pthread -Wall -Wmissing-prototypes -Wpointer-arith -fno-strict-aliasing -fwrapv -fvisibility=hidden -g -O2 -all-static -pthread -ldl -o guile guile-guile.o libguile-3.0.la -ldl -lcrypt -lm > libtool: link: gcc -std=gnu11 -pthread -Wall -Wmissing-prototypes -Wpointer-arith -fno-strict-aliasing -fwrapv -fvisibility=hidden -g -O2 -pthread -o guile guile-guile.o ./.libs/libguile-3.0.a -L/gnu/store/3539zsmc939g1r9g3r02bpy0m1b9v9c8-libgc-8.0.4/lib -L/gnu/store/sn95w7yk9qwxhw74l590606y53pf5mkf-libffi-3.3/lib /gnu/store/3539zsmc939g1r9g3r02bpy0m1b9v9c8-libgc-8.0.4/lib/libgc.a -lpthread /gnu/store/sn95w7yk9qwxhw74l590606y53pf5mkf-libffi-3.3/lib/libffi.a -lunistring -ldl -lcrypt -lm -pthread So ‘libtool’ is not passing ‘-static’, right? Why is that? (It does pick .a libs though.) [...] > Doing more digging, I found a reference to a similar issue here: > https://bugzilla.redhat.com/show_bug.cgi?id=1830472#c1, this looks > related to the -moutline-atomics option that's enabled by default with > GCC 10. But we're building guile with GCC 7 so it was a bit confusing. > > However, glibc here is actually built with the default GCC 10, and if we > change that then it works! > > --- a/gnu/packages/make-bootstrap.scm > +++ b/gnu/packages/make-bootstrap.scm > @@ -85,6 +85,9 @@ (define glibc-for-bootstrap > `(cons* "--disable-nscd" "--disable-build-nscd" > "--enable-static-nss" > ,flags)))) > + (native-inputs > + `(("gcc" ,gcc-7) > + ,@(package-native-inputs base))) > > ;; Remove the 'debug' output to allow bit-reproducible builds (when the > ;; 'debug' output is used, ELF files end up with a .gnu_debuglink, which I think that’s a reasonable fix for now; you can push the patch. However, we should eventually switch to GCC 10 in make-bootstrap.scm; I don’t think there’s any good justification for sticking to GCC 7. Thank you! Ludo’.
Hi Ludo', Ludovic Courtès <ludo@gnu.org> writes: > Hi Pierre, > > Pierre Langlois <pierre.langlois@gmx.com> skribis: > >> The root of the issue seems to be that the make-guile-static procedure >> isn't actually producing a static binary on aarch64. Digging into it >> more, we do pass the -all-static flag to libtool, but the gcc command >> doesn't actually do any static linking: >> >> /tmp/guix-build-guile-static-3.0.7.drv-0/guile-3.0.7$ make V=1 >> ... >> ../libtool --tag=CC --mode=link gcc -std=gnu11 -pthread -Wall -Wmissing-prototypes -Wpointer-arith -fno-strict-aliasing -fwrapv -fvisibility=hidden -g -O2 -all-static -pthread -ldl -o guile guile-guile.o libguile-3.0.la -ldl -lcrypt -lm >> libtool: link: gcc -std=gnu11 -pthread -Wall -Wmissing-prototypes >> -Wpointer-arith -fno-strict-aliasing -fwrapv -fvisibility=hidden -g -O2 >> -pthread -o guile guile-guile.o ./.libs/libguile-3.0.a >> -L/gnu/store/3539zsmc939g1r9g3r02bpy0m1b9v9c8-libgc-8.0.4/lib >> -L/gnu/store/sn95w7yk9qwxhw74l590606y53pf5mkf-libffi-3.3/lib >> /gnu/store/3539zsmc939g1r9g3r02bpy0m1b9v9c8-libgc-8.0.4/lib/libgc.a -lpthread >> /gnu/store/sn95w7yk9qwxhw74l590606y53pf5mkf-libffi-3.3/lib/libffi.a >> -lunistring -ldl -lcrypt -lm -pthread > > So ‘libtool’ is not passing ‘-static’, right? Why is that? (It does > pick .a libs though.) Yeah, I'm also confused about that. I did take a quick look at the libtool sources but I couldn't work out what was happening. My best guess is that it tries to use the -static flag and fails, but it prefer to drop the flag rather than issue an error. It could be for backwards compatiblity reasons. > > [...] > >> Doing more digging, I found a reference to a similar issue here: >> https://bugzilla.redhat.com/show_bug.cgi?id=1830472#c1, this looks >> related to the -moutline-atomics option that's enabled by default with >> GCC 10. But we're building guile with GCC 7 so it was a bit confusing. >> >> However, glibc here is actually built with the default GCC 10, and if we >> change that then it works! >> >> --- a/gnu/packages/make-bootstrap.scm >> +++ b/gnu/packages/make-bootstrap.scm >> @@ -85,6 +85,9 @@ (define glibc-for-bootstrap >> `(cons* "--disable-nscd" "--disable-build-nscd" >> "--enable-static-nss" >> ,flags)))) >> + (native-inputs >> + `(("gcc" ,gcc-7) >> + ,@(package-native-inputs base))) >> >> ;; Remove the 'debug' output to allow bit-reproducible builds (when the >> ;; 'debug' output is used, ELF files end up with a .gnu_debuglink, which > > I think that’s a reasonable fix for now; you can push the patch. > > However, we should eventually switch to GCC 10 in make-bootstrap.scm; I > don’t think there’s any good justification for sticking to GCC 7. > > Thank you! Thanks! I just pushed it with as 48b754553aeb98660fe145633616a9d965fbd60e. Pierre
From c1f61c161b3f5f7e8430c4925b0785d3819e255e Mon Sep 17 00:00:00 2001 From: Pierre Langlois <pierre.langlois@gmx.com> Date: Tue, 23 Nov 2021 22:41:20 +0000 Subject: [PATCH] gnu: glibc-for-bootstrap: Build with GCC 7. * gnu/packages/make-bootstrap.scm (glibc-for-bootstrap)[native-inputs]: Add gcc-7. --- gnu/packages/make-bootstrap.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 267adde48c..d8f1f0eb1e 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -86,6 +86,12 @@ (define glibc-for-bootstrap "--enable-static-nss" ,flags)))) + ;; Make sure to build glibc with the same compiler version with the rest + ;; of the bootstrap. Otherwise it fails to statically link on aarch64. + (native-inputs + `(("gcc" ,gcc-7) + ,@(package-native-inputs base))) + ;; Remove the 'debug' output to allow bit-reproducible builds (when the ;; 'debug' output is used, ELF files end up with a .gnu_debuglink, which ;; includes a CRC of the corresponding debugging symbols; those symbols -- 2.34.0