This is the mail archive of the crossgcc@sourceware.org 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: what's the proper include search path for the cross-gcc?


Robert P. J. Day wrote:

  i'm sure i'm about to embarrass myself here but what is the
appropriate include directory search path for the generated cross
compiler?

The 'rocket science' comes here :


Headers will be used by the "C Pre Processor", 'cpp', so the only one
which could tell where it searches those headers could be the 'cpp'.
The other GCC binaries maybe don't care where the headers are.

  and how can i print out where a header file would be found?  i tried
the "-print-search-dirs"

With 'cpp' ? With 'gcc' ? With 'cc1' ? With 'cc1plus' ?


but, while that prints the search sequence
for shared libs, it doesn't say anything about how a given header file
would be located.

One should be like a child with these things :-) Trying everything and seeing what happens, can sometimes teach a lot. For instance one has learned the '-v' option with 'gcc' and wants to see what it gives with the other GCC binaries. It can for instance give the following :

F:\usr\local\lib\gcc-lib\sh-linux-gnu\3.0>cpp0 -v
GNU CPP version 3.0 20010416 (prerelease) (cpplib) (SH GNU/Linux with ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc-lib/sh-linux-gnu/3.0/include
 /usr/local/sh-linux-gnu/sys-include
 /usr/local/sh-linux-gnu/include
End of search list.
cpp0:  is a block device

F:\usr\local\lib\gcc-lib\sh-linux-gnu\3.0>cc1 -v
GNU CPP version 3.0 20010416 (prerelease) (cpplib) (SH GNU/Linux with ELF)
        .file   "stdin"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc-lib/sh-linux-gnu/3.0/include
 /usr/local/sh-linux-gnu/sys-include
 /usr/local/sh-linux-gnu/include
End of search list.
cc1:  is a block device
        .ident  "GCC: (GNU) 3.0 20010416 (prerelease)"

Execution times (seconds)
 preprocessing         :   0.00 ( 0%) usr
 lexical analysis      :   0.00 ( 0%) usr
 parser                :   0.09 (53%) usr
 varconst              :   0.00 ( 0%) usr
 symout                :   0.00 ( 0%) usr
 TOTAL                 :   0.17

BTW, the last rows were interesting... Maybe some day someone asks how
one can see how long times the 'compiler' will spend in its 'compile
phases' !

As seen, the '-v' doesn't say much about the C++ headers... Hmmm, what
else nice options there could be. Needing help... Is there an option
giving help? What if one writes 'help' as the option? GNU tools require
two dashes with a 'long' option, so the option could be '--help' or how?

Trying the '--help' with the 'cpp0' gives some interesting options :

-lang-c Assume that the input sources are in C
-lang-c89 Assume that the input sources are in C89
-lang-c++ Assume that the input sources are in C++
-lang-objc Assume that the input sources are in ObjectiveC
-lang-objc++ Assume that the input sources are in ObjectiveC++
-lang-asm Assume that the input sources are in assembler


What if one tries the '-v' and the '-lang-c++' together :

F:\usr\local\lib\gcc-lib\sh-linux-gnu\3.0>cpp0 -v -lang-c++
GNU CPP version 3.0 20010416 (prerelease) (cpplib) (SH GNU/Linux with ELF)
ignoring nonexistent directory "/usr/local/include/g++-v3/sh-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include
 /usr/local/lib/gcc-lib/sh-linux-gnu/3.0/include
 /usr/local/sh-linux-gnu/sys-include
 /usr/local/sh-linux-gnu/include
End of search list.
cpp0:  is a block device

Hey, now it showed some C++ header paths !

  i'm sure this is trivial stuff, i'm just realizing that maybe i
don't understand it as well as i should.

Please become a child again and start to toy with the world :-)


Ok, jokes enough... Seeing the headers search paths seems to not be
standardized in any way, so if one has learned to use the :

cpp -Wp,-lang-c++,-v

like :

F:\usr\local\bin>cpp-sh-linux-b -Wp,-lang-c++,-v
GNU CPP version 3.0 20010416 (prerelease) (cpplib) (SH GNU/Linux with ELF)
ignoring nonexistent directory "f:/usr/local/include/g++-v3/sh-linux-gnu"
ignoring nonexistent directory "/usr/local/include/g++-v3/sh-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 f:/usr/local/include/g++-v3
 f:/usr/local/lib/gcc-lib/sh-linux-gnu/3.0/include
 f:/usr/local/sh-linux-gnu/sys-include
 f:/usr/local/sh-linux-gnu/include
 /usr/local/include/g++-v3
 /usr/local/include
 /usr/local/lib/gcc-lib/sh-linux-gnu/3.0/include
 /usr/local/sh-linux-gnu/sys-include
 /usr/local/sh-linux-gnu/include
End of search list.
cpp0.exe:  is a block device

this maybe doesn't work any more with the next GCC release :-(

Generally I don't know where people will need the '$target-cpp' which
will be installed always, into the same place with the '$target-gcc',
'$target-g++' etc.  But now we know at least one use for that: to try
to see the headers search paths...

The output with the '-print-search-dirs' can be really surprising :

F:\usr\local\bin>cpp-sh-linux-b -print-search-dirs
install: /usr/local/lib/gcc-lib/sh-linux-gnu\3.0\
programs: =f:\usr\local\lib\gcc-lib\sh-linux-gnu\3.0\;

and so on, nothing about those headers!

------
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]