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]
Other format: [Raw text]

Re: Crosscompiler: gcc 3.1 on linux for sparc ?


"IvanK." wrote:
> 
> I see a kindred soul in search of an ever elusive grail -- cross compiling on
> a sparc-linux for sparc64-linux.

 You should elaborate... What binutils you use ?  The native 32-bit or cross
64-bit or what ?  Your earlier problem with '__gmon_start__' looked like being
caused by the assembler not generating something right or the linker not
understanding something...

> /mnt/lfs/BUILD/glibc-build/csu/crti.o: In function `call_gmon_start':
> /mnt/lfs/BUILD/glibc-build/csu/crti.S:21: undefined reference to 
> `__gmon_start__'
> /mnt/lfs/BUILD/glibc-build/csu/crti.S:22: undefined reference to 
> `__gmon_start__'

 Does the 'crti.o' have the '__gmon_start__' as undefined as the error claims ?
(A bug in the assembler?) or as a 'weak' symbol as I have here :

H:\usr\local\sparc64-linux-gnu\lib64>..\bin\nm crti.o
0000000000000000 a *ABS*
                 U _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__		<---- !!
0000000000000000 ? _fini
0000000000000000 ? _init
0000000000000008 t call_gmon_start

> I read everything I could find on the topic -- read the Crosscompiling FAQ,
> which by the way is so outdated that it's uselesss, plus it doesn't really
> tell you how to actually compile a cross compiler.  I read GCC's
> configuring/building instructions and the section about cross compiling, but
> it assumes that if the reader is told "just build the cross compiler", he can
> figure out the correct sequence.

 "When one does, one learns..."  Reading is good, doing is better. So toying with
the tools is highly recommended, for instance showing the 'nm'-output from 'crti.o'
and asking whether it is right...  All the GNU tools should now have the '--help'
option and learning this from some text is usually enough. Then one just tries the
given options and tries to understand what they give...

> I also read Bill's instructions and although helpful they were gcc-2.95
> specific.  Then I read the stuff on http://www.dimator.org/work/crossgcc, and
> that got me further than anything else had before.  Still, I don't have a
> cross compiler to build my kernel.

 If you have GCC for 'sparc64-linux-gnu', it should be enough for the kernel-compile.
No glibc needed yet...
 
> So, please, elucidate me and everyone else who is
> 1) Not a hardcore gcc developer

 I'm not...

> 2) linux user on a sparc64 machine

 I'm not... Only built cross-tools for 'sparc64-linux-gnu' on Linux/x86 for that
and Windoze hosts...

> how do I build a 3.1 (or cvs) cross compiler.  Please let me know what options
> to pass to configure for binutils,gcc,glibc and in what order.

 I used only the basic options (--build=, --host=, --target=, --enable-shared and
--enable-threads) and got it easily.  The much-talked 'from scratch' issue was maybe
the most laborous, ie. copying the 'sparc' and 'sparc64' specific headers from the
glibc-sources ('find -type d -name sparc64' etc.) upon the 'some other' Linux-headers
from the glibc used (2.2.4). Ok it took a couple of minutes to copy the 'bits' and 'sys'
stuff into the '$prefix/sparc64-linux-gnu/include/bits' and '.../include/sys', so
the 'laborous' is relative...

 Anyhow I did just as the GCC-manual ordered, preinstalled all the easily available
target stuff before starting to build GCC.  Some people are brave and believe that
they know these things better than Stallman and all the people who have built hundreds
of cross-GCCs earlier and never preinstall any target stuff, because it is a 'dirty
trick' to their pure minds. Ok, they have their freedom...  But the GCC-manual and I
suggest this 'dirty trick' for any target, let it then be Solaris2, SCO, Irix, HP-UX
or (a big surprise ?) Linux, which have prebuilt C-library available (No prebuilt
toolchain for 'sparc64-linux-gnu' in the whole wide world, really ?)... But if one
has only a modem, the 'laborous' work in getting the target headers preinstalled may
be recommended... Otherwise one just installs some 'suitable C-library' for the target
before the GCC-build and is happy... Then updates the C-library when GCC is ready and
working, from 'pure virgin' sources...

 After bashing Gates, Stallman seems be now in turn when people call his instructions
in the GCC manual as 'dirty tricks' ;-)  What I have seen, trying to avoid the Stallman's
'tricks' is the biggest reason for failures.

> If you don't feel like it, at least
> 1) Tell me where to find *exact* instructions geared specifically towards a
> linux user on a sparc64 arch building a sparc32->sparc64 3.1 cross compiler

 The generic instructions in the GCC manual ("Installation / Cross-compiler") should
work always. Otherwise report the bugs to FSF (but no guarantee that anyone fixes them).

> 2) Tell me if currently this is impossible.

 As told, I succeeded with glibc-2.2.4, but haven't tried glibc-2.2.5... GCC itself was
mainly a piece of cake.  What I still wonder is whether one should copy the libs from
the 32-bit 'sparc-linux-gnu' into the 'lib' and to put the 64-bit libs to the 'lib64'...
Anyway with the toolchain one probably should be capable to produce either 64 or 32 bit
binaries...

Cheers, Kai



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