Skip to content

guix: migrate to native GCC 10 toolchain for Linux builds #24701

@fanquake

Description

@fanquake

Currently, our Linux Guix builds differ from macOS and Windows, in that they use a native GCC 7 toolchain (i.e to build glibc) and then GCC 10 to build depends and Bitcoin Core. Migrating the Linux builds to a native GCC 10 toolchain will unify us on a single native compiler.

The main issue with performing this migration is building older glibcs (2.24, 2.27) with GCC 10. When I last tried, it was apparent that either warnings produced by the newer GCC would need to be suppressed (as glibc is built -Werror), or patches to glibc would need to be backported to address any issues. For example:

x86_64-linux-gnu-gcc ../sysdeps/unix/sysv/linux/x86_64/sysdep.S -c     -I../include -I/tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build/csu  -I/tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build  -I../sysdeps/unix/sysv/linux/x86_64/64  -I../sysdeps/unix/sysv/linux/x86_64  -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch  -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu  -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86  -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /gnu/store/r2h1g2vg7j36rqwyraf5wghm10ykq055-gcc-cross-sans-libc-x86_64-linux-gnu-10.3.0-lib/lib/gcc/x86_64-linux-gnu/10.3.0/include -isystem /gnu/store/r2h1g2vg7j36rqwyraf5wghm10ykq055-gcc-cross-sans-libc-x86_64-linux-gnu-10.3.0-lib/lib/gcc/x86_64-linux-gnu/10.3.0/include-fixed -isystem /gnu/store/5fhhr33nilcyi1k3s1xwcmibdhc1l39c-linux-libre-headers-cross-x86_64-linux-gnu-4.9.306/include -D_LIBC_REENTRANT -include /tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC -DSHARED     -DASSEMBLER -I/tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build/csu/. -g -Werror=undef -Wa,--noexecstack   -o /tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build/csu/sysdep.os -MD -MP -MF /tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build/csu/sysdep.os.dt -MT /tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.24.drv-0/build/csu/sysdep.os
libc-tls.c: In function ‘__libc_setup_tls’:
libc-tls.c:208:30: error: array subscript 1 is outside the bounds of an interior zero-length array ‘struct dtv_slotinfo[0]’ [-Werror=zero-length-bounds]
  208 |   static_slotinfo.si.slotinfo[1].map = main_map;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from ../sysdeps/x86_64/ldsodefs.h:54,
                 from ../sysdeps/gnu/ldsodefs.h:46,
                 from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
                 from libc-tls.c:20:
../sysdeps/generic/ldsodefs.h:398:7: note: while referencing ‘slotinfo’
  398 |     } slotinfo[0];
      |       ^~~~~~~~
cc1: all warnings being treated as errors

This branch could be used as a starting point: https://github.com/fanquake/bitcoin/tree/native_gcc_10_linux (3974ac5). Builds for x86_64-w64-mingw32 x86_64-apple-darwin x86_64-apple-darwin will all work as expected. A Linux build, i.e HOSTS="x86_64-linux-gnu" ./contrib/guix/guix-build will not, and will fail with the error displayed above.

Useful skills:

  • Guix
  • Build system

Want to work on this issue?

For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions