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: AIX Host -> PowerPC Linux


Kevin Heatwole wrote:
> 
> I'm attempting to build a gcc cross-compiler hosted on AIX and
> targeted to LinuxPPC (installed on an iMac).
> 
> Everything looks very straight forward.  The process I am using I got
> from Bill Gatliff's site (http://crossgcc.billgatliff.com) where he
> outlines how to build a cross-compiler for an embedded target.

 The expected behaviour would have been to read the "Installation /
Cross-Compiler" from the GCC-manual, "Using and Porting the GNU
Compiler Collection (GCC)". Every GCC-user should have the manual in
a format or another. It can be built from the GCC sources or downloaded
prebuilt from the net. The RedHat site and the GNUPro docs is one
choice (I refer to another message from me today on this list...)

 Your target is not embedded, but the much more common normal case
where the target headers and libs can easily be copied from the
target system and preinstalled into the host system. The GCC-manual
describes this process quite well and the Cross-GCC FAQ is not needed.

> In this process, you first build binutils (which built fine for me).
> Then, you build a "gcc-core" (which also built fine for me).  Then,
> you use this little gcc cross-compiler to build glibc.  And finally,
> you rebuild a full gcc cross-compiler using the libs you built with
> the little gcc cross-compiler.

 The normal way is to preinstall the target stuff, build GCC and be
happy... 15 minutes or less on a modern machine with 300 MHz or more...

> Since I already have a complete LinuxPPC environment including a gcc
> and all it's libraries sitting on the iMac and this is the platform I
> want to build a gcc cross for (so I can build complete binaries on
> AIX and just ftp them to the iMac), shouldn't I be able to just copy
> all these libraries/include files into my cross on AIX and not have
> to rebuild anything (especially the glibc that I'm having problems
> building now)?

 You sholdn't need to ask this... Anything related to cross-compiling
should tell this being the 'normal' case. Building the C-library from
sources and then doing all the 'acid tests' to it, to become confirmed
that one can use it as the 'production library', is really 'reinventing
the wheel'. Of course one can have the same kind of NIH-attitude (which
I think that I have, that nobody else can do anything right ;-), so
finding any working fully tested libs is not possible at all... Those
who don't trust themselves (or see the rebuild as an unnecessary work),
just use the working and tested stuff...

 If your situation would be vice versa, ie you would try to produce
AIX-targeted tools to work on Linux/PPC, how eager you would be to get
the IBM AIX C-library sources and recompile them?  So why in this case
to recompile the Linux/PPC libraries?
 
> Can someone indicate what files/directories I should copy from
> LinuxPPC into my gcc cross on AIX to do this and where I should put
> them on AIX?

 The '/lib' and '/usr/lib' stuff, and copy them into $prefix/$target/lib,
all the libs into the same directory. This happens also when building
glibc using the '--prefix=$prefix/$target' and writing 'make install'...

 Someone already explained the problem with the 'libc.so',
but also fixing the symlinks between the libraries is obligatory.
In the native world the stuff from '/lib' is symlinked to be seen in
'/usr/lib' too (or was it vice versa...). And understanding that
the '/lib/ld-linux.so.2' or '/lib/ld.so.1' is also a needed
'library', as are all the '*.so.*' files, not only the '*.a' ones...

 One peculiarity which I have seen in these prebuilt 'production libs'
in the Linux-distributions is the debug info still in them --- "What
the heck, are these really already tested?". My 'libc-2.1.3.so' for
Linux/PPC has the size of 1.130.686 bytes (1+ MB) and the 'libc.a'
has the size of  2.314.646 bytes. I trusted myself, the GCC I used to
compile the glibc-2.1.3 sources (gcc-2.9-edk1.0) and the glibc-
developers so much that I didn't use the '-g' in CFLAGS... But for
instance my RedHat 6.2 had a 20+ Megabyte 'libc.a'...

If your library sizes are 10 x bigger, considering to strip the copied
libraries now using the command:

  powerpc-linux-gnu-strip --strip-debug *.a *.o *.so

for them may be motivated. After that it isn't possible to debug your
C-library routines in the cross-environment, but if they are assumed
to be rock-solid already, who really cares... Perhaps the disk space
could be used for something more useful than keeping the debug info
in the C-libraries.

> Thanks for any help...  I just want to give this a try before I turn
> to hiring a consultant to do it for me.

 A consultant owning an AIX-machine can be much more expensive than
one owning a Linux-machine... Hmmm, what are the possibilities for a
Linux-owner getting the AIX-target libs and headers ? (For some much
used AIX-version...). The Sun Solaris2 stuff will be sent freely on
three CDROMs (Solaris7) if asked, but is IBM just as friendly?

 One would expect that companies like IBM would like developers to
produce stuff for their systems, put perhaps they just want the
developers to buy their systems as the development platform... If
they will succeed in building new killer-apps which then help to
sell the AIX-systems, that is nice... If not, at least they bought
a AIX-system or more...

 AFAIK it has been possible to build AIX-targeted tools for even the
most up-to-date 64-bit AIX-versions a year or more... The availability
of the target stuff is the big question, and where to find customers
who would like to get something (and pay something for it) to run on
AIX...

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]