Subject: Re: bug#51664: kexec-tools fails to build on i686-linux, breaks GTK/GNOME

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 07 Nov 2021 22:41:12 -0500

Hi again,

Maxim Cournoyer <[email-masked]> writes:

[...]

>
> In the Ubuntu VM, the following include directive is passed to gcc:
>
>   -I/usr/lib/gcc/x86_64-linux-gnu/10/include
>
> while on Guix it uses:
>
>   -I/gnu/store/4vafjcwi9vlks5y67naf9gdia9l42pfz-gcc-10.3.0-lib/lib/gcc/i686-unknown-linux-gnu/10.3.0/include;
>
> i.e. it selects the i686 include directory of GCC instead of the x86_64
> one.  That probably explains the missing .code64 and other
> x86_64-related symbols in the compilation errors.
>
> kexec-tools is a required input of elogind since at least 246.10, which
> means GTK/GNOME is broken by this problem on i686
> (core-updates-frozen-batched-changes).

As suggested in OFTC's #debian channel, I attempted to build kexec-tools
on a i686 Debian system to ensure the problem is not in kexec-tools; and
it built fine there too,

--8<---------------cut here---------------start------------->8---
[...]
gcc   -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -MD -o purgatory/arch/i386/compat_x86_64.o purgatory/arch/i386/compat_x86_64.S
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector  -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -MD -o purgatory/arch/i386/purgatory-x86.o purgatory/arch/i386/purgatory-x86.c
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector  -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -MD -o purgatory/arch/i386/console-x86.o purgatory/arch/i386/console-x86.c
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector  -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -MD -o purgatory/arch/i386/vga.o purgatory/arch/i386/vga.c
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector  -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -MD -o purgatory/arch/i386/pic.o purgatory/arch/i386/pic.c
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector  -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -MD -o purgatory/arch/i386/crashdump_backup.o purgatory/arch/i386/crashdump_backup.c
mkdir -p purgatory
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector -O2   -I./purgatory/include -I./purgatory/arch/i386/include -I./util_lib/include -I./include -Iinclude -I/usr/lib/gcc/i686-linux-gnu/8/include  -c -o purgatory/sha256.o util_lib/sha256.c
mkdir -p purgatory
gcc -fno-zero-initialized-in-bss  -Os -fno-builtin -ffreestanding -fno-zero-initialized-in-bss -fno-PIC -fno-PIE -fno-stack-protector  -Wl,--no-undefined -nostartfiles -nostdlib -nodefaultlibs -e purgatory_start -r -Wl,-Map=purgatory/purgatory.map -o purgatory/purgatory.ro.sym purgatory/purgatory.o purgatory/printf.o purgatory/string.o purgatory/arch/i386/entry32-16.o purgatory/arch/i386/entry32-16-debug.o purgatory/arch/i386/entry32.o purgatory/arch/i386/setup-x86.o purgatory/arch/i386/stack.o purgatory/arch/i386/compat_x86_64.o purgatory/arch/i386/purgatory-x86.o purgatory/arch/i386/console-x86.o purgatory/arch/i386/vga.o purgatory/arch/i386/pic.o purgatory/arch/i386/crashdump_backup.o purgatory/sha256.o
strip --strip-debug -o purgatory/purgatory.ro purgatory/purgatory.ro.sym
gcc   -O2 -Wall -o bin/bin-to-hex util/bin-to-hex.c
mkdir -p kexec
bin/bin-to-hex purgatory < purgatory/purgatory.ro > kexec/purgatory.c
gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/  -I./kexec/arch/i386/include  -c -MD -o kexec/purgatory.o kexec/purgatory.c
gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/  -I./kexec/arch/i386/include -I./util_lib/include  -c -MD -o util_lib/compute_ip_checksum.o util_lib/compute_ip_checksum.c
gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/  -I./kexec/arch/i386/include -I./util_lib/include  -c -MD -o util_lib/elf_info.o util_lib/elf_info.c
gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/  -I./kexec/arch/i386/include -I./util_lib/include  -c -MD -o util_lib/sha256.o util_lib/sha256.c
ar rs libutil.a util_lib/compute_ip_checksum.o util_lib/elf_info.o util_lib/sha256.o
ar: creating libutil.a
gcc   -o build/sbin/kexec kexec/kexec.o kexec/ifdown.o kexec/kexec-elf.o kexec/kexec-elf-exec.o kexec/kexec-elf-core.o kexec/kexec-elf-rel.o kexec/kexec-elf-boot.o kexec/kexec-iomem.o kexec/firmware_memmap.o kexec/crashdump.o kexec/crashdump-xen.o kexec/phys_arch.o kexec/lzma.o kexec/zlib.o kexec/kexec-xen.o kexec/symbols.o kexec/proc_iomem.o kexec/virt_to_phys.o kexec/phys_to_virt.o kexec/add_segment.o kexec/add_buffer.o kexec/arch_reuse_initrd.o kexec/arch/i386/kexec-x86.o kexec/arch/i386/kexec-x86-common.o kexec/arch/i386/kexec-elf-x86.o kexec/arch/i386/kexec-elf-rel-x86.o kexec/arch/i386/kexec-bzImage.o kexec/arch/i386/kexec-multiboot-x86.o kexec/arch/i386/kexec-mb2-x86.o kexec/arch/i386/kexec-beoboot-x86.o kexec/arch/i386/kexec-nbi.o kexec/arch/i386/x86-linux-setup.o kexec/arch/i386/crashdump-x86.o kexec/purgatory.o libutil.a -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes 
gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/   -c -MD -o vmcore-dmesg/vmcore-dmesg.o vmcore-dmesg/vmcore-dmesg.c
gcc   -o build/sbin/vmcore-dmesg vmcore-dmesg/vmcore-dmesg.o libutil.a -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes 
gcc -m32 -I./include -I./util_lib/include -Iinclude/  -DRELOC=0x10000  -c -MD -o kexec_test/kexec_test16.o kexec_test/kexec_test16.S
gcc -m32 -I./include -I./util_lib/include -Iinclude/  -DRELOC=0x10000  -c -MD -o kexec_test/kexec_test.o kexec_test/kexec_test.S
mkdir -p build/lib/kexec-tools
ld -melf_i386 -e _start -Ttext 0x10000 -o build/lib/kexec-tools/kexec_test kexec_test/kexec_test16.o kexec_test/kexec_test.o
cp kexec/kexec.8 build/man/man8/kexec.8
mkdir -p     build/man/man8
cp vmcore-dmesg/vmcore-dmesg.8 build/man/man8/vmcore-dmesg.8
--8<---------------cut here---------------end--------------->8---

So everything so far seems to suggest the problem is in Guix rather than
somewhere else.

Maxim