Reputation: 1458
I am building a 32-bit LFS system, using this tutorial:
https://www.linuxfromscratch.org/~thomas/multilib/index.html
The build is performed on a 64-bit system. As it will run on a 32-bit system, I also need to build all binaries for 32-bit (i place them in a separate directory, so that they don't overwrite the 64-bit ones)
I have built 32-bit gmp, mpc, and mpfr (because gcc requires them) without any problems. Also, no problems building the 64-bit gcc.
However, I have a problem, building the 32-bit gcc-10.2.0 (I remove the build directory after the 64-bit build).
Using the following configuration: (I need -m32 both in CC and CFLAGS, otherwise make fails because it tries to link 64-bit .o files in a 32-bit library, maybe some internal configure scripts do not take the "-m32" option)
CC="gcc -m32" CXX="g++ -m32" CFLAGS="-m32" CXXLAGS="-m32" LDFLAGS="-m32" AR="ar" AS="as" \
../configure --prefix=/usr \
--enable-languages=c,c++ \
--disable-bootstrap \
--libdir=/usr/lib32 \
--build=x86_64-lfs-linux-gnu \
--enable-multilib \
--with-multilib-list=m32,m64 \
--host=i686-pc-linux-gnu \
--with-system-zlib
during make, I get the following error:
cc -g -O2 -m32 -O2 -g -O2 -m32 -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag -Wold-style-definition -isystem ./include -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -mlong-double-80 -DUSE_ELF_SYMVER -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include -I../../../libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -Wno-missing-prototypes -Wno-type-limits -o fixtfti.o -MT fixtfti.o -MD -MP -MF fixtfti.dep -c ../../../libgcc/soft-fp/fixtfti.c -fvisibility=hidden -DHIDE_EXPORTS
../../../libgcc/soft-fp/fixtfti.c:33:1: error: unknown type name 'TItype'; did you mean 'TFtype'?
33 | TItype
| ^~~~~~
| TFtype
../../../libgcc/soft-fp/fixtfti.c: In function '__fixtfti':
../../../libgcc/soft-fp/fixtfti.c:38:3: error: unknown type name 'UTItype'; did you mean 'UDItype'?
TItype and UDItype are not defined. As I found, they are defined for 64-bit configurations (config/i386/64, config/ia64, etc..)
but I am building a 32-bit gcc and they are not defined but are used.
Any ideas on how to resolve this?
Upvotes: 2
Views: 605
Reputation: 1458
The solution was to set also the CC_FOR_TARGET and CXX_FOR_TARGET environment variables when configuring GCC. I thought that CC and CXX were enough.
CC="gcc -m32" CC_FOR_TARGET="gcc -m32" CXX="gcc -m32" CXX_FOR_TARGET="gcc -m32" AR="ar"
Upvotes: 2