On Mon, Nov 23, 2020 at 11:44:10PM +0100, Christopher Gregory via blfs-support 
wrote:
> Hello,
> 
> Late last year, it was reported that quemu failed to build due to missing 
> gnu/stubs-32.h, and it seems that the original poster never managed to get it 
> solved.  I have now encountered the exact same error when building quemu 
> 5.1.0.
> 
> I have managed to solve this issue, by editing:
> 
> /usr/include/gnu/stubs.h and commenting out the below block.
> 
> 
> /*#if !defined __x86_64__
> # include <gnu/stubs-32.h>
> #endif */
> 
> Please note that like the original poster, I have not, and never have enabled 
> 32 bit on my lfs builds.  I have no idea why we are randomly coming up with 
> this error.  After commenting out the above, qemu successfully compiles, 
> without the need of going through and attempting multiple re-installations of 
> various packages.
> 
> I am going to leave that commented out so that I do not get any more 
> unpleasant surprises down the track.
> 
> Regards,
> 
> Christopher.
> 
Hi Christopher,

obviously something strange is happening from time to time with qemu
builds.

the original report can be found at
https://www.mail-archive.com/blfs-support@lists.linuxfromscratch.org/msg06247.html
and the actual reported failure was:

CC      pc-bios/optionrom/linuxboot_dma.oIn file included from
/usr/include/features.h:474,                 from
/usr/include/bits/libc-header-start.h:33,                 from
/usr/include/stdint.h:26,                 from
/usr/src/blfs/vm/qemu-4.1.0/pc-bios/optionrom/linuxboot_dma.c:65:/usr/include/gnu/stubs.h:7:11:
fatal error: gnu/stubs-32.h: No such file or directory    7 | # include
<gnu/stubs-32.h>      |           ^~~~~~~~~~~~~~~~compilation
terminated.make[1]: *** [/usr/src/blfs/vm/qemu-4.1.0/rules.mak:69:
linuxboot_dma.o] Error 1make: *** [Makefile:519: pc-bios/optionrom/all]
Error 2*

I've just tried pasting what is in the book, with the x86_64-softmmu
QEMU_ARCH (which the OP was using) and make -j1 on an LFS-10 sustem
succeeded without error and I definitely have the following
linuxboot files:

./pc-bios/optionrom/linuxboot_dma.bin
./pc-bios/optionrom/linuxboot_dma.raw
./pc-bios/optionrom/linuxboot_dma.img
./pc-bios/optionrom/linuxboot_dma.o
./pc-bios/optionrom/linuxboot_dma.d
./pc-bios/optionrom/linuxboot.bin
./pc-bios/optionrom/linuxboot.raw
./pc-bios/optionrom/linuxboot.img
./pc-bios/optionrom/linuxboot.d
./pc-bios/optionrom/linuxboot.o
./docs/system/linuxboot.html

Same with -j5, so hopefully not a broken Makefile dependency
(although this has cropped up over many years, mostly on multiarch
distros where 32 libs are available but might need to be separately
installed).

Looking at my verbose log, this part _is_ building 32-bit code to
suit a 486 (below, reformatted re line length) but I've no real idea
why mine builds and yours doesn't.

make[1]: Entering directory
'/tmp/qemu-5.1.0/build/pc-bios/optionrom' cc -E -iquote
/tmp/qemu-5.1.0/tcg/i386 -isystem /tmp/qemu-5.1.0/linux-headers
-isystem /tmp/qemu-5.1.0/build/linux-headers -iquote . -iquote
/tmp/qemu-5.1.0 -iquote /tmp/qemu-5.1.0/accel/tcg -iquote
/tmp/qemu-5.1.0/include -iquote /tmp/qemu-5.1.0/disas/libvixl
-I/tmp/qemu-5.1.0 -MMD -MP -MT multiboot.o -MF ./multiboot.d -c -o -
/tmp/qemu-5.1.0/pc-bios/optionrom/multiboot.S | as -32 -o
multiboot.o cc -E -iquote /tmp/qemu-5.1.0/tcg/i386 -isystem
/tmp/qemu-5.1.0/linux-headers -isystem
/tmp/qemu-5.1.0/build/linux-headers -iquote . -iquote
/tmp/qemu-5.1.0 -iquote /tmp/qemu-5.1.0/accel/tcg -iquote
/tmp/qemu-5.1.0/include -iquote /tmp/qemu-5.1.0/disas/libvixl
-I/tmp/qemu-5.1.0 -MMD -MP -MT linuxboot.o -MF ./linuxboot.d -c -o -
/tmp/qemu-5.1.0/pc-bios/optionrom/linuxboot.S | as -32 -o
linuxboot.o cc -iquote /tmp/qemu-5.1.0/build/. -iquote . -iquote
/tmp/qemu-5.1.0/tcg/i386 -isystem /tmp/qemu-5.1.0/linux-headers
-isystem /tmp/qemu-5.1.0/build/linux-headers -iquote . -iquote
/tmp/qemu-5.1.0 -iquote /tmp/qemu-5.1.0/accel/tcg -iquote
/tmp/qemu-5.1.0/include -iquote /tmp/qemu-5.1.0/disas/libvixl
-I/tmp/qemu-5.1.0 -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -Wold-style-declaration
-Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs
-Wendif-labels -Wexpansion-to-defined -Wno-missing-include-dirs
-Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding
-fno-stack-protector   -m16   -Wa,-32 -MMD -MP -MT linuxboot_dma.o
-MF ./linuxboot_dma.d -O2 -g -march=i486  -c -o linuxboot_dma.o
/tmp/qemu-5.1.0/pc-bios/optionrom/linuxboot_dma.c

The only logical explanation is that my build has __x86_64__ defined
and yours doesn't.  But I cannot see any reason how that might
happen.  In configure's output I had

host CPU          x86_64
target list       x86_64-softmmu

But looking again, the 3 lines that you commented out are followed
by alternatives for systems where __x86_64__ IS defined (normal,
i.e. LP64 using stubs-64.h, or x32 for that past attempt to gain the
extra x86_64 opcodes but in small memory).

#if !defined __x86_64__
# include <gnu/stubs-32.h>
#endif
#if defined __x86_64__ && defined __LP64__
# include <gnu/stubs-64.h>
#endif
#if defined __x86_64__ && defined __ILP32__
# include <gnu/stubs-x32.h>
#endif

I can't see any reason how this can happen, but clearly it did.
Maybe someone else has a suggestion ?

Looking at my own logs, the only packages I've installed which
mention 'gnu/stubs*' in their logs are glibc from LFS (obviously),
and strace where configure looked for gnu/stubs-32.h and
gnu/stubs-x32.h, noted they weren't there, and reported it was
creating empty local files by those names.

It seems this is only likely to be an issue in qemu.

ĸen
-- 
Internal error in fortune program:
    fnum=2987  n=45  flag=1  goose_level=-232323
Please write down these values and notify fortune program admin.
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to