This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: Help building cross-compiler


Ajit Sanzgiri wrote:
> 
> I am trying to build a cross-compiler hosted under
> solaris 2.7 targeted at linux on Pentium boxes.
> 
> I have built binutils successfully. My host environment
> has a functioning gcc for native compilation. I copied
> over the contents of /usr/include in the target environment
> to my $prefix/$target/sys-include. I also copied all target
> libraries to a directory which was passed to the configure
> program with the --with-libs option.

 Why you did these things ?
 The "Installation/Cross-Compiler/Cross-Compilers and Header Files"
in the GCC manual doesn't say anything about doing these things. The
'sys-include' is aimed for third-party includes, not for the
standard target headers. A clip from the gcc-2.96 manual :

--------------------------- clip --------------------------------
When you have found suitable header files, put them in the directory
/usr/local/target/include, before building the cross compiler.  Then
installation will run fixincludes properly and install the corrected
versions of the header files where the compiler will use them.

Provide the header files before you build the cross-compiler, because
the build stage actually runs the cross-compiler to produce parts of
libgcc.a.  (These are the parts that can be compiled with GNU CC.)
Some of them need suitable header files.
--------------------------- clip --------------------------------

 The '/usr/local' is the default $prefix, a novice shouldn't toy with
things like '--prefix=...', so RMS probably simplified the thing here.
But everybody should understand that the standard target headers must
be put into '$prefix/$target/include' not into
'$prefix/$target/sys-include'.

 The GCC manual also says where to put the target libs and what will
be needed to make executables.

 Using the hacks you described it can be possible to build a cross-
compiler, I'm just interested in where people find these 'strange
hacks'. 

> After running gcc-2.95.2/configure, when I run 'make all install',
> the make terminates complaining as follows:
> ----------------
> cd ../libiberty ; make "SHELL=/bin/sh" ...(lots of makevar settings)
> make[2]: Entering directory .../$target/libiberty
> make[2]: *** No targets.  Stop.
> ----------------

 The build couldn't get the 'libiberty.a' built because you haven't
a working toolset (startup, libs, headers, compiler, assembler and
linker). The 'i586-linux/libiberty/config.log' tells what is your
problem.

 Most probably it is the missing '-rpath-link' to point to the
'ld-linux.so.2', and the unresolved symbols starting with 'dl_'
will show this...

> Looking at i586-linux/libiberty, I find it contains no
> Makefile. i586-linux/libio and i586-linux/libstdc++ (the
> other elements in i586-linux) do contain Makefiles.
> 
> Any idea what I am doing wrong ?

 You didn't look at the archives of this maillist... Things like
looking at the '$target/libiberty/config.log' to see the problem
and when and why the '-rpath-link' must be added to the '*link:'
spec for all targets using shared libs, should have been mentioned
many times already.

---------------------------- clip --------------------------------
*link:
-m elf_i386 %{shared:-shared}
%{!shared:
 %{!ibcs:
  %{!static: %{rdynamic:-export-dynamic}
   %{!dynamic-linker:
    --dynamic-linker /lib/ld-linux.so.2
    -rpath-link /usr/local/i486-linux-gnu/lib}}
  %{static:-static}}}
---------------------------- clip --------------------------------
(The whole spec definition in a single line...)

 The recent 'alpha-linux-gnu' target case showed that the newer
binutils ('ld') could find the 'dynamic-linker' automagically,
without the '-rpath-link', but adding it for a cross-compiler
isn't so hard...
 
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]