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]

Re: Trying to build a cross compiler from linux to netbsd...


Alexandre Oliva wrote:
> 
> On Jan  3, 2001, Dick Munroe <munroe@csworks.com> wrote:
> 
> > ../../egcs-1.0.3a/gcc/objc/runtime.h:31: stdio.h: No such file or
> > directory
> > ../../egcs-1.0.3a/gcc/objc/runtime.h:32: ctype.h: No such file or
> > directory
> 
> You must have a copy of the C library headers of the target machine in
> order to build GCC.  You should have pointed to them with the
> configure flag --with-headers.

 Doing like Sinuhe the Egyptian, I would ask "Why?"  As I have understood
after a long research of this mess, the '--with-headers=something" is
meaned to point to headers which need some fixing for GCC. The NetBSD
headers can be non-ANSI and non-standard ones and need fixing, so this
advice can be valid here. But the "why" is missing and can cause people
to think this using of the '--with-headers=' being and universal CRC-
spray to get the car go on...

 AFAIK, the glibc-2.x headers used in Linux, the newlib headers, the
Solaris2 headers, SVR4 headers etc. don't need any fixing. So the
'--with-headers=' should never be used for them. "Don't fix if it
ain't broken"...

 The current "Using and Porting the GNU Compiler Collection" by RMS
(made from the latest snapshots) still says that the target libs and
headers should be preinstalled into their final place, into

  $prefix/$target/lib
and
  $prefix/$target/include

where $prefix and $target are the values given to '--prefix=' and
'--target=' while configuring.  Also the 'gcc/INSTALL' used to give
the same instructions for "How to Install a Cross-Compiler".  This
is the idea, although the default $prefix, '/usr/local', is used in
the texts...

 The GCC-manual is available for everyone who has the GCC-sources,
and can be downloaded as a prebuilt '.ps' or '.pdf' or '.html' etc.
formats from the net. Normally the 'gcc.info' will be built while
building GCC and can be browsed with the GNU info. All those having
a native GCC should have the 'gcc.info' already and have no problems
in finding the "Installation / Cross-Compiler" in it.  For a cross-
compiler builder reading this section from the GCC manual sounds
quite natural, but quite many fail to do this...

 The text from http://www.gnu.org/software/gcc/install/configure.html

---------------------- clip --------------------------------
"Some options which only apply to building cross compilers:

--with-headers=dir -- Specifies a directory which has target include
    files. This options is required when building a cross compiler, if
    ${prefix}/${target}/sys-include doesn't pre-exist. These include
    files will be copied into the gcc install directory. Fixincludes
    will be run on these files to make them compatible with gcc. "
---------------------- clip --------------------------------

can cause thoughts like (from Dave Korn):

>  The words 'REQUIRED when building a cross compiler" and
>"if $prefix/$target/sys-include doesn't exist" makes it seem like you
>*must* use --with-headers, or put the headers into sys-include.

 When using my "bad English", the missing "the" in the clause would
say clearly that the "target include files" cannot mean the standard
C headers for the target, only some 'unspecified headers for the target'
which need some fixing and must either be preinstalled into
'${prefix}/${target}/sys-include', or pointed with '--with-headers'.

 My understanding for the purpose of the 'sys-include' is that it is
the equivalent of '/usr/local/include' for a native compiler, ie. it
was aimed for the system-specific or 3rd-party headers, searched before
the standard C-headers (the 'sys-' comes from the 'system-specific').

 Okeydokey, my advice for cross-NetBSD build would be to either copy
the NetBSD standard system headers into '$prefix/$target/sys-include'
or into some temporary place and point to them using '--with-headers='
while running configure, start the build and see what happens...

 How well the 'fixincludes' in egcs-1.0.3 then handles the NetBSD
standard C headers is another problem... I would prefer to check
myself the fixed headers in '.../gcc/include', doing a 'diff -c'
for every fixed header and seeing what was added/changed, and if
there was any sanity at all...

 But for the 'universal case', I wouldn't suggest anybody to use the
'--with-headers=' before the question "Why?" has been answered. There
must be some sane reason to try to fix the standard C-headers for the
target...

Cheers, Kai



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


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