Willow Schlanger wrote: > I am trying to build gcc 3.3.3 from the source code under coLinux > (debian). It should work the same as under real Linux. Why such an old version? > I am trying to build it so that it can produce 64-bit code for OS > development (or 32-bit code with the -m32 option). In order to build gcc in the normal way you need an existing functional libc (headers and libs) before starting. > To do this I need a gcc cross-compiler from Linux i686 to Linux ELF x86_64. You also need a working cross assembler, i.e. cross-binutils, before you can build a cross-compiler. > I tried ./configure --target=x86_64-blah-blah and it all works until it > tries to compile a C run-time library file, then it generates an > assembler error. Because you're trying to use a 32 bit gas to assemble 64 bit code, which won't work. > It looks to me like I already need a 64-bit compiler in order to build a > 64-bit compiler, because the C runtime library That is a separate issue. > Now truthfully, if you can tell me what to use in 'configure' -- e.g. > what blah should be (e.g. --target=x86_64-linux-elf), to DISABLE > building the C runtime library I will be greatful. > > That is because for OS development I don't need a 64-bit C runtime > library built in any case. "C runtime library" is not the right word. gcc doesn't provide a C library. It does provide various libraries that run on the target (libgcc, libstdc++, libsupc++, libgfortran, libmudflap, libjava, libada, ...) all of which have a prerequisite of an existing, functioning libc. To build just the compiler and no target libraries, you can use the "all-gcc" make target. This is essentially just a glorified way of stopping the build after gcc is done but before trying to build any target libraries. It won't really accomplish anything different than what you already have now, which is a build that fails at first target library step. The compiler in this state will hardly be functional at all. You might be able to use it to compile simple preprocessed source, but for example gcc generates calls to libgcc for many standard operations like wide integer math, vector ops, exception handling, and so on. So you can't just say "oh I won't be calling any C library functions so I don't need libgcc", because gcc expects to rely on libgcc for many things. > But truthfully, it SHOULD work -- what 'configure' target should I use > in order to make the C runtime library code use the C version not the > 64-bit assembly version? What you seem to be seeking here is a bare-metal target. These are where the target has no operating system and no libc. They are typically just "foo-elf", e.g. m68k-elf, arm-elf, i386-elf, ... I'm not sure if x86_64-elf is a valid target, but you can try it. Generally bare metal targets are small embedded devices, not PCs. If you really are trying to build something that doesn't use anything from linux or glibc then configuring for x86_64-pc-linux (or any other variants/aliases of that target like x86_64-linux, x86_64-unknown-linux, x86_64-pc-linux-gnu, etc.) is wrong. Brian