From mboxrd@z Thu Jan 1 00:00:00 1970 From: gmate.amit@gmail.com (amit mehta) Date: Fri, 5 Aug 2011 10:44:38 +0530 Subject: Need help: GCC cross compiler and OS/platform dependency Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org This is not a Linux kernel query, rather a generic OS related information that i seek. I was going through the manpages of gcc and if you go further down, you'll find infomation on "-b" flag. Quoting from gcc man page: " -b machine The argument machine specifies the target machine for compilation. The value to use for machine is the same as was specified as the machine type when configuring GCC as a cross-compiler. For example, if a cross-compiler was configured with configure arm-elf, meaning to compile for an arm processor with elf binaries, then you would specify -b arm-elf to run that cross compiler. Because there are other options beginning with -b, the configuration must contain a hyphen. " So what i understood is that on my x86_64 bit machine, gcc -b arm-elf will not work, instead, you should have something like this: i586-elf-gcc , which will produce an object code which can run on i586 platform. (Please correct if i'm wrong). I dig little further by trying to build gcc cross compiler for x86(32 bit) target for educational purpose by following the instructions provided here: http://wiki.osdev.org/GCC_Cross-Compiler Though I was able to build the gcc(i586-elf-gcc), I haven't been able to build C library and the C runtime magic yet, partly due to the build failure and mostly due to incognizance on the details of these pieces working together. hence please throw in some light on how these different pieces work together. <<>> goon:/usr/local/cross/bin # ./i586-elf-gcc -v Using built-in specs. COLLECT_GCC=./i586-elf-gcc COLLECT_LTO_WRAPPER=/usr/local/cross/libexec/gcc/i586-elf/4.6.0/lto-wrapper Target: i586-elf Configured with: ../gcc-4.6.0/configure --target=i586-elf --prefix=/usr/local/cross --disable-n\ ls --enable-languages=c --without-headers Thread model: single gcc version 4.6.0 (GCC) <<>> <<>> goon:/usr/src/build-gcc # make all-target-libgcc checking for i586-elf-gcc... /usr/src/build-gcc/./gcc/xgcc -B/usr/src/build-gcc/./gcc/ -B/usr/local/cross/i586-elf/bin/ -B/usr/local/cross/i586-elf/lib/ -isystem /usr/local/cross/i586-elf/include -isystem /usr/local/cross/i586-elf/sys-include checking for suffix of object files... configure: error: in `/usr/src/build-gcc/i586-elf/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make: *** [configure-target-libgcc] Error 1 goon:/usr/src/build-gcc # grep -i error config.log | /* Override any GCC internal prototype to avoid an error. conftest.c:10:19: error: ppl_c.h: No such file or directory conftest.c:16: error: 'choke' undeclared (first use in this function) conftest.c:16: error: (Each undeclared identifier is reported only once conftest.c:16: error: for each function it appears in.) conftest.c:16: error: expected ';' before 'me' stage2_werror_flag='' <<>> -Amit