LFS based distro and quasi-cross compiling.

Dan Nicholson dbn.lists at gmail.com
Thu Sep 20 08:32:11 PDT 2007


On 9/20/07, Joshua Shriver <jshriver at gmail.com> wrote:
>
>      My main questions is, how do you go about compiling for a general
> CPU so it can be portable? My desktop machine is a P4 and since I dont
> want the binaries to be P4 specific, figured I'd have to do something
> like -arch=386 etc. What do other distributions use so they work on
> the average x86 based machine while not being too out of date. Figured
> 386 mode would be to out of date, given 90+% of all x86 machines will
> be at least P2, P3 or better.  Perhaps -arch=686?
>
>    Once the type is found out how do you apply this toward all
> compilations? export CC=-arch=686?

I haven't actually looked at this much, but you should be fine to
build binaries for x86 out of the box. It looks like (in gcc-4.1.2,
anyway) you'll get i386 arch binaries by default. Then, if the host
building gcc is an i686, it will default to -mcpu=pentiumpro. There
are configure switches to change the target defaults for gcc, but I
wouldn't play with them too much as they can bork your glibc. However,
you should see the GCC install manual if you're interested:

http://gcc.gnu.org/install/configure.html

With gcc-4.2, there is a new "generic" cpu type for x86 that most
distros are using, I think.

http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options

--
Dan



More information about the lfs-support mailing list