This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: build tool chain with i686-elf as the target


Hu Jia Yi wrote:
Hello.
I have been trying to build a cross tool chain for my hobby OS with i686-elf as the target.
I am using Ubuntu-7.10 gutsy, IA32 architecture.

I've successfully built binutils-2.18 and gcc-4.2.4 with the following commands.

cd $BUILD/$BINUTILS && rm -rf *
$SRC/$BINUTILS/configure --target=$TARGET --prefix=$CROSSTOOLS --disable-nls
make all install

#build a minimal cross-compiler first
cd $BUILD/$GCC && rm -rf *
$SRC/$GCC/configure --target=$TARGET --prefix=$CROSSTOOLS --with-gnu-as --with-gnu-ld --disable-nls --without-headers --enable-languages=c
make all-gcc make install-gcc


I don't know how to continue with newlib.
I browsed newlib-1.16.0/newlib/libc/sys, I couldn't find any folder related with i[3-7]86 or x86. This means I have no place to put my crt0.S
and syscalls.c. Without clues, I decided to ignore this first and built newlib bravely...


Any new crt0.S and syscalls.c you want to add belong in libgloss under the i386 directory. You can look at mn10300 and other directories to see how they handle multiple bsp's. Typically you create a new ld script and add statements in the Makefile.in to build a new library based on your code (crt0.S, syscalls.c, etc). The ld script refers to your library and the newlib libraries so the end-user just specifies -Tyourldscript.ld on the compile/link and everything is handled.
cd $BUILD/$NEWLIB && rm -rf *
$SRC/$NEWLIB/configure --target=$TARGET --prefix=$CROSSTOOLS
make all
make install

To my surprise, it passed. I went on with the full cross-compiler building.
#build a full cross-compiler with the support of newlib
cd $BUILD/$GCC && rm -rf *
$SRC/$GCC/configure --target=$TARGET --prefix=$CROSSTOOLS --with-gnu-as --with-gnu-ld --with-headers="$CROSSTOOLS/$TARGET/include" --disable-nls --enable-languages=c
make all-gcc make install-gcc


I failed at this step with the errors below: /home/test/myos/build/gcc-4.2.4/./gcc/include/time.h:12: error: conflicting types for 'clock_t'
/home/test/myos/bin/cross/i686-elf/include/sys/types.h:104: error: previous declaration of 'clock_t' was here


What should I do to make this cross tool chain work?


You should tell gcc that you are using newlib headers via the --with-newlib clause. You should also link newlib and libgloss as sibling directories to the gcc directory.


-- Jeff J.
Best regards,
Hu Jia Yi



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]