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

Re: Issue when build libpg-query(riscv FTBFS)



Hi,
On Wed, Feb 16, 2022 at 07:26:34AM +0100, Helmut Grohne wrote:
Hi,

On Wed, Feb 16, 2022 at 01:00:49PM +0800, Bo YU wrote:
I want to port libpg-query of FTBFS to riscv64 on Debian.

https://buildd.debian.org/status/package.php?p=libpg-query&suite=sid

This is a native FTBFS, but as you continue, you switch to cross
building. Given that you Cced d-cross@l.d.o, you seem to be aware, but
you've suddenly made your problem much bigger that way.

sudo sbuild --build=amd64 --profiles=cross --host=riscv64 -d sid

You should not normally pass --profiles=cross. When you pass a
non-native --host, sbuild will automatically pass
--profiles=cross,nocheck and you override that here. In this case, the
difference turns out to be harmless.

Merged Build-Depends: debhelper-compat (= 13), postgresql-server-dev-all, protobuf-c-compiler, build-essential:amd64, fakeroot:amd64, crossbuild-essential-riscv64:amd64, libc-dev:riscv64, libstdc++-dev:riscv64

...

Install main build dependencies (apt-based resolver)
----------------------------------------------------

Installing build dependencies
Reading package lists...
Building dependency tree...
Reading state information...
The solver encountered an error of type: ERR_UNSOLVABLEExecute external solver...

The following information might help you to understand what is wrong:
The following packages have unmet dependencies:
 sbuild-build-depends-main-dummy:riscv64 : Depends: postgresql-server-dev-all:riscv64 but it is not installable
                                            Depends: crossbuild-essential-riscv64:amd64 but it is not installable
  Depends: libc-dev:riscv64 but it is not installable
  Depends: libstdc++-dev:riscv64 but it is not installable
 Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 sbuild-build-depends-main-dummy:riscv64 : Depends: debhelper-compat:riscv64 (= 13)
Depends: postgresql-server-dev-all:riscv64 but it is not installable
Depends: protobuf-c-compiler:riscv64
Depends: crossbuild-essential-riscv64:amd64 but it is not installable
Depends: libc-dev:riscv64 but it is not installable
Depends: libstdc++-dev:riscv64 but it is not installable
E: External solver failed with: The following packages have unmet dependencies:
apt-get failed.
E: Package installation failed
Not removing build depends: cloned chroot in use
Setup apt archive
-----------------
```

I refactor the log txt.

I try many ways to fix it but have no process. Is this my env wrong?

Your environment looks fine, but the expectation that any package can be
cross built out of the box is wrong.

A good place to start is https://crossqa.debian.net/src/libpg-query.
There you can see that for most architectures libpg-query cannot be
cross-built due to some dependency issue except for s390x. The reason
that s390x "works" is that postgresql is built with much less features.
For instance, it doesn't integrate with clang on s390x. So do expect
problems here. In the s390x build, you can see that libpg-query uses the
build architecture compiler "cc" instead of using a cross compiler, so
even after making dependencies work somehow, it will not just work.

To get a better view on the dependency issue, you can follow the
"bootstrap.d.n" and "debcheck" links. In this case, the former turns out
to be useless, but the latter confirms clang to be a problem as it
depend on binutils which is not coinstallable. Making stuff that uses
clang work generally is an unsolved problem at this time. Another
strategy is looking into what --bd-uninstallable-explainer=dose3 says.
That's included in your log by default closer to the end and it
basically says that it cannot find any riscv64 packages at all. That's
because riscv64 is not a release architecture. In order to cross build
for it, your base chroot must include the relevant debian-ports mirror.
The wiki page you mentioned really should have instructions for cross
building to debian-ports architectures. Can you update it after making
it work? Beyond adding a mirror, I think you also need to change your
sbuild.conf and change $crossbuild_core_depends to include a mapping

   riscv64 => [ "gcc-riscv64-linux-gnu", "g++-riscv64-linux-gnu",
   "libstdc++-dev:riscv64", "libc-dev:riscv64" ]
In fact you told me the sbuild.conf file which i think is ~/.sbuildrc.
-:).  So it compliants always.

Ths sbuild.conf is located in /etc/sbuild/. I am able to cross compiling riscv64. Thank you.

BR,
vimer


as build-essential does not build a crossbuild-essential-$arch package
for ports.

So you basically turned your "libpg-query FTBFS" problem into three new
problems:
* Your chroot does not support cross building to d-ports architectures
  due to missing mirrors.
* The postgresql-server-dev-N -> clang-M dependency does not work that
  way and will have to be rethought on a fundamental level. The way we
  depend on clang must change fundamentally in order to use it during
  cross builds.
* libpg-query uses the wrong compiler.

Are you sure you want to solve all of these rather than running your
build inside qemu? The latter may sound slow, but it consumes CPU
cycles, not brain cycles. Let me know if you want and I'll help you
figure these issues out, but you'll be investing rather more than a full
week.

Helmut



Reply to: