On Wed, 2004-05-19 at 23:02, Marcus Furlong wrote: > Hi, > > I've seen conflicting information about what configure flags to use when > cross-compiling for a lower x86 architecture on an x86. Yes, because there exist different and partially inconsistent conventions and .. because many packages are not ready for cross-compilation. > For example > cross-compiling for a i486 on an i686. Not even sure if this should be > called crosscompiling? It's a grey zone :) > For most packages you just need to set CFLAGS or similar to include -march > for the lower platform, but for some packages setting --host= and --target= > is needed, especially gcc, glibc and binutils. > > see > http://www.linuxfromscratch.org/hints/downloads/files/crosscompiling-x86.txt > for examples. Well, this document is questionable in details. In particular, it generalizes too much. In most cases you will have to inspect a package's configure script thoroughly, before trying to cross-build it. > This gives a warning message at the start of each compilation because a > crosscompiler is not detected, and I was wondering if --build= is the > appropriate arg to use instead (seeing as we're already probably already > lying about the build architecture via uname). > > e.g. building for an i486 on a i686 > is the following correct? This question can't be answered in general. It depends on the package: * build .. the system you are building on. * host .. the system the binaries your are building are supposed to run on * target .. the system the binaries running on "host" are targeting. > ./configure --build=i486-pc-linux-gnu Normally you don't want to set --build. With autoconf-2.5x generated configure scripts, to trigger cross-compilation (Which in autoconf terms means to apply a specialized cross-toolchain), you almost always will want to use configure --host=i486-pc-linux-gnu However, many packages, esp. those using autoconf-2.13 use all kinds of "weird" custom conventions on processing "host/build/target", some even expect you to provide special settings on environment variables etc. > instead of > > ./configure --host=i486-pc-linux-gnu --target=i486-pc-linux-gnu Cf. above. For complex packages which are prepared for Canadian Cross Compilation (gcc/binutils/gdb/glibc etc), this can be right. In most cases, configure --target=i486-pc-linux-gnu will be what you probably want (This is what gcc, binutils, gdb, newlib expect. I am not familiar enough with glibc to comment on it). [You are building packages on an i686 (build), which shall contain binaries to run on an i686 (host), which shall generate code for i486s (target).] Ralf