But then the i386 cross-compiler isn't used:
Yeah, that was intentional. In theory a softmmu target is freestanding and does not need anything beyond the compiler install, so configure defaults to the native compiler, which is biarch. That however assumes that the compiler install includes the libgcc for both architectures.
Does that mean that Ubuntu installs GCC without a 32-bit libgcc.a?
Paolo
$ cat tests/tcg/config-i386-softmmu.mak
# Automatically generated by configure - do not modify
TARGET_NAME=i386
BUILD_STATIC=
EXTRA_CFLAGS=-m32
CC=cc
CCAS=cc
AR=ar
AS=as
LD=ld
NM=nm
OBJCOPY=objcopy
RANLIB=ranlib
STRIP=strip
QEMU=/home/rth/qemu-publish/bld/qemu-system-i386
leading to failure:
cc -nostdlib -ggdb -O0 -isystem /home/rth/qemu-publish/src/tests/tcg/minilib -m32
-ffreestanding /home/rth/qemu-publish/src/tests/tcg/multiarch/system/hello.c -o hello
-Wl,-T/home/rth/qemu-publish/src/tests/tcg/i386/system/kernel.ld -Wl,-melf_i386 -static
-nostdlib boot.o printf.o -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a when
searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/home/rth/qemu-publish/src/tests/tcg/i386/Makefile.softmmu-target:32: hello]
Error 1
r~