Hi, I was trying to compile gcc-4.7 snapshots on Debian GNU/Linux wheezy (testing/unstable) i386, and found problem releated to multiarch.
This is my configure and compile script: unset LC_ALL unset LANG export TEMP=/scratch/baryluk/gcc/tmp export TMP=/scratch/baryluk/gcc/tmp export TMPDIR=/scratch/baryluk/gcc/tmp export CPPFLAGS="-I/usr/include/i386-linux-gnu" cd / rm -rf /scratch/baryluk/gcc/obiekty mkdir /scratch/baryluk/gcc/obiekty || exit 1 cd /scratch/baryluk/gcc/obiekty /scratch/baryluk/gcc/gcc-4.7-20120211/configure \ --enable-shared \ --enable-multiarch \ --enable-nls \ --enable-linker-build-id \ --enable-checking=yes \ --enable-stage1-checking=all \ --enable-languages=c,c++,objc,go,fortran,ada,java \ --with-fpmath=sse \ --with-build-config=bootstrap-lto \ --enable-lto \ --enable-libssp \ --enable-libada \ --enable-objc-gc \ --enable-plugin \ --enable-gold \ --with-system-zlib \ --without-included-gettext \ --enable-threads=posix \ --enable-cloog-backend \ --prefix=/usr/local --program-suffix=-4.7 ... ... make bootstrap ... ... And this is a error I got after 10 minutes of compilation make[4]: Leaving directory `/scratch/baryluk/gcc/obiekty/i686-pc-linux-gnu/libgcc' DEFINES='' HEADERS='/scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/config/i386/value-unwind.h' \ /scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/mkheader.sh > tmp-libgcc_tm.h /bin/bash /scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h echo timestamp > libgcc_tm.stamp /scratch/baryluk/gcc/obiekty/./gcc/xgcc -B/scratch/baryluk/gcc/obiekty/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../.././gcc -I/scratch/baryluk/gcc/gcc-4.7-20120211/libgcc -I/scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/. -I/scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/../gcc -I/scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/../include -I/scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c /scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS In file included from /usr/include/features.h:388:0, from /usr/include/stdio.h:28, from /scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/../gcc/tsystem.h:88, from /scratch/baryluk/gcc/gcc-4.7-20120211/libgcc/libgcc2.c:29: /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated. make[3]: *** [_muldi3.o] Error 1 make[3]: Leaving directory `/scratch/baryluk/gcc/obiekty/i686-pc-linux-gnu/libgcc' make[2]: *** [all-stage1-target-libgcc] Error 2 make[2]: Leaving directory `/scratch/baryluk/gcc/obiekty' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/scratch/baryluk/gcc/obiekty' make: *** [bootstrap] Error 2 Exit 2 There is a file we are searching in the /usr/include/i386-linux-gnu/gnu/stubs-32.h but it is not used by bootstrap. I was trying to use CPPFLAGS, but it doesn't help. I can create few symlinks, but this is far from nice solution. I really like Debian's approach for multiarch, because it addressess not only 32/64-bit split, but many other problems. I understand this however leads to some problems, just like one I encountered here, but It would be good to have some way to specify transition to Debian's multiarch. Precise overview of directories to be used by GCC and other stuff can be found at http://wiki.debian.org/Multiarch/LibraryPathOverview Generally there is no multiarch separation for header files, because most header files are portable, and works without modification on bi-arch (32/64), and often even on all platforms (if nacasarry header files have own conditional compilation mechanisms for portability). However, few header files needs special treatment. This is full list on my computer $ /usr/include/i386-linux-gnu> ls -R .: asm bits ffi.h ffitarget.h fpu_control.h gnu jconfig.h sys ./asm: a.out.h ioctl.h mtrr.h setup.h termios.h auxvec.h ioctls.h param.h shmbuf.h types.h bitsperlong.h ipcbuf.h poll.h sigcontext32.h ucontext.h boot.h ist.h posix_types_32.h sigcontext.h unistd_32.h bootparam.h kvm.h posix_types_64.h siginfo.h unistd_64.h byteorder.h kvm_para.h posix_types.h signal.h unistd.h debugreg.h ldt.h prctl.h socket.h vm86.h e820.h mce.h processor-flags.h sockios.h vsyscall.h errno.h mman.h ptrace-abi.h statfs.h fcntl.h msgbuf.h ptrace.h stat.h hw_breakpoint.h msr.h resource.h swab.h hyperv.h msr-index.h sembuf.h termbits.h ./bits: a.out.h ioctls.h posix2_lim.h socket2.h syslog-path.h byteswap.h ioctl-types.h posix_opt.h socket.h termios.h cmathcalls.h ipc.h predefs.h stab.def time.h confname.h ipctypes.h printf-ldbl.h statfs.h types.h dirent.h libc-lock.h pthreadtypes.h stat.h typesizes.h dlfcn.h libio-ldbl.h resource.h statvfs.h uio.h elfclass.h link.h sched.h stdio2.h unistd.h endian.h locale.h select.h stdio.h ustat.h environments.h local_lim.h semaphore.h stdio-ldbl.h utmp.h errno.h mathcalls.h sem.h stdio_lim.h utmpx.h error.h mathdef.h setjmp2.h stdio-lock.h utsname.h fcntl2.h mathinline.h setjmp.h stdlib.h waitflags.h fcntl.h mman.h shm.h stdlib-ldbl.h waitstatus.h fenv.h monetary-ldbl.h sigaction.h string2.h wchar2.h fenvinline.h mqueue2.h sigcontext.h string3.h wchar.h huge_valf.h mqueue.h siginfo.h string.h wchar-ldbl.h huge_val.h msq.h signum.h stropts.h wordsize.h huge_vall.h nan.h sigset.h syscall.h xopen_lim.h inf.h netdb.h sigstack.h sys_errlist.h xtitypes.h in.h poll.h sigthread.h syslog.h initspin.h posix1_lim.h sockaddr.h syslog-ldbl.h ./gnu: libc-version.h lib-names.h option-groups.h stubs-32.h stubs.h ./sys: acct.h gmon_out.h perm.h sem.h sysctl.h uio.h bitypes.h inotify.h personality.h sendfile.h sysinfo.h ultrasound.h cdefs.h ioctl.h poll.h shm.h syslog.h un.h debugreg.h io.h prctl.h signalfd.h sysmacros.h unistd.h dir.h ipc.h procfs.h signal.h termios.h user.h elf.h kdaemon.h profil.h socket.h timeb.h ustat.h epoll.h kd.h ptrace.h socketvar.h time.h utsname.h errno.h klog.h queue.h soundcard.h timerfd.h vfs.h eventfd.h mman.h quota.h statfs.h times.h vlimit.h fanotify.h mount.h raw.h stat.h timex.h vm86.h fcntl.h msg.h reboot.h statvfs.h ttychars.h vt.h file.h mtio.h reg.h stropts.h ttydefaults.h vtimes.h fsuid.h param.h resource.h swap.h types.h wait.h gmon.h pci.h select.h syscall.h ucontext.h xattr.h In fact, when checking /usr/include/gnu/ directory I found it contains stubs.h and stubs-64.h, and stubs.h is automatically including proper file #include <bits/wordsize.h> #if __WORDSIZE == 32 # include <gnu/stubs-32.h> #elif __WORDSIZE == 64 # include <gnu/stubs-64.h> #else # error "unexpected value for __WORDSIZE macro" #endif However, for some reason stubs-32.h is not present directly in /usr/include/gnu directory. For Debian specific part this is a packages responsible for various files libc6-dev: /usr/include/i386-linux-gnu/gnu/stubs-32.h libc6-dev: /usr/include/i386-linux-gnu/gnu/stubs.h libc6-dev-amd64: /usr/include/gnu/stubs.h libc6-dev-amd64: /usr/include/gnu/stubs-64.h (Remember: I'm on 32-bit machine, 32-bit kernel, and 32-bit OS) As I understand libc6-dev-amd64 package will be removed from Debian, once multiarch specification will be implemnted fully in most of archive. It will be available just as libc6-dev:amd64, and will install files into /usr/include/x86_64-linux-gnu/, symetrically to libc6-dev:i386. I found essential support for multiarch in this patch for gcc-4.6 http://anonscm.debian.org/viewvc/gcccvs/branches/sid/gcc-4.6/debian/patches/gcc-multiarch.diff?revision=5847&view=markup It would be nice to have this working out of the box. Regards, Witek PS. Please keep me in CC, as I'm not subscribed to mailing list. -- Witold Baryluk