-   Linux - Embedded & Single-board computer (
-   -   cross compiling eglibc with Linaro toolchain (

ammayappan 01-17-2012 04:58 AM

cross compiling eglibc with Linaro toolchain
I am trying to cross-compile Eglibc library with Linaro tool chain(which is a pre built tool chain for arm, running on ubuntu).My aim is to cross-compile the library and add it with the tool-chain.

I referred to the link README. (README.cross-compiling of the libc) and did the following.

I thought that binutils is not required as the tool chain itself contains the loader, assembler etc.(which are the most important in the binutils).So i skipped that step.

I did the below steps as in the above link.
1) copied the Linux Kernel Headers
2) EGLIBC Headers and Preliminary Objects

2.1) configuring the Eglibc headers by the below steps.

appan@oplt$ ~/cross_compile_eglibc/ppc/obj/eglibc-headers$ BUILD_CC=gcc CC=/home/appan/cross_compile_eglibc/ppc/tools/bin/arm-linux-gnueabi-gcc CXX=/home/appan/cross_compile_eglibc/ppc/tools/bin/arm-linux-gnueabi-cpp AR=/home/appan/cross_compile_eglibc/ppc/tools/bin/arm-linux-gnueabi-ar RANLIB=/home/appaan/cross_compile_eglibc/ppc/tools/bin/arm-linux-gnueabi-ranlib /home/appan/cross_compile_eglibc/src/libc/configure --prefix=/home/appan/CC_EGLIBC --with-headers=/home/appan/cross_compile_eglibc/ppc/sysroot/usr/include/ --build=i686-pc-linux-gnu --host=arm-unknown-linux-gnu --enable-add-ons --with-tls --with-__thread

2.2) compilation

make install-headers install_root=$sysroot install-bootstrap-headers=yes

But following is the error i get.

> /home/appan/cross_compile_eglibc/ppc/obj/eglibc-headers/Versions.v.iT
In file included from <stdin>:1:0:
ports/sysdeps/arm/nptl/tls.h:48:3: error: #error "TLS support is required."
make[1]: *** No rule to make target `headers_install'. Stop.
make[1]: Leaving directory `/home/appan/cross_compile_eglibc/src/libc'
make: *** [headers_install] Error 2

I tried googling, but i din get the solution for this..
please provide me with any suggestions..

thanks and regards

akgraner 01-17-2012 06:38 AM

Hi appan,

I've sent your question and link to this post to Linaro developers. Someone from the Linaro toochain team should be answering your inquiry soon. I've asked them to reply to you on this thread as well.


michaelh.linaro 01-17-2012 03:28 PM

Hi appan,

Here's the command line we use in our automatic test builds:


../configure --host=arm-linux-gnueabi --prefix=$PWD/install --without-cvs \
--enable-add-ons=libidn,ports,nptl --enable-profile --without-selinux --enable-stackguard-randomization \
--enable-kernel=2.6.15 --with-headers=/usr/arm-linux-gnueabi/include

This is based on the standard Ubuntu/Debian configuration and uses the binary compiler, assembler, linker, and headers that come with the packages you've already installed.

If you have unexpected build problems, try adding a `-fno-stack-protector -U_FORTIFY_SOURCE` to the cflags. Some core packages like EGLIBC don't like how Ubuntu turns on the stack protector and fortify options.

You can use the Ubuntu source packages as a eference for how to configure a package with a good set of options. For example, to see how Ubuntu configures EGLIBC you can run:

* apt-get source eglibc
* cd eglibc-...
* dpkg-buildpackage -us -uc -d -b

...and look for the 'configure' line in the output. The arguments mean don't sign the source or changes (-us, -uc), ignore missing build dependencies (-d as we're only interested in the configure line), and build a binary (-b).

If you want to see what's installed and where the files ended up, try:

* dpkg -l *armel* *gnueabi*
* dpkg -L package-name

I used this to find the existing Linux headers. The dpkg -l search showed that linux-libc-dev-armel was installed, and dpkg -L linux-libc-dev-armel showed that they were installed in /usr/arm-linux-gnueabi/include.

BTW, why are you compiling EGLIBC? It's a pretty core package and not often changed.

ammayappan 01-18-2012 12:06 AM

hi akgraner,
Thanks a lot for your help..:)
BTW, what is the mail-listing for linaro, so that i can contact them directly..

thanks and regards

knudfl 01-19-2012 03:45 AM


... linaro, so that i can contact them ...

@ michaelh.linaro = "Michael Hope at Linaro" is your contact. Post #3.

So you can actually continue the Linaro discussion here in this thread.


ammayappan 01-23-2012 01:27 AM

Hello michael,
Thanks for your suggestions.I haven't tried your suggestions yet.I have some basic doubts regarding prerequisites.Please bear with me if it is too silly.

1) The prerequisites are the Binutils,kernel Headers,GCC. As per my understanding, Binutils are required to be compiled for the target architecture, only if u are generating the tool chain from the scratch.But in my case where i am using the Linaro Cross Compiler, i don't need to cross compile the Binutils.(as they are already present with the downloaded Linaro tool chain.Is this statement right? please throw some light on this.

2) Kernel Headers are required i guess.But not getting why and how it is used.

3) For what is the GCC required if we are going to cross compile with our Linaro cross compiler?

Please provide some suggestions/information on this.

thanks and regards

ammayappan 01-25-2012 01:18 AM

hi all,
The problem got resolved and compiled eglibc using Linaro tool chain.There was some libraries that were missing in my set up of tool chain.Downloaded the tool chain on Ubuntu and compiled Eglibc using the steps in
Before doing configure just do

$cp -r eglibc/ports eglibc/libc
configure..(as in the link above)
make install

thanks for the help..

thanks and regards

Mayurapriyan 02-07-2012 01:40 AM

I am facing an issue with cross compiling Eglibc and uClibc with Linaro tool chain.I dont know whether it is my error or as somebody suggested,an issue with the tool chain.Guide me experts.

I have downloaded linaro tool chain on ubuntu box by
$ sudo apt-get install gcc-arm-linux-gnueabi

I wanted to have Eglibc and uClibc for ARM, so that I can compile my application and link against them.

So i followed the below steps:

i)Downloaded Eglibc 2.15.90.
ii)Cross compiled for ARM using the below commands:

Followed some steps as said above in this forum.

$ BUILD_CC=gcc CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-cpp AR=arm-linux-gnueabi-ar RANLIB=arm-linux-gnueabi-ranlib /home/user/EGLIBC/eglibc/libc/configure –prefix=/home/user/EGLIBC/eglibc/INSTALL –with-headers=/usr/arm-linux-gnueabi/include –build=i686-linux-gnu –host=arm-linux-gnueabi –enable-kernel=2.6.15–enable-add-ons=libidn,ports,nptl –with-tls –with-__thread

$ make
$ sudo make install

By the above steps got in the prefix directory.

iii)I checked the library by linking against an example application both statically and dynamically.Below is the steps i followed.

$ arm-linux-gnueabi-gcc -L/home/user/EGLIBC/eglibc/INSTALL/lib test.c -lc -o dynamic_test

Into the pandaboard i copied the neccessary libraries and app binary.

$ ./dynamic_test
Hello world!!! //It works

$ arm-linux-gnueabi-gcc -static -L/home/user/EGLIBC/eglibc/INSTALL/lib test.c -lc -o static_test

Into the pandaboard i copied the static app binary.

$ ./static_test
Illegal instruction //It doesn’t work

The size of the static application binary is only 2.7Mb and the size of the Eglibc static library libc.a is 15.2Mb.

Even i tried the static compilation of application using the default present in the Linaro tool chain.
That also gave the same illegal instruction.


i)Downloaded uClibc
ii)In the menuconfig,chose some basic options
iii)make CROSS=arm-linux-gnueabi-
iv)make PREFIX=/home/user/uClibc- is the library produced.

v)I checked the library by linking against an example application both statically and dynamically.Below is the steps i followed

$ export LD_LIBRARY_PATH=/home/nishanthv/uClibc-

$ arm-linux-gnueabi-gcc test.c -o dynamic_test
$ file dynamic_test
dynamic_test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
$ objdump -x dynamic_test | grep NEEDED

It is not taking the that i am including via LD_LIBRARY_PATH. It is taking from the default location of the Linaro tool chain.

$ arm-linux-gnueabi-gcc -static test.c -o static_test

If i run it on pandaboard it shows Illegal Instruction

The thing is only Eglibc/dynamic pair works in the Eglibc,uClibc Dynamic,static pair.

Please give me your suggestions on it.

thanks and regards

All times are GMT -5. The time now is 04:36 AM.