tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Linking error or bug?


From: XVilka Haos of System
Subject: [Tinycc-devel] Linking error or bug?
Date: Mon, 22 Mar 2010 22:56:50 +0300

Hi!
I use this method for generating small and tiny arm toolchain, but after building, if try compile sample program - give error:
arm-eabi-tcc: undefined symbol 'open'
arm-eabi-tcc: undefined symbol 'perror'
and others

Of course they exists in libc.a from linking directory

This is my method:

For compiling some small hacking utility or kernel module you don need
in hole gcc toolkit (more than 60 MB) and hole libc.
So we need for something small and tiny. It can be tiny C compiler (tcc) and dietlibc
If you want to know how i building it - read below:

For example we choose working directory as $HOME/build

Download latest release of tiny C compiler (http://tinycc.org/) from git:

git clone git://repo.or.cz/tinycc.git $HOME/build/tinycc

Download latest release of dietlibc (http://www.fefe.de/dietlibc/) from cvs:

cvs -d :pserver:address@hidden:/cvs -z9 co $HOME/build/dietlibc

After this we need to build tcc:

cd $HOME/build/tinycc
./configure --enable-cross --prefix=$HOME/build/tiny-toolchain
make
make install

So we have this tools in $HOME/build/tiny-toolchain/bin:

arm-eabi-tcc
arm-fpa-ld-tcc
arm-fpa-tcc
arm-vfp-tcc
c67-tcc
i386-win32-tcc
tcc
x86_64-tcc
x86_64-win32-tcc

Add them in enviroment variable PATH for easy executing:

export PATH=$HOME/build/tiny-toolchain/bin:$PATH

But also we need a C library. So make the "target root" directory:

mkdir $HOME/build/tiny-root

Building dietlibc:

cd $HOME/build/dietlibc
make prefix=$HOME/build/tiny-root
make prefix=$HOME/build/tiny-root ARCH=arm CROSS=arm-android-linux-uclibcgnueabi-
make install-headers prefix=$HOME/build/tiny-root ARCH=arm CROSS=arm-android-linux-uclibcgnueabi-
make install-bin prefix=$HOME/build/tiny-root ARCH=arm CROSS=arm-android-linux-uclibcgnueabi-

Prepare "target root" directory:

ln -s $HOME/build/tiny-root/lib-arm $HOME/build/tiny-root/lib
cp $HOME/build/tiny-toolchain/include/* $HOME/build/tiny-root/include/
cp $HOME/build/tiny-toolchain/lib/* $HOME/build/tiny-root/lib/

Also, for kernel development we need for kernel headers:

cd /path/to/you/kernel/sources
make headers_install ARCH=arm INSTALL_HDR_PATH=$HOME/build/tiny-root/include

So, we have all needed libraries and headers in $HOME/build/tiny-root
You can use tcc for compiling your small utilities, for example by this command:

arm-eabi-tcc -static -nostdinc -nostdlib -I$HOME/build/tiny-root/include -L$HOME/build/tiny-root/lib -lc -o example example.c


--
Best regards,
XVilka.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]