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 http://www.eglibc.org/archives/patches/msg00078.html 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
make install-headers install_root=$sysroot install-bootstrap-headers=yes
But following is the error i get.
In file included from <stdin>:1:0:
ports/sysdeps/arm/nptl/tls.h:48:3: error: #error "TLS support is required."
make: *** No rule to make target `headers_install'. Stop.
make: 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
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.
Here's the command line we use in our automatic test builds:
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.
Thanks a lot for your help..:)
BTW, what is the mail-listing for linaro, so that i can contact them directly..
thanks and regards
@ michaelh.linaro = "Michael Hope at Linaro" is your contact. Post #3.
So you can actually continue the Linaro discussion here in this thread.
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
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 http://www.eglibc.org/archives/patches/msg00078.html
Before doing configure just do
$cp -r eglibc/ports eglibc/libc
configure..(as in the link above)
thanks for the help..
thanks and regards
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
$ sudo make install
By the above steps got libc.so.6 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.
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.
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 libc.so.6 present in the Linaro tool chain.
That also gave the same illegal instruction.
i)Downloaded uClibc 0.9.32.1
ii)In the menuconfig,chose some basic options
libc.so.0 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-0.9.32.1/install_dir/usr/arm-linux-uclibc/lib:/home/nishanthv/uClibc-0.9.32.1/install_dir/usr/arm-linux-uclibc/usr/lib
$ 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 libc.so.0 that i am including via LD_LIBRARY_PATH. It is taking libc.so.6 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 11:49 AM.|