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
Quite a messy upgrade due to changes in both abuild and in the upstream
gcc APKBUILD breaking various things. Pmbootstrap also seems to
misbehave in GitLab CI making it difficult to validate.
Manual fixups:
* Set !tracedeps - changed behavior in abuild
* Manually add "so:" dependencies to avoid issues with !tracedeps set
(becomes obvious with crossdirect)
* Add back makedepends="$makedepends_build $makedepends_host"
* Disable move of some files into usr/lib to avoid
ERROR: gcc-aarch64-14.2.0-r4: trying to overwrite usr/lib/libgcc_s.so.1 owned by libgcc-14.2.0-r4.
[ci:skip-build] # pmbootstrap bugs will prohibit this from building
# anyways, don't even attempt
Co-developed-by: Luca Weiss <luca@lucaweiss.eu>
[ci:skip-build] CI fails because of an issue with pmb fetching build
deps on subsequent packages in the aggregated list of packages to build,
but bpo is expected to pass because it builds packages one at a time