Sparc/Multilib

This guide will help you to migrate your existing Gentoo Linux SPARC installation from a non-multilib profile to a multilib profile.

Overview
This guide will help you to migrate your existing Gentoo Linux SPARC installation from a non-multilib profile to a multilib profile.

Multilib has advantages but it also has some disadvantages, these are the facts:

Update the make.profile symlink
Because the profile is still in an experimental state you have to create/change the symlink manually.

The multilib profile also provides these three sub-profiles for your convenience, just like 2008.0 does:


 * desktop
 * developer
 * server

or

or

or

Confirm that you read this guide
If someone would switch to the multilib profile without reading this guide, his/her system would break. To prevent that you need to confirm that you read this by adding  to the end of your.

Rename lib to lib32
Though it is not fully compliant with FHS, common practice in Gentoo is to store 32-bit libraries in, 64-bit libraries in and to have  as a symlink to the default library directory.

The 2008.0 profile stores libraries in. These commands will rename all directories to  and create a symlink  to. Additionally they will create empty directories.

Rename lib to lib32

Remerge baselayout
For multilib profiles, installs additional files, like. To get these you need to remerge it.

Install a multilib glibc
To compile a multilib glibc you need a biarch gcc but to compile a biarch gcc you need a multilib glibc. You could compile glibc using a cross-compiler such as but that is not something you would enjoy...

Therefore we will install a binary packages of glibc first and afterwards, once the migration is complete, remerge it with your USE- and CFLAGS.

If you get All ebuilds that could satisfy have been masked. try using a different version of glibc, these two are available as binary packages:


 * =-2.8_p20080602-r1
 * =-2.9_p20081201-r2

Install a biarch GCC
With a multilib glibc installed you can simply compile a biarch GCC using portage.

Now you need to configure your system to use the newly installed GCC using. Replace  with the version you just installed.

Remerge glibc with your preferred settings
Remerge glibc with your system specific settings (USE-flags, CFLAGS and such).

If the glibc compilation finishes without any strange error messages it means that your multilib setup is working. You can use to verify this by checking the contents of.

Unmerge kgcc64
can compile the kernel now, therefore you don't need anymore to do it. If you have some scripts that need it, just replace  with.

Remerge world
Your system was build with as library directory, now it is. Though you will not notice anything because there is a symlink in place but if you have a lot of spare CPU time and like your system clean...

Or in other words: If you are one of those guys who uses Portage's multilib-strict feature just for the fun of it...this is for you!

Usage example
Here's a simple example how to compile a hello world program in both 32 and 64-bit.

Compile it as 32-bit binary:

or

Compile it as 64-bit binary:

Things you should not do
So now you have a multilib installation and you are thinking about adding  to   in  and recompiling your entire userland in 64-bit? PLEASE DO NOT!

While compiling everything in 64-bit may be a good idea on other 64-bit architectures, like, on it is not. There are good reasons why we have been using a pure 32-bit userland until now, some of these are:


 * 32-bit is faster than 64-bit
 * 32-bit is well tested, 64-bit is not tested at all
 * 2039 is still long way off

The only reasons why it might be appropriate to compile an application in 64-bit are:


 * It needs to access more than 4GB of memory. In the real world this only applies to huge databases.
 * It needs to talk to the kernel directly. Some applications, like, contain ugly hacks to support the 64-bit kernel/32-bit userland thing.
 * It is a kernel.

If you would like to read more about the differences between 32 and 64-bit, there are dozens of webpages about it on the internet, one of them is http://www.superlogic.net/downloads/pub/docs/64bit.htm.

Acknowledgements
We would like to thank the following authors and editors for their contributions to this guide:


 * bluebird