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: Building cross-compiler for Alpha-linux on i686-linux


Frank Meurer wrote:
> 
> On Mon, 10 Apr 2000, Dave Moore wrote:
> 
> > see if the C compiler (the version of GCC I just built, presumably)
> > worked, and it said no ... specifically, it said that the C compiler
> > could not create executables.  After thinking about this for a while, I
> Yeah, IMHO it tries to run a Alpha-executable! ;-)

 No, this is the plain vanilla linking problem -- the 'alpha-linux-gnu'
in
the GCC sources is aimed to be native-only... Nobody has cared to make
any
things for a cross-compiler. So the toolkit really 'cannot make
executables'.
Please see the 'alpha-linux-gnu/libiberty/config.log' for the linking
errors.

 The subjects related to this, like 'how to build a powerpc-linux target
cross-compiler for x86-linux host, a x86-linux-to-sparc-solaris2 etc.
etc.
-- they all having the same principles --- have been discussed in this
list
so many times that it should be very unexpected someone asking these
again.
Just dowloading the maillist archive and browsing it would tell much.

 Ok, I list some of the problems & fixes here once again :

 1. the resulted GCC cannot find the target headers:
      Open the GCC manual at 'Installation / Cross-Compiler and see that
      the target headers and libs MUST be preinstalled before starting
to
      build GCC. But gcc-2.95.2 has a bug which breaks the search paths
      while the compiler is not installed yet (it goes a long way to
find
      the target headers)... The 'hacks' like the '--with-headers', pre-
      creating the GCC install dir :

	E:\usr\local\ppc-linux-gnu\lib>gcc-ppc-linux -print-search-dirs
	install: /usr/local/lib/gcc-lib/ppc-linux-gnu\2_95.2\

      or fixing the bug, have been mentioned in this list...

 2. The resulted GCC cannot create executables:
      In order to create executables one needs also working startups and
      libs for the target, besides the headers. After copying the libs,
      they must be fixed, all the symlinks which worked in the native
      environment like 'libm.so' being a symlink to '/lib/libm.so.6'
      (to '../../lib/libm.so.6') must be fixed. And the 'libc.so' can be
      a linker script listing '/lib/libc.so.6' and
'/usr/lib/libc_nonshared.a'
      to be linked... Here is a fixed one for 'powerpc-linux-gnu' :

------------------------ clip
-------------------------------------------
E:\usr\local\ppc-linux-gnu\lib>less libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( /usr/local/ppc-linux-gnu/lib/libc.so.6
/usr/local/ppc-linux-gnu/lib/libc
_nonshared.a )
------------------------ clip
-------------------------------------------

 3. Although the libs, startups, headers etc. are in the proper place,
it
    still cannot find the 'ld.so.1'. For example :

------------------------ clip
-------------------------------------------
On Apr 3 Graham Stoney wrote in crossgcc@sourceware.cygnus.com :
> 
> Dynamic linking is causing me grief however, as follows:
> % greyham@brixi% powerpc-linux-gcc hello.c
> /opt/gcc-2.95.2/powerpc-linux/bin/ld: warning: ld.so.1, needed by
/opt/ppc.linux/glibc-2.1.3-8xx/lib/libc.so.6, not found (try using
--rpath)
> /opt/ppc.linux/glibc-2.1.3-8xx/lib/libc.so.6: undefined reference to `_dl_init_next@GLIBC_2.0'
> 
> As the warning points out, libc.so.6 can't find ld.so.1. But it's right there
> alongside libc.so.6 in /opt/ppc.linux/glibc-2.1.3-8xx/lib/ld.so.1, where the
> glibc install put it!
------------------------ clip
-------------------------------------------

 Please see the archive for the solution !  This same problem hurts all
the targets which use shared libs at runtime (Solaris2, Linux,...) and
the shared libs have links to other 'needed' shared libs :

------------------------ clip ---------------------------------
E:\usr\local\ppc-linux-gnu\lib>objdump -p libc.so.6

libc.so.6:     file format elf32-powerpc

<snip>

Dynamic Section:
  NEEDED      ld.so.1		<---- !!!!!!!
  SONAME      libc.so.6
  INIT        0x21618
  FINI        0xdae78
------------------------ clip ---------------------------------

 A native compiler finds the 'ld.so.1' from '/usr/lib' automatically,
but not the cross-compiler (or it finds the native one!!!!)

> > came to the conclusion that I probably needed to provide some libraries
> > libc, libm, crtn and stuff like that.  I ftp'ed the ones I thought I
> > would need from the DS10, reconfigured with --with-libs set to the
> > appropriate location, and the build failed again with the same error.

 If you had read the 'Installation / Cross-Compiler', and the archive of
this
maillist, you wouldn't have to think, just follow the instructions and
after
that (when not working, ask any 'alpha-linux' target-specific
questions).

 Finally all those Cross-Linux FAQs are useful... "Linux is Linux,
although
you would fry it in butter". The new PowerPC FAQ is one :

------------------------ clip ---------------------------------
The Linux PowerPC-Embedded HOWTO is a distillation of the collective
wisdom of
the linuxppc-embedded mailing list. It contains a bunch of links and
other
information to help embedded system developers wishing to benefit from
using
Linux in embedded PowerPC-based environments.

It is available in HTML from:
    http://members.xoom.com/greyhams/linux/PowerPC-Embedded-HOWTO.html

And in Linuxdoc SGML from:
    http://members.xoom.com/greyhams/linux/PowerPC-Embedded-HOWTO.sgml

The HOWTO is updated regularly and any feedback and contributions from
readers
is greatly encouraged.

Regards,
Graham
--
Graham Stoney
Principal Hardware/Software Engineer
Canon Information Systems Research Australia
Ph: +61 2 9805 2909  Fax: +61 2 9805 2929
------------------------ clip ---------------------------------

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]