Page 1 of 1
GCC Cross-Compiler
Posted: Mon Dec 13, 2010 4:20 am
by ecco
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...
Re: GCC Cross-Compiler
Posted: Mon Dec 13, 2010 4:32 am
by Combuster
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?
Re: GCC Cross-Compiler
Posted: Mon Dec 13, 2010 4:35 am
by ecco
No I know it works because I've done it many times, the tutorial just doesn't explain what you just did...
Re: GCC Cross-Compiler
Posted: Mon Dec 13, 2010 4:45 am
by Combuster
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.
Re: GCC Cross-Compiler
Posted: Mon Dec 13, 2010 12:29 pm
by ecco
Combuster wrote:that's most often a reader's exercise
I agree, consider this part of my "reader's exercise" to acquire further information.