Skip to content
Snippets Groups Projects

cross/crossdirect: fakeroot: add helpful error msg

Merged Oliver Smith requested to merge ollieparanoid/pmaports:crossdirect-better-error into master
  1. Oct 30, 2024
    • Oliver Smith's avatar
      cross/crossdirect: fakeroot: add helpful error msg (MR 5744) · c45d7ec0
      Oliver Smith authored
      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 you're using meson install, try to add '--no-rebuild'
        * 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!
      
      Fixes: pmb issue 2039
      Related: pma issue 2351, pma MR 5738
      Unverified
      c45d7ec0
Loading