#872891 gcc-multilib conflicts with GCC cross toolchains

Package:
gcc-multilib
Source:
gcc-defaults
Description:
GNU C compiler (multilib files)
Submitter:
Aaron Marcher
Date:
2026-08-17 13:21:02 UTC
Severity:
normal
Tags:
#872891#5
Date:
2017-08-22 08:10:12 UTC
From:
To:
The package gcc-multilib conflicts with any GCC cross toolchains (for
example "gcc-aarch64-linux-gnu"). As far as I understood it, it is not
possible to build 32-bit binaries on a 64-bit system (using -m32 flag)
when a GCC cross toolchain is installed.

I am using Debian Stretch (stable).

#872891#10
Date:
2017-08-22 14:11:59 UTC
From:
To:
Control: tags -1 + wontfix

because the cross toolchain has /usr/include on it's include path, which has
incompatible header files: /usr/include/asm.

#872891#17
Date:
2017-08-22 15:05:24 UTC
From:
To:
Hi,

Can't this be configured to something else (eg. /usr/include/foobar/asm ) ?

If I understand OP correctly, the goal is simply to have multiple
compilers installed this seems to work fine for
crossbuild-essential-*, so it would be nice to also have it for
gcc-multilib. Does this means we need a new package:
crossbuild-essential-i386 to get both `gcc -m32 (gcc-i386-linux-gnu)`
and `gcc-aarch64-linux-gnu` installed at the same time ?

Thanks for clarification,

#872891#22
Date:
2020-09-21 20:11:59 UTC
From:
To:
Hi,

in 2017, Matthias Klose marked this bug as wontfix, and explained the
problem like this:

Is that still the case, a few years later? I have an x86_64 machine with
debian buster + gcc-10 and cross compilers from "bullseye" (testing),
and no /usr/include/asm at all. I have the following gcc packages
installed:

ii  gcc                                   4:10.1.0-1     amd64        GNU C compiler
ii  gcc-10                                10.2.0-7       amd64        GNU C compiler
ii  gcc-10-arm-linux-gnueabihf            10.2.0-3cross2 amd64        GNU C compiler (cross compiler for armhf architecture)
ii  gcc-10-arm-linux-gnueabihf-base:amd64 10.2.0-3cross2 amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-10-base:amd64                     10.2.0-7       amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-10-base:armhf                     10.2.0-7       armhf        GCC, the GNU Compiler Collection (base package)
ii  gcc-10-cross-base                     10.2.0-3cross2 all          GCC, the GNU Compiler Collection (library base package)
ii  gcc-10-i686-linux-gnu                 10.2.0-3cross2 amd64        GNU C compiler (cross compiler for i386 architecture)
ii  gcc-10-i686-linux-gnu-base:amd64      10.2.0-3cross2 amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-10-multilib                       10.2.0-7       amd64        GNU C compiler (multilib support)
ii  gcc-10-multilib-i686-linux-gnu        10.2.0-3cross2 amd64        GNU C compiler (multilib support) (cross compiler for i386 architecture)
ii  gcc-8                                 8.4.0-4        amd64        GNU C compiler
ii  gcc-8-base:amd64                      8.4.0-4        amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-9-base:amd64                      9.3.0-18       amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-arm-linux-gnueabihf               4:10.1.0-1     amd64        GNU C compiler for the armhf architecture
ii  gcc-i686-linux-gnu                    4:10.1.0-1     amd64        GNU C compiler for the i386 architecture
ii  gcc-mingw-w64                         10.1.0-3+23    all          GNU C compiler for MinGW-w64
ii  gcc-mingw-w64-base                    10.1.0-3+23    amd64        GNU Compiler Collection for MinGW-w64 (base package)
ii  gcc-mingw-w64-i686                    10.1.0-3+23    all          GNU C compiler for MinGW-w64 targeting Win32
ii  gcc-mingw-w64-i686-posix              10.1.0-3+23    amd64        GNU C compiler for MinGW-w64, Win32/POSIX
ii  gcc-mingw-w64-i686-posix-runtime      10.1.0-3+23    amd64        GNU Compiler Collection for MinGW-w64, i686/posix
ii  gcc-mingw-w64-i686-win32              10.1.0-3+23    amd64        GNU C compiler for MinGW-w64, Win32/Win32
ii  gcc-mingw-w64-i686-win32-runtime      10.1.0-3+23    amd64        GNU Compiler Collection for MinGW-w64, i686/win32
ii  gcc-mingw-w64-x86-64                  10.1.0-3+23    all          GNU C compiler for MinGW-w64 targeting Win64
ii  gcc-mingw-w64-x86-64-posix            10.1.0-3+23    amd64        GNU C compiler for MinGW-w64, Win64/POSIX
ii  gcc-mingw-w64-x86-64-posix-runtime    10.1.0-3+23    amd64        GNU Compiler Collection for MinGW-w64, x86-64/posix
ii  gcc-mingw-w64-x86-64-win32            10.1.0-3+23    amd64        GNU C compiler for MinGW-w64, Win64/Win32
ii  gcc-mingw-w64-x86-64-win32-runtime    10.1.0-3+23    amd64        GNU Compiler Collection for MinGW-w64, x86-64/win32
ii  gcc-multilib-i686-linux-gnu           4:10.1.0-1     amd64        GNU C compiler for the i386 architecture
ii  lib32gcc-10-dev                       10.2.0-7       amd64        GCC support library (32 bit development files)
ii  lib32gcc-s1                           10.2.0-7       amd64        GCC support library (32 bit Version)
ii  lib64gcc-10-dev-i386-cross            10.2.0-3cross2 all          GCC support library (64bit development files)
ii  lib64gcc-s1-i386-cross                10.2.0-3cross2 all          GCC support library (i386) (64bit)
ii  libgcc-10-dev:amd64                   10.2.0-7       amd64        GCC support library (development files)
ii  libgcc-10-dev-armhf-cross             10.2.0-3cross2 all          GCC support library (development files)
ii  libgcc-10-dev-i386-cross              10.2.0-3cross2 all          GCC support library (development files)
ii  libgcc-8-dev:amd64                    8.4.0-4        amd64        GCC support library (development files)
ii  libgcc-s1:amd64                       10.2.0-7       amd64        GCC support library
ii  libgcc-s1:armhf                       10.2.0-7       armhf        GCC support library
ii  libgcc-s1-armhf-cross                 10.2.0-3cross2 all          GCC support library (armhf)
ii  libgcc-s1-i386-cross                  10.2.0-3cross2 all          GCC support library (i386)
ii  libx32gcc-10-dev                      10.2.0-7       amd64        GCC support library (x32 development files)
ii  libx32gcc-10-dev-i386-cross           10.2.0-3cross2 all          GCC support library (x32 development files)
ii  libx32gcc-s1                          10.2.0-7       amd64        GCC support library (x32)
ii  libx32gcc-s1-i386-cross               10.2.0-3cross2 all          GCC support library (i386) (x32)

I'm trying to compile the following hello.c program:

  #include <stdio.h>
  #include <errno.h>
  int main(int argc, char **argv) { printf("foo\n"); return 0; }

It works fine to compile it using

  $ i686-linux-gnu-gcc hello.c

and that produces a 32-bit executable. However, with gcc -m32 I get

  $ gcc -m32 hello.c
  In file included from /usr/include/bits/errno.h:26,
                   from /usr/include/errno.h:28,
                   from hello.c:2:
  /usr/include/linux/errno.h:1:10: fatal error: asm/errno.h: No such file
  or directory
      1 | #include <asm/errno.h>
        |          ^~~~~~~~~~~~~
  compilation terminated.

(If I delete the errno.h include, it works, so it seems to only be a
problem with certain system header files missing). 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. Related existing directories are

  /usr/include/asm-generic/ (package linux-libc-dev:amd64)
  /usr/include/x86_64-linux-gnu/asm (also package linux-libc-dev:amd64)
  /usr/i686-linux-gnu/include/asm/ (linux-libc-dev-i386-cross)
  /usr/arm-linux-gnueabihf/include/asm (linux-libc-dev-armhf-cross)

So the files belonging to the cross compiler packages shouldn't be in
the way, as far as I can tell. And I guess the proper location for the
missing asm/errno.h would be in /usr/include/i386-linux-gnu/asm/, but I
haven't been able to find what's the proper package to install to get
that directory (maybe linux-libc-dev:i386, but it's a bit unexpected to
have to add i386 as a foreign architecture just to get gcc -m32 to
work)?

Vagely related, I have duplicate, but not interfering, copies of some
foreign libc library files, e.g, I have both

  /lib/arm-linux-gnueabihf/libc-2.31.so (package libc6:armhf)
  /usr/arm-linux-gnueabihf/lib/libc-2.31.so (package libc6-armhf-cross)

I think the latter is needed by the cross compiler, and the former for
running arm binaries using qemu-arm. That's slightly annoying and a bit
wasted disk usage, but not causing any errors once I realized that both
packages are needed.

Regards,
/Niels

#872891#27
Date:
2021-04-30 02:27:53 UTC
From:
To:
I'm running into this issue as well. I'd like to be able to
cross-compile for aarch64, and I'd also like gcc -m32 to continue
working.

#872891#32
Date:
2021-05-03 10:56:58 UTC
From:
To:
yes, it's still the case. Nobody is working on that.

Note that you can also install gcc-i686-linux-gnu to build 32bit x86 code.

#872891#37
Date:
2021-05-03 20:58:14 UTC
From:
To:
Is this something for which patches would be accepted for the GCC
packaging?

I realize that, but that doesn't work for software that assumes it can
use -m32.

#872891#42
Date:
2021-05-04 10:54:27 UTC
From:
To:
this is not about gcc packaging, but moving the glibc and kernel headers in
multiarch-compatible locations, and outside of /usr/include for the non-default
multilib builds

write a wrapper package.

Matthias

#872891#47
Date:
2021-11-16 23:09:24 UTC
From:
To:
  Hi,

  I also have been hit by this bug.
I'm using several cross-tool chains (arm-linux-gnueabi, mipsel-linux-gnu,
i686-linux-gnu) and I was wondering why using plain gcc with -m32 does
not work.
  Perhaps due to the fact that gcc-i686-linux-gnu was installed, I successfully
compile a basic C program (the one given in this bug report) but the link
fails ("gcc -m32" was looking only in x86_64 directory to find gcc libs and
objects)
  I first workaround this by looking at the LIBRARY_PATH of i686-linux-gnu-gcc
(adding "-v" when compiling to see the info), and I successfully link with
LIBRARY_PATH=...value_I_read... gcc -m32 file.o -o file

  Digging a bit more, I saw that gcc-multilib is an empty package with
a few dependencies and lots of conflicts. Only one dependencies was missing
on my system: gcc-11-multilib
  I tried to install it directly, the install succeeded (no conflicts for
gcc-11-multilib).
  And then, I discovered that "gcc -m32" works for both compiling and linking.

  So I'm really wondering why there are all these conflicts in gcc-multilib
(perhaps,  I works on my system because I also have several *:i386 packages
installed, or perhaps it works 'by chance' mixing files from different packages
that should not...)
  In anycase, for people that wish to have both cross chains and "gcc -m32"
working, manually installing the gcc-XX-multilib package for the current
compiler might be a solution.

  Regards
    Vincent

#872891#52
Date:
2026-08-17 13:19:07 UTC
From:
To:
Hi,

I'm not sure if something have changed regarding the conflicts
declarations with the packaging of gcc-15. I now have these gcc-15
packages installed, with no complaints about conflicts:

  $ dpkg -l '*gcc-15*' |grep ^i
  ii  gcc-15                            15.3.0-2       amd64        GNU C compiler
  ii  gcc-15-base:amd64                 15.3.0-2       amd64        GCC, the GNU Compiler Collection (base package)
  ii  gcc-15-cross-base                 15.3.0-2cross1 all          GCC, the GNU Compiler Collection (library base package)
  ii  gcc-15-multilib                   15.3.0-2       amd64        GNU C compiler (multilib support)
  ii  gcc-15-s390x-linux-gnu            15.3.0-2cross1 amd64        GNU C compiler for the s390x-linux-gnu architecture
  ii  gcc-15-s390x-linux-gnu-base:amd64 15.3.0-2cross1 amd64        GCC, the GNU Compiler Collection (base package)
  ii  gcc-15-x86-64-linux-gnu           15.3.0-2       amd64        GNU C compiler for the x86_64-linux-gnu architecture
  ii  lib32gcc-15-dev                   15.3.0-2       amd64        GCC support library (32 bit development files)
  ii  libgcc-15-dev:amd64               15.3.0-2       amd64        GCC support library (development files)
  ii  libgcc-15-dev-s390x-cross         15.3.0-2cross1 all          GCC support library (development files)
  ii  libx32gcc-15-dev                  15.3.0-2       amd64        GCC support library (x32 development files)

I looks like there are still conflict declarations regarding the
gcc-multilib dependency package, which I avoided by instead installing
the intermediate dependency package gcc-15-multilib.

The curious thing is that it now seems to work fine to compile and run a
program like

  #include <stdio.h>
  #include <stdlib.h>

  int
  main (void)
  {
    printf("hello!\n");
  #if 0
    return 0;
  #else
    exit (0);
  #endif
  }

with gcc -m32 hello.c. But if I let the main function return (change
"#if 0" above to "#if 1"), I get

  $ gcc -Wall -g -m32 hello.c
  $ ./a.out
  hello!
  Segmentation fault

I would hope this selection of packages is expected to work (since there
are no declared conflicts), and there's some bug (e.g., might be related
to linking the correct startup code) that needs fixing?

Finally, I can check that the cross-compile setup appear to also be in
working shape,

  $ s390x-linux-gnu-gcc-15 hello.c
  $ QEMU_LD_PREFIX=/usr/s390x-linux-gnu qemu-s390x ./a.out
  hello!

Regards,
/Niels