Sunil Amitkumar Janki wrote: > I have Slackware 12.0 32-bit running on my SPARC server > and would like to build a 64-bit tool chain. I have tried many > times to build it but have failed to get far into the build > process. 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 have also tried crosstool but it bails out with an error so > I would rather do it manually so I have more control over > the process and get a better understanding of the whole of > it. > > Does anyone have any suggestions as to how to do this? > I can't find a SPARC64 64-bit tool chain anywhere but I > need at least a 64-bit compiler to build a 64-bit kernel > for my server since it won't boot 32-bit Linux kernels. > > But I also want to have a pure 64-bit tool chain ready > to experiment with for performance and general testing > purposes. 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. 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. 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 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
Attachment:
sparc64_cross.sh
Description: Bourne shell script