Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#872891: gcc-multilib conflicts with GCC cross toolchains

775 views
Skip to first unread message

Aaron Marcher

unread,
Aug 22, 2017, 4:30:03 AM8/22/17
to
Package: gcc-multilib
Version: 4:6.3.0-4

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).

Matthias Klose

unread,
Aug 22, 2017, 10:20:03 AM8/22/17
to
Control: tags -1 + wontfix

On 22.08.2017 10:10, Aaron Marcher wrote:
> Package: gcc-multilib
> Version: 4:6.3.0-4
>
> 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.

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

Mathieu Malaterre

unread,
Aug 22, 2017, 11:10:03 AM8/22/17
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,

Niels Möller

unread,
Sep 21, 2020, 4:30:03 PM9/21/20
to
Hi,

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

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

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

--
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.

Josh Triplett

unread,
Apr 29, 2021, 10:40:04 PM4/29/21
to
On Mon, 21 Sep 2020 22:11:59 +0200 ni...@lysator.liu.se (Niels =?utf-8?Q?M=C3=B6ller?=) wrote:
> Hi,
>
> in 2017, Matthias Klose marked this bug as wontfix, and explained the
> problem like this:
>
> > because the cross toolchain has /usr/include on it's include path,
> > which has incompatible header files: /usr/include/asm.
>
> Is that still the case, a few years later?

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.

Matthias Klose

unread,
May 3, 2021, 7:10:03 AM5/3/21
to
> > Is that still the case, a few years later?
>
> 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.

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.

Josh Triplett

unread,
May 3, 2021, 5:10:03 PM5/3/21
to
On Mon, May 03, 2021 at 12:56:58PM +0200, Matthias Klose wrote:
> > > Is that still the case, a few years later?
> >
> > 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.
>
> yes, it's still the case. Nobody is working on that.

Is this something for which patches would be accepted for the GCC
packaging?

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

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

Matthias Klose

unread,
May 4, 2021, 7:00:04 AM5/4/21
to
On 5/3/21 10:58 PM, Josh Triplett wrote:
> On Mon, May 03, 2021 at 12:56:58PM +0200, Matthias Klose wrote:
>>>> Is that still the case, a few years later?
>>>
>>> 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.
>>
>> yes, it's still the case. Nobody is working on that.
>
> Is this something for which patches would be accepted for the GCC
> packaging?

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

>> Note that you can also install gcc-i686-linux-gnu to build 32bit x86 code.
>
> I realize that, but that doesn't work for software that assumes it can
> use -m32.

write a wrapper package.

Matthias

Vincent Danjean

unread,
Nov 16, 2021, 6:20:03 PM11/16/21
to
Package: gcc-multilib
Version: 4:11.2.0-2
Followup-For: Bug #872891

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

-- System Information:
Debian Release: bookworm/sid
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldstable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel, mipsel

Kernel: Linux 5.14.0-4-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gcc-multilib depends on:
ii cpp 4:11.2.0-2
ii gcc 4:11.2.0-2
ii gcc-10-multilib 10.3.0-12
ii gcc-11-multilib 11.2.0-10
ii gcc-8-multilib 8.4.0-6
ii linux-libc-dev 5.14.16-1

gcc-multilib recommends no packages.

gcc-multilib suggests no packages.
0 new messages