Multilib/gx86-multilib
This page will use amd64 with the additional 32-bit API for illustration, users of other multilib-enabled arches should adapt the instructions accordingly.
Due to limitations in the older emul-linux-x86-* multilib solution, it is generally troublesome to toggle eclass based multilib on individual packages. Thus, this page currently only describes how to enable it system wide. These difficulties are expected to lessen as more of the packages provided by the emul-linux-x86-* packages are migrated to use eclass based multilib, and other packages are updated to accept the migrated packages in their dependencies.
Enabling eclass based multilib
Enabling an additional ABI
Enabling per-package
The 32-bit ABI can enabled per package by setting a USE flag:
sys-libs/zlib abi_x86_32
If the package manager requires dependencies to also include this flag, it will prompt to add them.
System wide implementation
This will increase build times for any consuming package even if the 32-bit library is not utilized.
It is not strictly necessary to specify the default (64-bit) ABI since it is force-enabled by 64-bit profiles, but does not hurt to add it:
ABI_X86="32 64"
Note on CFLAGS
For those that enable the 32-bit/64-bit ABI CFLAGS options must NOT include any -mXX
options.
# Remove -m32 -m64 flags that conflict with multilib ABI settings:
# CFLAGS="-O2 -march=native -pipe -m32 -m64"
CFLAGS="-O2 -march=native -pipe"
This will allow the ABI_X86="32 64"
to select the compiler options during the configure and make process.