LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices

Reply
 
Search this Thread
Old 02-23-2011, 05:57 AM   #1
dejavih
LQ Newbie
 
Registered: Feb 2011
Location: Spain
Posts: 4

Rep: Reputation: 0
Talking Cross compiler building


Hi all!

I'm a student from Spain and I'm trying to build a arm cross-compiler, I've searched on the web but I haven't found anything and I don't get it to work.

I hope that I've selected the correct subforum, if it isn't please move it to the correct subforum.

I've followed the next steps:

1. Install binutils:
./configure --target=$TARGET --prefix=$PREFIX --enable-multilib --disable-werror && make all install
2.Install "little gcc":
./configure --target=$TARGET --prefix=$PREFIX --with-newlib --without-headers --disable-shared --enable-languages=c,c++ --disable-werror --with-gmp-include=/home/javi/CROSS/GMPTILEINTEL/include --with-gmp-lib=/home/javi/CROSS/GMPTILEINTEL/lib --with-mpfr-include=/home/javi/CROSS/MPFRTILEINTEL/include --with-mpfr-lib=/home/javi/CROSS/MPFRTILEINTEL/lib && make all-gcc && make install-gcc
3. Install newlib:
./configure --target=$TARGET --prefix=$PREFIX --enable-multilib --disable-werror && make all && make install
4. Build again gcc("big gcc"):

./configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++ --enable-multilib --with-newlib --disable-werror --with-headers=/home/javi/CROSS/CROSSTOOLTILE/include && make all-gcc && make install-gcc


In the fourth step, if I use "--prefix=$PREFIX" the configure command doesn't work, the prompt gives me an error that I read on the web that I can resolve it changing the --prefix, ok, so I use the same command with another rute in --prefix, i.e:

./configure --target=$TARGET --prefix=/home/javi/workkk --enable-languages=c,c++ --enable-multilib --with-newlib --disable-werror --with-headers=/home/javi/CROSS/CROSSTOOLTILE/include && make all-gcc && make install-gcc

Well, everything have been installed, but if I try to compile a simple HelloWorld.c file with /home/javi/workkk/arm-elf-gcc and it dosn't work because arm-elf-gcc use i686-as and i686-ld (i686 is the architecture where I'm building the cross-compiler).

I know that arm-elf-gcc is using i686-as and i686-ld because when arm-elf-gcc reach to the assembler step the prompt says me that it doesn't understand any arm instruction.

I would like know how can I resolve it, I've read several manuals about the issue but I don't get to build a correct cross compiler for one reason or another.

Best Regards!
 
Old 02-23-2011, 09:43 AM   #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
You should use a too like Crosstool-NG to build cross toolchains. There are way too many variables and problems to solve, and the authors of crosstool-ng have solved most of them.
--- rod.
 
1 members found this post helpful.
Old 02-23-2011, 10:40 AM   #3
dejavih
LQ Newbie
 
Registered: Feb 2011
Location: Spain
Posts: 4

Original Poster
Rep: Reputation: 0
Talking

Quote:
Originally Posted by theNbomr View Post
You should use a too like Crosstool-NG to build cross toolchains. There are way too many variables and problems to solve, and the authors of crosstool-ng have solved most of them.
--- rod.
Thanks for answering!

I didn't know this project, but in any case I would like to build a cross toolchain manually.
 
Old 02-23-2011, 12:06 PM   #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
Quote:
Originally Posted by dejavih View Post
I would like to build a cross toolchain manually.
I can't imagine why. Good luck with that. Even with a tool like crosstool-ng, there are plenty enough challenges, especially for ARM CPUs and all of its various nuances.

--- rod.
 
1 members found this post helpful.
Old 02-23-2011, 03:12 PM   #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: 13,941

Rep: Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602
Quote:
/home/javi/workkk/arm-elf-gcc and it dosn't work because arm-elf-gcc use i686-as
and i686-ld (i686 is the architecture where I'm building the cross-compiler).
I think it is possible to build gcc so it will know the correct linker.
( export LD=arm-ld etc. may also work.)

But then again : We have Crosstool-NG : So why use an extra week (month ?) with tries
to build a tool-chain ?
More reasons to use Crosstool-NG : It's constantly being updated. No other tools have
all the Crosstool-NG benefits.

If you want to know, how to build a tool chain, the usually suggested method is:
Build LFS, 'Linux From Scratch' a couple of times. And then move on to CLFS :
'Cross Linux From Scratch' http://www.linuxfromscratch.org/lfs/
..
 
Old 02-24-2011, 05:02 AM   #6
dejavih
LQ Newbie
 
Registered: Feb 2011
Location: Spain
Posts: 4

Original Poster
Rep: Reputation: 0
Smile

Hi again!

I want to know how build a cross toolchain manually because in the future if I need build a cross toolchain for an architecture that isn't supported by crosstool-NG I would like to know how could I do.

knudfl I will test exporting the path to LD_LIBRARY_PATH. Also I've followed the steps from LFS book but I haven't had success.

Thanks!

p.d: sorry for my English
 
Old 02-24-2011, 06:46 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,941

Rep: Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602
Quote:
exporting the path to LD_LIBRARY_PATH
Not a library. Not an LD_LIBRARY_PATH. LD is a binary, like /usr/bin/ld

example : 'LD=/opt/arm/bin/arm-ld' simply defines which ld to use.
 
Old 02-24-2011, 09:11 AM   #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
Quote:
Originally Posted by dejavih View Post
I want to know how build a cross toolchain manually because in the future if I need build a cross toolchain for an architecture that isn't supported by crosstool-NG I would like to know how could I do.
Then why don't you spend some time learning the ways of crosstool-NG, and when the day comes that you need an unsupported architecture you can just add that to crosstool? There is a lot of good infrastructure built into crosstool, and you would be doing yourself a huge favour by using it. Once you see how things are done with it, you will understand this. Plus, you will be able to receive fame and glory for contributing a new architecture to a widely used tool.

--- rod
 
1 members found this post helpful.
Old 02-25-2011, 04:56 AM   #9
dejavih
LQ Newbie
 
Registered: Feb 2011
Location: Spain
Posts: 4

Original Poster
Rep: Reputation: 0
Talking

Quote:
Originally Posted by knudfl View Post
Not a library. Not an LD_LIBRARY_PATH. LD is a binary, like /usr/bin/ld

example : 'LD=/opt/arm/bin/arm-ld' simply defines which ld to use.
I think that I tested with this option but it doesn't work, but I'll try again just in case. Tomorrow (Saturday) I'll tell you the result that is when I be able to test this.

Quote:
Originally Posted by theNbomr View Post
Then why don't you spend some time learning the ways of crosstool-NG, and when the day comes that you need an unsupported architecture you can just add that to crosstool? There is a lot of good infrastructure built into crosstool, and you would be doing yourself a huge favour by using it. Once you see how things are done with it, you will understand this. Plus, you will be able to receive fame and glory for contributing a new architecture to a widely used tool.

--- rod
This is a good idea, I'm going to learn about how crosstool-NG works, maybe this helps me to resolve the problem. In any case, I'll keep trying to do manually but looking at the crosstool-NG, so, any help will be grateful.

Thanks!!

Last edited by dejavih; 02-25-2011 at 05:12 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
Problem building gcc 4.4.3 cross-compiler on Fedora 12 sdt Fedora 2 03-28-2010 03:14 PM
building cross compiler, having issues moonlightcheese *BSD 1 09-13-2008 02:09 AM
glib Error: while building Cross-Compiler for PPC Dhana_pal Linux From Scratch 2 12-28-2006 12:57 AM
Building cross-compiler gcc for powerpc-linux ccool Linux - General 3 09-17-2004 06:33 AM
Building an ARM7 cross compiler from gcc Charlie_B Linux - Software 2 08-20-2003 08:59 AM


All times are GMT -5. The time now is 11:54 AM.

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