LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-24-2011, 05:21 PM   #1
drroot
LQ Newbie
 
Registered: Nov 2010
Posts: 9

Rep: Reputation: 0
How to build Cross Compiler Toolchain on Fedora for other Linux distributions?


my Linux: Fedora 14 x64
my gcc: 4.5.1
my Glibc: 2.12.90

target Linux: "Ubuntu 8.04.4 LTS" hardy
target kernel: 2.6.24-29-server x64
target gcc: 4.2.4 target Glibc: 2.7

I need gcc/g++ and fortran.

I Googled and most documents I found are somehow outdated and targeting for ARM, not for other Linux.

Any step by step document will be greatly appreciated.
)

Great THanKs.
 
Old 04-25-2011, 12:18 AM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
A "cross compiler" is for building binaries on one platform/architecture that are intended to execute on a different platform/architecture.

That isn't the case here - one distro (in theory, at least) should be able to run an executable created on a different - but equally recent - distro. All you should need to do is make sure you have the right runtime libraries installed for your particular executable.

SUGGESTION:
1. Try it - you might have absolutely no problem. Or it might just be a matter of installing an additional library or two.

2. Otherwise, your best bet is probably to dual-boot, or create a VM of your "target platform".

IMHO .. PSM
 
Old 04-25-2011, 12:51 AM   #3
John VV
Guru
 
Registered: Aug 2005
Posts: 12,801

Rep: Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704
or just build the program on fedora 14 as a static build and NOT as a "shared" ( default)
 
1 members found this post helpful.
Old 04-25-2011, 01:39 AM   #4
drroot
LQ Newbie
 
Registered: Nov 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by paulsm4 View Post
A "cross compiler" is for building binaries on one platform/architecture that are intended to execute on a different platform/architecture.

That isn't the case here - one distro (in theory, at least) should be able to run an executable created on a different - but equally recent - distro. All you should need to do is make sure you have the right runtime libraries installed for your particular executable.

SUGGESTION:
1. Try it - you might have absolutely no problem. Or it might just be a matter of installing an additional library or two.

2. Otherwise, your best bet is probably to dual-boot, or create a VM of your "target platform".

IMHO .. PSM

When I tried to run the program on Ubuntu, it prompted me with "GLIBC_versions...NOT found".

But I don't have root access to the ubuntu, and thus can't update the whole system.
 
Old 04-25-2011, 02:08 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,536

Rep: Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506
The usual recommended cross-compiler = "crosstool-ng" can also
be configured to compile for x86* http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool

crosstool-ng-1.9.3/config/arch/x86.in : QUOTE :
""select ARCH_SUPPORTS_64 ......
The x86 architecture, as defined by: .....
64-bit (amd64): http://www.amd.com/us-en/Processors/...5_7044,00.html ""
 
Old 04-25-2011, 10:53 AM   #6
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
When I tried to run the program on Ubuntu, it prompted me with "GLIBC_versions...NOT found".

But I don't have root access to the ubuntu, and thus can't update the whole system.
So why the heck didn't you mention this in your original post????

And what makes you think some magic "cross compiler tool chain" will give you different results?

The problem is shared library dependencies.

The problem has little/nothing to do with "distros" (two different distros might work fine; two different versions of the same distro might fail).

The solution is any of:

a) Install the correct shared libraries (as I suggested)
b) Build statically (as John VV suggested)
c) build in a virtual environment (a VM) that exactly matches your target environment
 
Old 04-25-2011, 12:18 PM   #7
orgcandman
Member
 
Registered: May 2002
Location: dracut MA
Distribution: Ubuntu; PNE-LE; LFS (no book)
Posts: 594

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by paulsm4 View Post
And what makes you think some magic "cross compiler tool chain" will give you different results?
it will. A correctly built cross toolchain will have the proper versions of library files, and be able to link against them even though they are not the running system's version (hence, cross). This is why cross tool chains exist.

AFA how to build one for your setup - well... it's called your setup for a reason Best thing I can think for you to do is read about how cross compilers are built and build it yourself, sysroot and all. A lot of work, but you're guaranteed* that it works.

My $.02

(* = that guarantee assumes that you do everything properly)
 
Old 04-25-2011, 01:08 PM   #8
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
An interesting paradox is that building a cross toolchain targeted to the same architecture as the 'build' host has particular challenges. This has been the subject of much discussion on the crosstool-ng mailing list in recent days/weeks. I can't recite the details, but I do also have a similar requirement emerging, and I am watching the discussions with a vested interest.
Crosstool-ng, its author, and a group of developers close to the project seem to be the current best source of information on the subject. As I understand it, the subject matter is still very much uncharted, and there is still plenty of opportunity to contribute your requirements, insights, and experiences.
FWIW, my experience with crosstool-ng was quite unsuccessful on any Redhat-based distro. While crosstool-ng tends to be an early adopter of toolchain components, this is not really part of the Redhat philosophy; even Fedora, when it comes to software development issues. Using Debian as a host for crosstool-ng was much more successful for me, even when the host on which I wanted to run my toolchains were RHEL4 & RHEL5. I was able to accomplish the toolchain build by using a virtual Debian 5 installation hosted on RHEL.

--- rod.

EDIT: BTW, the new home page for crosstool-ng is http://crosstool-ng.org/

Last edited by theNbomr; 04-25-2011 at 01:11 PM.
 
1 members found this post helpful.
Old 04-25-2011, 04:35 PM   #9
John VV
Guru
 
Registered: Aug 2005
Posts: 12,801

Rep: Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704
build static or as i do for the Development tree for The Gimp
gimp -dev very often needs newer versions of things like glib and a newer version of autotools than even "fedora - rawhide" uses


one needs to be VERY ( yes a scream ) VERY CAREFUL when having multiple copy’s of DIFFERENT versions of SYSTEM FILES installed


two or more versions of -- say "glib" can be installed BUT precautions MUST be taken
-- i can NOT express this enough---
one typo and one ONLY could 100% FUBAR the system - to the point of NEVER BOOTING EVER AGAIN !!!!


just point the program you are building to the DIFFERENT versions in a "configure build script"
set the variables there

Now this is a VERY BIG PAIN IN THE @$$ to do so you need to ask your self
do you REALLY want to do that .
 
  


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
Need to build cross compiler tool chain MrUmunhum Linux - Software 4 09-25-2010 06:05 PM
Problem building gcc 4.4.3 cross-compiler on Fedora 12 sdt Fedora 2 03-28-2010 03:14 PM
LXer: Fedora 11 Alpha ships with Windows cross compiler, Gnome 2.26 LXer Syndicated Linux News 0 02-06-2009 02:30 AM
Trouble building a Cross Compiler to use to build a x86_64 kernel. nLEyETn Linux - Software 2 05-08-2007 06:35 PM
Cross compiler build enviroment terp4life2001 Linux - General 1 12-10-2005 11:20 AM


All times are GMT -5. The time now is 09:32 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