Skip to content

cross/crossdirect: fakeroot: add helpful error msg

Alpine's abuild runs build() without fakeroot, and package() with
fakeroot. From the APKBUILD reference page in the Alpine wiki:

> Note: Building in fakeroot will reduce performance for parallel
> builds dramatically. It is for this reason that we split the build
> and package process into two separate functions.

Every now and then we see a package that tries to run a compiler (gcc,
g++, clang, ...) during package() in the APKBUILD. This is a bug in the
APKBUILD / build system of the program we are packaging. All compiling
should be done during build().

Let crossdirect print the following when this happens:

  ============================================================================================
  ERROR: crossdirect was called with: LD_PRELOAD=libfakeroot.so
  This means your package tried to run a compiler during package().
  This is not supported by crossdirect, and usually not a good idea.
  * Try to fix your APKBUILD so it does not run the compiler during package(), only in build()
  * If this is not possible, you can work around it by setting options="!pmb:crossdirect"
    (compilation will be slower!)
  ============================================================================================

Instead of:

  ERROR: crossdirect: can't handle LD_PRELOAD: libfakeroot.so
  Please report this at: https://gitlab.com/postmarketOS/pmaports/issues
  As a workaround, you can compile without crossdirect.

In the past I've also tried to add 'strcmp(ldPreload, "libfakeroot.so") == 0'
(pmaports MR 2231), and today I made the same patch. The current code
looks like it would then work by just using libfakeroot.so from the
native chroot, but it does not work. And as mentioned, if we hit this
then we are compiling in package() which is something we should not do
anyway!

Merge request reports

Loading