This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tool chain directory hierarchy


Hi Erik,

On 7/7/05, Eric Olsen <eo99@hotmail.com> wrote:
> 
> Can somebody explain the directory gcc toolchain hierarchy,
> or where I can find out how it is organized, and why?
> 
> I built a powerpc tool chain, and there seems to be two levels to it
> In the following example, PREFIX was set to /data/tools/gcc-powerpc-linux

Good question.. I don't have a definitive answer for you except that
within the prefix directory the tools are placed in two separate directories
depending on how you intend to use them. (You are free to choose 
what $PREFIX is).

Firstly, the subdirectory that you are concerned about (powerpc-linux)
is a shortened version of the GNU architecture description, which is 
usually of the 4 part form <processor>-<machine>-<kernel>-<clibrary>
eg. i686-pc-linux-gnu, powerpc-unknown-linux-gnu
     (The last example is sometimes condensed to 'powerpc-gnu'.)

This is what is returned by the 'config.guess' script which is part of the 
configure scripts (from the GNU autoconf software.)

-Case 1-
In the bin directory ($PREFIX/bin)
you will find tools with the 
  prefix 'powerpc-linux-' (eg. powerpc-linux-gcc)

This path is used when cross-compiling using a standard 'configure' script
with the '--host' option. eg. using --host='powerpc-linux'  will prepend
'powerpc-linux-' to the begining of all the calls to crosscompiler tools.

(This can be seen when 'configure' is run by the 
'Checking for cross compiling: yes' statement.)

The only other thing required is that the directory '$PREFIX/bin' is placed
in your PATH. (If you have build cross-compilers for multiple hosts, you
can use the same 'PREFIX' and have them called appropriately by
'configure'.)

- Case 2 - 
In the other directory ($PREFIX/powerpc-linux/bin) you will find
another copy of the tools without the prefix. (eg. gcc).

These tools are used by adding this directory directly to your path,
prior to '/usr/bin' so that they are called before the native compiler.

This is useful for simple cross compilation, where 'configure'
(GNU autoconf) is not used.

Problems using this method occur when:
- The application contains tools a built natively, which then are used to
  build the application. (Different compilers required)

  (The linux kernel get around this by using a 'CROSS_COMPILE' 
  prefix variable for the cross compiler tools, otherwise use native tools.
  Surprisingly, this can be used with either of the directory
structures above.)


Happy to be corrected by anyone...
Cheers,
Paul

ps. The following book has been resonably useful..
'Autoconf, Automake and Libtools' 
by Gary V. Vaughan, Ben Elliston, Tom Tromey, Ian Lance Taylor
http://www.amazon.com/exec/obidos/tg/detail/-/1578701902/qid=1120694815/sr=8-1/ref=pd_bbs_ur_1/002-7067677-0001632?v=glance&s=books&n=507846

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]