LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices



Reply
 
Search this Thread
Old 01-17-2012, 05:58 AM   #1
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Rep: Reputation: Disabled
cross compiling eglibc with Linaro toolchain


Hi,
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

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
appan
 
Old 01-17-2012, 07:38 AM   #2
akgraner
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
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.

Cheers,
akgraner
 
Old 01-17-2012, 04:28 PM   #3
michaelh.linaro
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
Hi appan,

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

Code:
../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.
 
1 members found this post helpful.
Old 01-18-2012, 01:06 AM   #4
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
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
appan
 
Old 01-19-2012, 04:45 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,273

Rep: Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663
Quote:
... 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.

.

Last edited by knudfl; 01-19-2012 at 04:56 AM.
 
Old 01-23-2012, 02:27 AM   #6
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
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
appan
 
Old 01-25-2012, 02:18 AM   #7
ammayappan
LQ Newbie
 
Registered: Sep 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
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 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)
make
make install

thanks for the help..

thanks and regards
appan
 
Old 02-07-2012, 02:40 AM   #8
Mayurapriyan
LQ Newbie
 
Registered: Jan 2012
Posts: 12

Rep: Reputation: Disabled
Hi,
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:
Eglibc:

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 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.

DYNAMIC LINKING:
$ 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

STATIC LINKING:
$ 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 libc.so.6 present in the Linaro tool chain.
That also gave the same illegal instruction.

uClibc:

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

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

DYNAMIC LINKING:
$ 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
NEEDED libc.so.6

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.

STATIC LINKING:
$ 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
mayur

Last edited by Mayurapriyan; 02-07-2012 at 04:23 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cross compiling software for arm with a proprietary toolchain prushik Linux - Software 6 03-17-2011 02:38 PM
cross compiling a driver on fedora12-i686 for the target ppc860 using ELDK toolchain saidi08 Linux - Newbie 1 01-01-2011 10:42 AM
Cross compiling GNU toolchain. pwrichards Linux - Newbie 0 11-30-2007 08:41 AM
How to make cross compilation toolchain for mips architecture kennithwang Linux - Embedded & Single-board computer 3 10-20-2007 09:03 AM
Building cross-compiling toolchain radhapriya Linux - Software 1 06-25-2004 01:01 AM


All times are GMT -5. The time now is 07:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration