OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 20, 2024 12:03 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: GCC Cross-Compiler
PostPosted: Mon Dec 13, 2010 4:20 am 
Offline

Joined: Mon Nov 29, 2010 1:21 am
Posts: 19
Location: Anchorage, AK
Am I missing something or should this:
export PATH=$PATH:$PREFIX/bin

be changed to
export PATH=$PREFIX/$TARGET/bin:$PATH

I'm pretty sure if the newly compiled binutils is to override the system version it needs to be before the rest of the current path and furthermore point to version of the files without the prefix...


Top
 Profile  
 
 Post subject: Re: GCC Cross-Compiler
PostPosted: Mon Dec 13, 2010 4:32 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
No, you shouldn't. Configure looks for both a host and target toolchain, so it wants specifically a i686-pc-cygwin-as, and a i586-elf-as when it looks for the GNU assembler. if you add prefix/bin, it can find i586-elf-as. if you add prefix/target/bin, there's only as, and it comes later in the path than the host assembler which also uses that name, so you will start to miss out on one. And worse: you will break everything that expects gcc/as/ld without prefix to be the host toolchain.

Also, that tutorial exists practically unchanged for over 5 years now, do you honestly believe it was broken all that time?

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: GCC Cross-Compiler
PostPosted: Mon Dec 13, 2010 4:35 am 
Offline

Joined: Mon Nov 29, 2010 1:21 am
Posts: 19
Location: Anchorage, AK
No I know it works because I've done it many times, the tutorial just doesn't explain what you just did...


Top
 Profile  
 
 Post subject: Re: GCC Cross-Compiler
PostPosted: Mon Dec 13, 2010 4:45 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
Quote:
the tutorial just doesn't explain what you just did...
Not in that wording, but you did draw a contradictory conclusion:
You wrote:
(...) if the newly compiled binutils is to override the system version (...)
The wiki wrote:
(...) so that gcc invokes your system compiler, and $TARGET-gcc invokes your cross-compiler. (...)


The section from which I got that last quote (briefly) explains why the tutorial does it that way, but you can't really expect a tutorial to cover for each possible deviation why they do not do it that other way: that's most often a reader's exercise or author's taste, if not both.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: GCC Cross-Compiler
PostPosted: Mon Dec 13, 2010 12:29 pm 
Offline

Joined: Mon Nov 29, 2010 1:21 am
Posts: 19
Location: Anchorage, AK
Combuster wrote:
that's most often a reader's exercise
I agree, consider this part of my "reader's exercise" to acquire further information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group