Re: Why does dpkg-shlibdeps look at the target architecture?

Helmut Grohne <[email protected]>
Newsgroups gmane.linux.debian.devel.dpkg.general,gmane.linux.debian.ports.hurd
Message-ID <[email protected]>
Hi Guillem and Raphaël,

thank you two for jumping into it right away.

On Wed, Jul 09, 2025 at 01:26:27PM +0200, Guillem Jover wrote:
> On Wed, 2025-07-09 at 12:39:12 +0200, Raphael Hertzog wrote:
> > On Wed, 09 Jul 2025, Helmut Grohne wrote:
> > So this part was added as part of the discussion in this bug report:
> > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453267
> 
> Right, was about to post the same reference. :)

Thank you. Right in message #73 and later message #93 Raphaël questions 
precisely the code in question. In the later conversation, and message 
#78 in particular, we see that gcc did not override DEB_HOST_ARCH for 
dpkg-shlibdeps back then. There was a bit back and forth 
whether gcc could be updated to convey the architecture it is interested 
in more sanely, but the original approach ended up being merged.

The -$DEB_TARGET_ARCH-cross packages that were mentioned there are still being 
built (unless applying the with_deps_on_target_arch_pkgs patchset and 
then they become :$DEB_TARGET_ARCH). Either way, gcc precisely tells 
apart what packages are meant to be target ones and for each of those it 
now (but now back then) changes DEB_HOST_ARCH to target for the 
dh_shlibdeps invocation.

> …and from a quick skim over that report, I think this might have been
> needed to support old gcc versions that had not yet been fixed to
> use the expected variables (see messages #73 and forward)? (But this
> was really a quick skim, so might have read the details wrong, as the
> report is quite long.) Will try to recheck later today.

I concur. This fully matches my understanding (see above).

> > The right thing to try to validate whether we can remove the code is
> > building a cross-compiler (and not cross-building a compiler).

Running rebootstrap starts out with building a stage1 cross compiler, 
glibc stage2 and then a stage3 gcc cross compiler. Admittedly, it limits 
the amount of frontends to C, C++ and Fortran leaving out most other 
frontends. So building a full gcc-14-cross with that patch applied is 
something I likely should do still. Thankfully, we now have Debusine. :)

https://debusine.debian.net/debian/developers/work-request/119889/ is a 
dpkg workflow and a gcc one shall go later.

> Yes, I don't see rebootstrap using dpkg-buildpackage --target-arch for
> anything except GNU mig?

That is correct. The gcc source packages refuse to support 
DEB_TARGET_ARCH and you have to convey the target architecture via 
debian/target. In the end, it internally sets DEB_TARGET_* 
appropriately.

> Ideally, we'd test both a cross-compiler build (build == host != target)
> and a canadian cross-compiler build (build != host != target).

I'm not sure canadian builds are supported at all. Do note that the 
canadian build should be unaffected. If build != host, $multiarch is 
overwritten and it no longer matters whether we set it when build != 
target. I argue that the proposed change does not affect canadian 
builds.

Helmut
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.