SPARC64 64-bit tool chain

Sunil Amitkumar Janki
Sat Sep 1 18:51:00 GMT 2007

Brian Dessent wrote:
> I realize that it can be frustrating when you have tried many things and
> they all failed, but in terms of posting for help to a mailing list it
> doesn't help to omit the details.  Without knowing the exact steps you
> have taken and the exact error messages, we can only speculate as to
> what's going wrong.

I thought it didn't matter because all I have accomplished up to this 
point is building
a 32-bit binutils package that defaults to creating 64-bit SPARC object 
files. Every
time I tried to build gcc there was an error so I figured it would be 
too little
information to be helpful.

> The problem with building a cross compiler is that it does not exist in
> a vacuum.  You can't just download the source and build it.  A compiler
> exists in the context of a C library and a kernel, both of which are
> external projects and not part of gcc.  Moreover, gcc is just a
> glorified text processor -- it's not an assembler or linker, so you also
> have to provide those, normally from the binutils project.  In order to
> build a working gcc therefore you need to have these other pieces
> available at build time.
> In the case of a native system this is easy as they already exist.  But
> in the case of a cross compiler they usually don't.  So you have to get
> them from an existing system, or else build them up from nothing.  The
> latter is much harder than the former.  Fortunately, there are people
> that do this kind of thing for you: Linux distributions.  You can use
> their work as a starting point, and conveniently the fruits of their
> labor come in nice individually wrapped packages.

It's particularly the latter I'm interested in since it would be a great 
experience. I have actually rebuilt Slackware 12.0 for SPARC so I am 
kind of the
distributor. That's why I thought I could only find some helpful 
suggestions here.

I also have a 32-bit port ready for little-endian MIPS, but as you could 
guess I
have the same problem there, except it can run 32-bit kernels, so it's 
less urgent.

I assume when you have done this thing once it becomes easier the second 
around. I don't run away from the difficult things otherwise I wouldn't 
be running
be running Slackware but rather something like (K)ubuntu :-).

> For example in Debian the C library is in a package called libc6, and
> the headers are in a package called libc6-dev.  In the case of SPARC,
> Debian has chosen to also split out the 64 bit versions of these into
> their own packages: libc6-sparc64 and libc6-dev-sparc64.  Finally there
> is the linux-kernel-headers package.

I didn't know that. I have scoured all over the Debian and Gentoo web 
sites and
mailing lists and the Internet at large to look for 64-bit SPARC and 
MIPS information
but didn't find anything useful for my purposes.

> If you simply download and unpack the contents of these packages into a
> sysroot directory, and then configure your cross compiler with
> --with-sysroot= pointing to it, you should have all you need.  I use
> Debian here as an example as it is a distro I am familiar with and it
> supports SPARC, but really you could do this with any distro's packages.

I am also pretty familiar with Debian but probably not as much as you. I 
have it
mostly running in QEMU virtual machines for GNU/Linux ports to the various
architectures. As a matter of fact Debian and Slackware and derivatives 
of either
are the only thing I would touch any more in the Linux environment after 
experienced too much RPM "friendliness" in the past.

> I put together a small example, see attachment.  Run this in an empty
> directory and it will download everything that it needs; everything it
> creates is in subdirectories so you don't have to worry about anything
> polluting the rest of the system.  All this does is create a sysroot
> containing libc and headers, builds and install binutils, then builds
> and installs gcc.  
> I suggest that you follow up on the crossgcc list if you have any
> questions, as that tends to be more about building cross compilers than
> using gcc.
> Brian

Thanks for the script and I will follow up to the crossgcc mailing list 
at sourceware
with any problems I encounter. I already removed the "nv" part but I 
will re-add
them to the script as per your follow-up post.


For unsubscribe information see

More information about the crossgcc mailing list