gcc-multilib is useful for cross-compiling, that is, compiling a program to run on a different processor architecture. For example, you would need gcc-multilib if you are running on 64-bit Ubuntu and want to compile a program to run on 32-bit Ubuntu (or on ARM etc. you get the idea).

Answer from AlexP on askubuntu.com
Top answer
1 of 2
31

gcc-multilib is useful for cross-compiling, that is, compiling a program to run on a different processor architecture. For example, you would need gcc-multilib if you are running on 64-bit Ubuntu and want to compile a program to run on 32-bit Ubuntu (or on ARM etc. you get the idea).

2 of 2
9

Is this actually Apple's "fat binaries" or "universal binaries" model ported to Linux?

No.

Multilib is a mechanism to support building and running code for different ABIs for the same CPU family on a given system. Most commonly it was/is used to support 32-bit code on 64-bit systems and 64-bit code on 32-bit systems with a 64-bit kernel. It was also used at one stage to provide support for soft-float arm binaries on hard-float arm systems.

It has been around for a long time. Since at least Debian lenny, but it never had specific support in the packaging tools making library support awkward. Also on arm upstream treats the 64-bit and 32-bit architectures as completely separate architectures rather than variants of the same architecture, so you can't use multilib there.

In terms of running code on Debian and Ubuntu systems, multilib has been mostly replaced by multiarch, which is a more general mechanism allowing installation of packages from potentially any combination of architectures on the same system (though actually running those binaries may require installing emulation layers).

In terms of building code Debian/Ubuntu now offer proper cross-compiler packages, which are more flexible than multilib in that they in principle allow you to build for anything on anything (though in practice Debian doesn't offer the full set of combinations).

So I think multilib is mostly legacy at this time, it sticks around though because important packages still nedd it to build.

🌐
Debian
packages.debian.org › sid › gcc-multilib
Debian -- Details of package gcc-multilib in sid
A dependency package on architectures with multilib support; the package contains dependencies for the non-default multilib architecture(s).
Discussions

Hi, does anyone know why I can't install the package gcc-multilib on Ubuntu 20.04? It is absolutly necessary for starting a Yocto project. Does anyone know how I can fix this? (see DockerFile in description) Thanks for the support!
my mac M1 The gcc-multilib package isn't available for arm64 platforms. You will need to build an amd64 image instead, check the buildx documentation on how to do this. More on reddit.com
🌐 r/docker
4
3
February 6, 2023
Ubuntu 16.04: apt fails when installing gcc-multilib
Description When trying to install gcc-multilib apt fails with the following error: The following packages have unmet dependencies: gcc-multilib : Depends: gcc-5-multilib (>= 5.3.1-3~) but it is no... More on github.com
🌐 github.com
16
March 13, 2021
How to install gcc-multilib on ubuntu 22.04 in docker on M1 Mac - Stack Overflow
I tried to install gcc-multilib in the ubuntu:22.04 docker container on my M1 Mac. But I tried $apt-get update && apt-get install gcc-multilib. It showed the following error Package gcc-mul... More on stackoverflow.com
🌐 stackoverflow.com
Switching from gcc to gcc-multilib
As far as i know the normal gcc package contains gcc-multilib. More on reddit.com
🌐 r/archlinux
8
0
April 16, 2018
🌐
Ubuntu
launchpad.net › ubuntu › jammy › +package › gcc-multilib
gcc-multilib : Jammy (22.04) : Ubuntu
This is the GNU C compiler, a fairly portable optimizing compiler for C. . A dependency package on architectures with multilib support; the package contains dependencies for the non-default multilib architecture(s).
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › troubleshooting
Cannot install gcc-multilib - Raspberry Pi Forums
To build app in 32 bit from a machine with 64 bit: sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib ... pi@raspberrypi:~/Teleprompter 32-bit/Teleprompter-Electron $ sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib Reading package lists...
🌐
Berkeley
wiki.eecs.berkeley.edu › ptexternal › Main › PtolemyClassic
Ptolemy Group External | Main / PtolemyClassic
September 27, 2015 - Ptolemy Classic requires an old version of C++, below are the steps I took under Ubuntu · Based on http://www.trevorpounds.com/blog/?p=111 (PDF)
🌐
Reddit
reddit.com › r/docker › hi, does anyone know why i can't install the package gcc-multilib on ubuntu 20.04? it is absolutly necessary for starting a yocto project. does anyone know how i can fix this? (see dockerfile in description) thanks for the support!
r/docker on Reddit: Hi, does anyone know why I can't install the package gcc-multilib on Ubuntu 20.04? It is absolutly necessary for starting a Yocto project. Does anyone know how I can fix this? (see DockerFile in description) Thanks for the support!
February 6, 2023 -

For the people that doesn't know a lot about Yocto, here's a link : https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html

I've done this configuration on my Ubuntu 20.04 machine, but now I want to create a docker image so that I can use my mac M1 to make the processing way faster (My Ubuntu machine is an old Pentium 4).

FROM ubuntu:20.04

RUN apt-get update
&& apt-get -y install curl
&& apt-get install -y openssh-server
&& apt-get install -y gcc-multilib \

The error message is the following one:

#8 24.20 Reading package lists...
#8 24.92 Building dependency tree...
#8 25.04 Reading state information...
#8 25.05 Package gcc-multilib is not available, but is referred to by another package.
#8 25.05 This may mean that the package is missing, has been obsoleted, or
#8 25.05 is only available from another source
#8 25.05 
#8 25.06 E: Package 'gcc-multilib' has no installation candidate
🌐
GNU
gcc.gnu.org › install › prerequisites.html
Prerequisites for GCC - GNU Project
January 7, 2026 - In order to build GCC, the C standard library and headers must be present for all target variants for which target libraries will be built (and not only the variant of the host C++ compiler). This affects the popular ‘x86_64-pc-linux-gnu’ platform (among other multilib targets), for which ...
Find elsewhere
🌐
Arch Linux
aur.archlinux.org › packages › gcc44-multilib
AUR (en) - gcc44-multilib
Hi @itachisan this is my gcc49-multilib pkgbuild http://sl1pkn07.wtf/paste/view/637decd3 is like your gcc44-multilib but with some changes to build gcc4.9.3. i'm not sure if i missing something. not use a gcc49-multilib from [aur] because is a replace of gcc-multilib for [multilib] repositories.
🌐
GitHub
github.com › actions › runner-images › issues › 2917
Ubuntu 16.04: apt fails when installing gcc-multilib · Issue #2917 · actions/runner-images
March 13, 2021 - Description When trying to install gcc-multilib apt fails with the following error: The following packages have unmet dependencies: gcc-multilib : Depends: gcc-5-multilib (>= 5.3.1-3~) but it is no...
Author   mole99
🌐
Stack Overflow
stackoverflow.com › questions › 77255695 › how-to-install-gcc-multilib-on-ubuntu-22-04-in-docker-on-m1-mac
How to install gcc-multilib on ubuntu 22.04 in docker on M1 Mac - Stack Overflow
I tried to install gcc-multilib in the ubuntu:22.04 docker container on my M1 Mac. But I tried $apt-get update && apt-get install gcc-multilib. It showed the following error Package gcc-mul...
🌐
Debian
packages.debian.org › unstable › gcc-multilib-i686-linux-gnu
Debian -- Details of package gcc-multilib-i686-linux-gnu in sid
This is the GNU C compiler, a fairly portable optimizing compiler for C · This is a dependency package providing the default GNU C cross-compiler for the i386 architecture
🌐
GNU
gcc.gnu.org › install › configure.html
Installing GCC: Configuration - GNU Project
January 10, 2026 - Such files enable custom, user-chosen multilib lists to be configured. Whether multiple such files can be used together depends on the contents of the supplied files. See gcc/config/arm/t-multilib and its supplementary gcc/config/arm/t-*profile files for an example of what such Makefile fragments might look like for this version of GCC.
🌐
Akeo
pete.akeo.ie › 2010 › 07 › compiling-mingw-w64-with-multilib-on.html
Pete's Blog: Compiling MinGW-w64 with multilib on Linux
July 11, 2010 - cd ..; mkdir gcc-build; cd gcc-build ../gcc-4.5.0/configure --disable-nls --target=x86_64-w64-mingw32 --enable-languages=c,c++ --with-system-zlib --enable-multilib --enable-version-specific-runtime-libs --enable-shared --enable-fully-dynamic-string OK, a little clarification about our configure options:
🌐
Reddit
reddit.com › r/archlinux › switching from gcc to gcc-multilib
r/archlinux on Reddit: Switching from gcc to gcc-multilib
April 16, 2018 -

I don't get how I'm supposed to do this. When installing over yaourt the compilation fails and (frustratingly) doesn't cache anything meaning I have to redo the 2hr+ process where my CPU is consistently hotter than 75C to get to the failure point.

Over pacman I try to remove gcc just for every dependency and their mother to complain that it needs gcc.

This is frustrating, is there a source download where I could compile and install it manually so I'm not at the mercy of yaourt or pacman?

For the record all I am trying to do is build the PCSX2 project from source with a different Video plugin as the standard GSL plugin has issues with hardware rendering on Intel HD Cards (because Intel sucks at driver support). This single issues is making me want to dust off my Windows Desktop but I'd prefer to have a decent emulator setup on my Linux laptop.

Here's the output of pacman -Qs gcc, I have the libs from multilib which I think I have to first remove before I can switch over since I remember reading gcc vs multilib is all or nothing.

local/gcc 7.3.1+20180312-2 (base-devel)

The GNU Compiler Collection - C and C++ frontends

local/gcc-ada 7.3.1+20180312-2

Ada front-end for GCC (GNAT)

local/gcc-libs 7.3.1+20180312-2 (base)

Runtime libraries shipped by GCC

local/lib32-gcc-libs 7.3.1+20180312-2 (multilib-devel)

32-bit runtime libraries shipped by GCC

I haven't updated in a week don't yell at me if my packages are out of date.

🌐
Google Groups
groups.google.com › g › linux.debian.bugs.dist › c › S4eraIyuuzk
Bug#872891: gcc-multilib conflicts with GCC cross toolchains
If I attempt to solve the problem by installing gcc-multilib using # apt-get install -t testing gcc-multilib it wants to remove the arm and i686 cross compilers (but not the mingw cross compilers), The following packages will be REMOVED: gcc-10-arm-linux-gnueabihf gcc-10-i686-linux-gnu gcc-10-multilib-i686-linux-gnu gcc-arm-linux-gnueabihf gcc-i686-linux-gnu gcc-multilib-i686-linux-gnu Regarding the mentioned conflict over /usr/include/asm, I don't have that directory at all on this machine.
🌐
WordGrinder
cowlark.com › 2009-07-04-building-gcc › index.html
A short guide to building a gcc cross-compiler
July 4, 2009 - --enable-multilib tells gcc to build versions of its run-time library for all different configurations of the target. In particular, for ARM this means you'll get a libgcc for both ARM and Thumb.
🌐
GNU
gcc.gnu.org › onlinedocs › gccint › Target-Fragment.html
Target Fragment (GNU Compiler Collection (GCC) Internals)
For these targets, you must arrange for multiple versions of libgcc.a to be compiled, one for each set of incompatible options. When GCC invokes the linker, it arranges to link in the right version of libgcc.a, based on the command line options used. The MULTILIB_OPTIONS macro lists the set ...
🌐
GitHub
github.com › travis-ci › travis-ci › issues › 5670
Odd behavior when installing gcc-multilib on trusty · Issue #5670 · travis-ci/travis-ci
February 21, 2016 - install: - sudo apt-get install -y gcc-multilib - sudo apt-get install -y zlib1g-dev:i386
Author   LRFLEW