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

Re: Cross build fails for multiarch=no



Hi

On Wed, Mar 29, 2023 at 10:21:00PM +0000, Henry Nestler wrote:
> because I falling into multiple problems while cross compiling, I send my questions here, instead to single developer of every package or build tool.
> 
> I'm trying to create a native Debian arch i586. I know, this arch is not new. It's old, and not official supported by Debian. I need this, because all x86 architectures are mapped to i686 compiler output. This would fail on CPU, that only supports code up to i586.

This is what rebootstrap was meant for.

> I used "helmutg/rebootstrap" to automate the Debian boot strapping.
> I patched some files, to not map Debian arch i586 into GNU arch i686.
> My build script exist here: https://salsa.debian.org/hne-ssv/rebootstrap

A lot of patches deal with /usr/include/<triplet> not being on the
default compiler search path. This is a really odd way to approach the
problem as that is a quite fundamental assumption. I strongly recommend
to instead fix the compiler. That's way less work than patching all the
packages.

> The first error:
> gcc:
>     CONFARGS += \
>         --includedir=/$(PFL)/include
> 
>     is set in debian/rules2.
>     PFL is /usr/<triplet>. So, only /usr/<triplet>/include was set as includedir.
> 
>     This ends with a missing stdio.h for multiarch=yes and multilib=no.

I think this is a typical issue that plagues all new architectures. It
is rooted in the fact that multiarch has never been properly upstreamed
into gcc and still lives as a patch. I suggest that you look into
debian/patches/gcc-multilib-multiarch.diff and through the history of
rebootstrap to see how other architectures had to modify it.

> Because problems inside GCC or GLIBC with default settings of this script, I changed options to
> 
>     ENABLE_MULTILIB=no
>     ENABLE_MULTIARCH_GCC=no  (default was yes)

This should also work, but it still needs to usr
/usr/include/<multiarch>, so it doesn't solve your problems.

> Building GCC was done.

It merely defers problems.

> In output "i586-linux-gnu-gcc -v" can see "--includedir=/usr/i586-linux-gnu/include".
> I assume, this is correct for cross building multiarch=no.

It is not.

> I found some debian rules, there was a detection on ENABLE_MULTIARCH_GCC=yes
> and use /usr/include/<triplet>, or use /usr/<triplet>/include for "no".
> 
> In complete build with rebootstrap found some packages, where ENABLE_MULTIARCH_GCC=no was not respected and hard coded includedir to /usr/include/<triplet>. They are:

This is a misconception. I'm going to skip the rest as it becomes
irrelevant.

Helmut


Reply to: