Stephen Kitt:
> On Thu, 8 Apr 2021 13:11:46 +0100, Ximin Luo <[email protected]> wrote:
>>> On Thu, 08 Apr 2021 01:35:49 +0100, Ximin Luo <[email protected]>
>>> wrote:
>>>> Please mark gcc-mingw-w64-base "Multi-Arch: same" so that different
>>>> architectures can be co-installed. This is necessary to support
>>>> co-installing the i686 and x86-64 toolchain packages, both of which
>>>> depend on this package but for their respective architectures.
>>>>
>>>> As far as I can tell this package has the same content on all
>>>> architectures, so this should be safe:
>>>> https://wiki.debian.org/MultiArch/Hints#set_Multi-Arch:_same
>>>
>>> It should be, yes, but I’m curious about why you’d want to install the
>>> packages for both architectures simultaneously. Could you explain the
>>> scenario?
>>
>> Hi, yes my scenario is to co-install both libstd-rust-dev-windows:i386 and
>> libstd-rust-dev-windows:amd64 so that my rustc can cross-compile to both
>> 32-bit and 64-bit windows at the same time.
>
> OK, I understand. I didn’t follow that route with the GCC MinGW-w64 package
> because my initial goal (still relevant, albeit not something I’ll have time
> to work on in the foreseeable future) was to add real arches for the targets,
> so the library packages would ultimately have been :win32 and :win64 (or
> something like that).
>
By "that route" do you mean the fact that I have a single package name
libstd-rust-dev-windows:$arch ?
To avoid a potential misunderstanding - this works for LLVM-based compilers
only, not GCC-based compilers like MinGW. In other words, I think what you are
doing currently with gcc-mingw-w64 is fine (except for the missing Multi-Arch
labels, as per this bug) and it matches how the regular gcc cross compilers
work, i.e. they are named
gcc-$target:$host
e.g.
gcc-powerpc-linux-gnu:{amd64, i386, .. etc}
gcc-mingw-w64-i686-posix:{amd64, i386, .. etc}
With LLVM-based compilers such as rustc, there is no need to build a separate
"cross compiler", rustc itself via LLVM already has the ability to
cross-compile to any target. What you need to install however is the standard
library for each target architecture that you want to cross-compile to, and
this is the same regardless of whatever host architecture you are compiling on,
so our packages are named like:
libstd-rust-dev:$target
libstd-rust-dev-windows:$target
(The latter convention for the windows packages is a slight hack because
"windows" isn't a Debian architecture, but it works for now.)
Regardless of what host architecture you are compiling from, you just need to
install rustc:$host and libstd-rust-dev:$target.
However with a GCC-based compiler you really do need separate gcc-$target:$host
packages. For example if you are on ARM64 and you wanted to cross-compile to
windows i686 and x86-64, you would need to install
gcc-mingw-w64-i686-posix:arm64 and gcc-mingw-w64-x86-64-posix:arm64, so in this
case it is essential that you do actually have separate packages
gcc-mingw-w64-i686-posix:$host and gcc-mingw-w64-x86-64-posix:$host, and don't
merge them into one package name.
>> To do that, I need to co-install both gcc-mingw-w64-i686-posix:i386 and
>> gcc-mingw-w64-x86-64-posix, but this is not yet possible due to this bug.
>>
>> Alternatively (and thinking about it, you should probably both), you can
>> mark the compiler packages gcc-mingw-w64-*-* as "Multi-Arch: foreign" -
>> this would e.g. allow gcc-mingw-w64-i686-posix:amd64 to satisfy the
>> dependency from libstd-rust-dev-windows:i386 -> gcc-mingw-w64-i686-posix
>> [no explicit architecture annotation] - without Multi-Arch: foreign, this
>> dependency can only be satisfied by "gcc-mingw-w64-i686-posix:i386". It
>> seems that gcc-mingw-w64-i686-posix:amd64 gcc-mingw-w64-x86-64-posix:amd64
>> are already co-installable, so this would work for me too.
>>
>> Multi-Arch: foreign is what the gcc cross-compilers do, e.g.
>> gcc-powerpc-linux-gnu. So in summary, amending my original instructions:
>>
>> - Multi-Arch: foreign - gcc-mingw-w64-*-*
>> - Multi-Arch: same - gcc-mingw-w64-base - in fact the Debian QA Multi-Arch
>> hinter[1] goes a step further, it suggests you convert this package to
>> Architecture: all and mark it Multi-Arch: foreign; I'm not sure why this
>> package is arch-dependent in the first place.
>>
>> [1]
>> https://qa.debian.org/[email protected]&piuparts=1#gcc-mingw-w64
>
> The reason -base is arch-dependent is that it carries the changelog for all
> the arch-dependent packages, so it has to remain arch-dependent to provide
> binNMU changelogs. I’m somewhat reliant on binNMUs for GCC updates so I’d
> rather keep it that way.
>
>> (Note, libstd-rust-dev-windows:i386 doesn't exist in the Debian FTP archive
>> yet, but I'm testing it locally - I'm only now just getting around to
>> updating the rustc package to support cross-compiling to 32-bit windows
>> after you fixed #540782, so thanks for that.)
>
> So that means all this is not for Bullseye, right? That’s somewhat
> reassuring ;-).
>
Yes this is not for bullseye. It is just adding Multi-Arch: to debian/control
though so I hope it can be done quickly. :)
Best,
X
--
GPG: ed25519/56034877E1F87C35
https://github.com/infinity0/pubkeys.git