LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-05-2013, 09:01 AM   #1
littlebigman
Member
 
Registered: Aug 2008
Posts: 448

Rep: Reputation: 32
Question Cross-compiling applications?


Hello

I checked the Documentation section on the Plug Computer site, but didn't find how to set up a cross-compiler on a PC running Linux, and compile an application for the SheevaPlug (armv5tel processor: Feroceon 88FR131 rev 1 (v5l)).

After upgrading the SheevaPlug from its stock Ubuntu 9.04 to Debian 6, I noticed that the latest release of Nginx is 0.7.67, while support for the uwsgi protocol requires release 0.8.40 or newer.

Is there a good tutorial on how to cross-compile on Linux for the SheevaPlug?

Thank you.
 
Old 04-05-2013, 08:51 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Before you start cross compiling, do you have a cross compiler (or, more accurately, a cross toolchain)? There are probably vendor supplied cross toolchains for the SheevaPlug; I'll let you explore that. Armed with enough knowledge of your target architecture, you can build your own. I like crosstool-NG for that.
Once installed, most applications that use the common 'configure' procedure allow you the choose the cross target architecture as a configure option; typically
Code:
#
PATH=$PATH:/the/path/to/your/cross/toolchain/binaries

#
#  One cross toolchain I use has binaries named like 'arm-unknown-linux-gnueabi-gcc'
#  The following will coerce the Makefile to have to appropriate prefix for all of the tools.
./configure --host=arm-unknown-linux-gnueabi
--- rod.
 
Old 04-11-2013, 06:39 AM   #3
littlebigman
Member
 
Registered: Aug 2008
Posts: 448

Original Poster
Rep: Reputation: 32
Thanks for the infos. The ARM architecture does seem to be complicated enough that a lot of people do need to build their own toolchain.

However, before I invest time in this, Marvell provides a binary toolchain: "Host SW Support Package For Linux".

After unzipping the file, I get two BZ2 files which untar into two directories: gcc/ and rootfsv1.0/, respectively:
Code:
~/LinuxHost# ll gcc
drwxr-xr-x  6 fred fred 4096 Feb 26  2008 arm-none-linux-gnueabi/
drwxr-xr-x  2 fred fred 4096 Feb 26  2008 bin/
drwxr-xr-x  3 fred fred 4096 Feb 26  2008 distributed/
drwxr-xr-x  2 fred fred 4096 Feb 26  2008 include/
drwxr-xr-x  2 fred fred 4096 Feb 26  2008 info/
drwxr-xr-x  3 fred fred 4096 Feb 26  2008 lib/
drwxr-xr-x  3 fred fred 4096 Feb 26  2008 libexec/
drwxr-xr-x  4 fred fred 4096 Feb 26  2008 man/
drwxr-xr-x  8 fred fred 4096 Feb 26  2008 share/

~/LinuxHost# ll rootfsv1.0/
drwxr-xr-x  2 root root  4096 Feb 26  2008 bin/
drwxr-xr-x  4 root root 36864 Feb 26  2008 dev/
drwxr-xr-x  3 root root  4096 Feb 26  2008 etc/
drwxr-xr-x  2 root root  4096 Feb 26  2008 lib/
lrwxrwxrwx  1 root root    11 Feb 25  2009 linuxrc -> bin/busybox*
drwxr-xr-x  2 root root  4096 Feb 25  2009 mnt/
drwxr-xr-x  2 root root  4096 Feb 26  2008 proc/
drwxr-xr-x  2 root root  4096 Feb 26  2008 sbin/
drwxr-xr-x 10 root root  4096 Feb 26  2008 usr/
I have a few more questions:
1. Running "gcc/bin/arm-none-linux-gnueabi-gcc -o hello hello.c" did compile a shared "Hello, world!" binary that I could run succesfuly on the SheevaPlug: How did the compiler know where to find the include + library?

Code:
~/LinuxHost/gcc/bin# file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped

SheevaPlug/tmp# ldd hello
        libc.so.6 => /lib/libc.so.6 (0x40004000)
        /lib/ld-linux.so.3 (0x2a000000)
Could it be that binaries are hard-linked to find includes + libraries?

2. "file hello" says "for GNU/Linux 2.6.14: Is it because the toolchain was built with that older release of Linux?

3. Why did Marvell provide a rootfs?

4. What should I do to compile real applications? Is it just a matter of editing PATH to include "/home/fred/LinuxHost/gcc" and using the right options in "./configure"?

Thank you.

Last edited by littlebigman; 04-11-2013 at 09:32 AM.
 
Old 04-11-2013, 10:09 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
I think these questions have been answered in a startlingly similar recent thread on LQ.
 
Old 04-12-2013, 07:45 AM   #5
littlebigman
Member
 
Registered: Aug 2008
Posts: 448

Original Poster
Rep: Reputation: 32
Yes, the first question was answered in that other thread :-)

What about the others?

2. "file hello" says "for GNU/Linux 2.6.14: Is it because the toolchain was built with that older release of Linux?

3. Why did Marvell provide a rootfs?
 
Old 04-12-2013, 11:48 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Generally, a toolchain gets built against a particular kernel version. That accounts for the result of the file command, I believe. In systems I've used, file also reports the CPU architecture of the specific executable.
The root filesystem is probably just a skeleton filesystem that is the sysroot for the toolchain, so it can find libraries, header files and ancillary toolchain components. Ideally, the sysroot files exactly match the respective target filesystem.

--- rod.
 
Old 04-15-2013, 12:46 AM   #7
littlebigman
Member
 
Registered: Aug 2008
Posts: 448

Original Poster
Rep: Reputation: 32
Thanks much.
 
  


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
learning cross compiling-compiling library from soruce brianmay27 Linux - Software 1 12-31-2012 05:28 AM
Cross-compiling v/s cross-building kushalkoolwal Programming 3 05-13-2009 05:49 AM
Making cross-environnment applications QueenZ Programming 25 02-13-2009 02:22 PM
Developing cross platform applications Principher Programming 7 08-27-2006 01:35 PM
Cross-platform, the road to Linux applications wyo Linux - Software 9 12-27-2005 09:10 AM


All times are GMT -5. The time now is 06:14 PM.

Main Menu
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