[Clfs-support] CLFS multiarch /lib for 64bit and /lib32 for 32bit

William Harrington kb0iic at berzerkula.org
Sun Jan 29 12:18:03 PST 2017


On Sun, 29 Jan 2017 16:29:00 +0200 (EET)
Ivan Kabaivanov <ivan.kabaivanov at gmail.com> wrote:

> And a suggestion. Now that pure 32bit is being dropped left and right by the major distros, isn't it time to revisit the whole /lib, lib32, lib64 structure? It makes so much more sense to me to treat 64bit as the "native" bitness and therefore use /lib and /usr/lib for it. The extra arch is 32bit so treat it as the exception with /lib32 and /usr/lib32. 


Hello Ivan,

In the gcc config for t-linux64:

# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
 # are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
 # /lib and /usr/lib, while other distributions install libraries into /lib64
 # and /usr/lib64.  The LSB does not enforce the use of /lib64 and /usr/lib64,
 # it doesn't tell anything about the 32bit libraries on those systems.  Set
 # MULTILIB_OSDIRNAMES according to what is found on the target.
 
 # To support i386, x86-64 and x32 libraries, the directory structrue
 # should be:
 #
 #   /lib has i386 libraries.
 #   /lib64 has x86-64 libraries.
 #   /libx32 has x32 libraries.

I would rather stick with the defaults that gcc/g++ and the rest of the gnu toolchain expects. Of course, it shouldn't discourage people from using lib32 and lib for 64bit. You'll need to look at binutils and glibc for proper configuration. Also, perl will need adjustment for multilib to use lib32 and lib rather than lib and lib64.

All you need to do is some toolchain checks to make sure your linker search paths are right and that the linker can be found. Use readelf whenever you can, as ldd is not accurate when cross compiling. It should be fine in the final system, though.

Sincerely,
William Harrington



More information about the Clfs-support mailing list