[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1065416: [Cross-toolchain-base-devs] Bug#1065416: linux-libc-dev claims to provide linux-libc-dev-ARCH-cross, but it doesn't do that completely



Hi Bastian,

On Mon, Mar 04, 2024 at 12:30:09PM +0100, Bastian Blank wrote:
> On Mon, Mar 04, 2024 at 12:07:15PM +0100, Matthias Klose wrote:
> > On 04.03.24 11:29, Bastian Blank wrote:
> > > On Mon, Mar 04, 2024 at 08:53:11AM +0100, Matthias Klose wrote:
> > > > However the links in /usr/DEB_HOST_GNU_TYPE/include are missing.
> > > 
> > > Please be a bit more precise, there are no symlinks in this directory.
> > > | # dpkg -S /usr/alpha-linux-gnu/include/asm/a.out.h
> > > | linux-libc-dev-alpha-cross: /usr/alpha-linux-gnu/include/asm/a.out.h
> > > | # find /usr/alpha-linux-gnu/include/ -type l
> > > | #
> > yes, that is the problem. the cross gcc expects these headers in
> > /usr/alpha-linux-gnu/include, not in the header location for the host.
> 
> Please show your problem with a log, my crystal ball is broken.

This very much was not obvious to me either. I've now talked to Matthias
and believe I can explain the problem.

The packaged gcc cross toolchain uses a sysroot during its own build
still. As it is implemented now, it searches /usr/<triplet>/include, but
not /usr/include/<multiarch>. So quite fundamentally, the Provides that
we two agreed do break the build of cross toolchains right now.

Arguably, a cross toolchain build should probably search
/usr/include/<multiarch>. I went back and forth a bit with Matthias
about whether we could add this and did not fully understand his
reasons, but there is one technical reason we want to avoid it for now.
We can have both libc6-dev:TARGET and libc6-dev-TARGET-cross installed
and these packages can have differing versions. When that happens and we
search both /usr/<triplet>/include and /usr/include/<multiarch>, we'd
mix two glibc versions with usually bad results (been there).

While we might consider adding /usr/include/<multiarch> to the cross
toolchain build search path later, it is not something we can do now and
before doing that, we need to better understand Matthias' reasons for
keeping these separate as well.

The other aspect here is that it is not sufficient to add
/usr/include/<multiarch> to the search path as you also need
/usr/include to get a complete linux kernel headers experience. We
definitely do not want to add /usr/include, because that is known to
misguide configure tests performed for the target architecture. In
principle, we could extend the symlink farm in linux-libc-dev to also
have a lot of /usr/include/<multiarch>/linux -> ../linux symlinks
(assuming that no other package ever installs to /usr/include/linux,
which is a property violated by aufs-dev and oss4-dev).

So at least for now, I am convinced that we will need
/usr/<triplet>/include to be provided by the package providing
linux-libc-dev-arch-cross.

As these are only necessary for building the cross toolchains, we
probably don't want these in the main linux-libc-dev package. So how
about adding a linux-libc-dev-cross package with yet more symlinks? Then
we can move the provides over to the linux-libc-dev-cross package and
that way repair the cross toolchain builds.

I requested that linux-libc-dev provides these for bootstrapping to know
which architectures linux-libc-dev actually supports. I don't need these
provides exactly, I just need a mechanism to answer the question "Does
linux-libc-dev work for a particular architecture?" from the binary
package metadata, so we might just change the Provides there to
linux-libc-dev-arch dropping the -cross suffix that traditionally
identified packages putting stuff into /usr/<triplet>. Does that sound
reasonable to you?

That still leaves the question of which package would have to build that
new linux-libc-dev-cross. The two obvious answers are linux and
cross-toolchain-base. Do you have a preference here?

I hope this all makes more sense now.

Helmut


Reply to: