When building a custom recipe for pigz (see below) inside a rootless Podman container (also below), the build fails with the following message:
error build failed
subject: pigz
phase: build
cause: failed to create package archive
details: failed to resolve package cache; build_profile=/mere/dev/build/pigz-2.8-1-<hash>/profile
"Failed to create package archive" appears at /src/build_orchestrator/packaging.zig:513, and "failed to resolve package cache" is at /src/cli/commands/build.zig:187. I've not yet dug further to see from where these are called.
I also tested using the zstd recipe and got the same error pattern:
error build failed
subject: zstd
phase: build
cause: failed to create package archive
details: failed to resolve package cache; build_profile=/mere/dev/build/zstd-1.5.7-2-<hash>/profile
Should I attach cold-cache verbose output too? Compilation for pigz is quite short, but there's a fair bit of output from staging the build dependencies.
Podman run command (pwd has src/recipe_{pigz,zstd}.kdl):
podman run -v .:/test-mere:ro -it alpine-mere:proto bash
Containerfile for alpine-mere:proto
FROMalpine:3.23ARG \
SRC_DIR=/src \
ZIG_VERSION=0.16.0RUN <<EOF ## variables for installing Zig ## - PLATFORM :: e.g. ~x86_64-linux~ ## - ZIG_TARFILE :: Zig download file ## - ZIG_TARDIR :: Zig tar file directory ## - ZIG_URL :: Zig download URL ## - ZIG_DIR :: output Zig directory ## - SRC_DIR :: e.g. Mere project source PLATFORM="$(uname -mo | tr ' ' - | awk '{print tolower(0ドル)}')" ZIG_TARFILE="zig-${PLATFORM}-${ZIG_VERSION}.tar.xz" ZIG_TARDIR="${ZIG_TARFILE/\.tar\.xz/}" ZIG_URL="https://ziglang.org/download/${ZIG_VERSION}/${ZIG_TARFILE}" ZIG_DIR="/etc/zig/${ZIG_VERSION}" ## initialise Alpine package keeper apk update apk upgrade ## minimum packages: ## - build-base, curl, git, linux-headers, make :: common ## project download, compilation, and installation things ## - cmake :: extra for Mere build ## - bash, wget :: nicer general tools apk add \
bash \
build-base \
cmake \
curl \
git \
linux-headers \
make \
wget ## clean package cache to minimise output image size apk cache clean apk cache purge ## download, unpack, and install the Zig distribution ## NOTE the APK version is out of date: v0.15.0; need v0.16.0 wget -q -O "${ZIG_TARFILE}" "${ZIG_URL}" tar -xf "${ZIG_TARFILE}" mkdir -p "$(dirname ${ZIG_DIR})" mv "${ZIG_TARDIR}" "${ZIG_DIR}" unlink "${ZIG_TARFILE}" ln -s "${ZIG_DIR}/zig" /usr/bin/EOFRUN <<EOF ## clone and build Mere, then clear out the source directory mkdir "${SRC_DIR}" git clone https://codeberg.org/merelinux/mere.git "${SRC_DIR}/mere" cd "${SRC_DIR}/mere" zig build \
install \
--prefix /usr \
--release=fast cd - rm -fr "${SRC_DIR}"EOFRUN <<EOF ## set up Mere mere store init wget -q -O /mere/config.kdl https://pkgs.merelinux.org/config.kdl wget -q -O /mere/keys/mere.pub https://pkgs.merelinux.org/mere.pubEOF
Custom pigz recipe
recipe{ name"pigz" description"Parallel implementation of gzip" url"https://zlib.net/pigz/" version"2.8" release1 licenses"zlib" archs"x86_64" depends"busybox""llvm""make""musl-dev""zlib-ng-dev" envCFLAGS="-O3 -flto=auto"}source"https://zlib.net/pigz/pigz-${recipe.version}.tar.gz"{ blake3"fa165f414a12851806d9d54920879dd989917b9aa410aec671c602b18773b236"}build{ scriptr#"
make pigz CC=clang
"#}check{ scriptr#"
make test
"#}install{ scriptr#"
echo "${DESTDIR}"
install \
-Dm0755 pigz \
-t "${DESTDIR}"/usr/bin
ln -s pigz "${DESTDIR}"/usr/bin/unpigz
install \
-Dm0644 pigz.1 \
-t "${DESTDIR}"/usr/share/man/man1
"#}package"pigz"{ files\"usr/bin/pigz"\"usr/bin/unpigz"\"usr/share/man/man1/pigz.1"}
Verbose build output, pigz (warm cache)
/root# mere dev -v build /test-mere/src/recipe_pigz.kdl
debug: loading system config from: /mere/config.kdl
debug: reading config file: /mere/config.kdl
debug: parsing repository from kdl
debug: validating name and url values
debug: creating repo config with name=mere url=https://pkgs.merelinux.org/mere priority=100
debug: successfully created repo config with name=mere enabled=true
debug: validating 1 repos
debug: checking repo 0 name=mere
debug: validating unique name
debug: validating name length
debug: validating url length
debug: validating url
debug: done validating 1 repos
debug: validating 1 repos
debug: checking repo 0 name=mere
debug: validating unique name
debug: validating name length
debug: validating url length
debug: validating url
debug: done validating 1 repos
prepare pigz-2.8
fetch sources
sources restored from cache: 4a425a98b70f17606ec8b84c7f57c6d3d77cef4398a74e6bce4f6b728caaaa41
unpack
source tree restored from cache: c8c4f88478fe54812ffcd4f6684ba3cb504b88b4c71a1c9deaabcb08704b73f9
build pigz-2.8
create profile
debug: creating isolated build profile
debug: creating build profile at: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
debug: created build profile at: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
profile created: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
install dependencies
dependency profile restored from cache: f6b7832269f41fdeed2ddb2b5f5014b2568172c98f80af0c888bb90314a3e9e6
recipe execution
debug: using profile for namespace: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
log writing: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/build.log
build
phase restored from cache: build (04f8f871bc33edb84dd8a9e51e8656121316a17798c417abbc31829d6c0fd2e9)
check
phase restored from cache: check (04f8f871bc33edb84dd8a9e51e8656121316a17798c417abbc31829d6c0fd2e9)
install
phase restored from cache: install (29f653447cb9c6bd8a4a82680832f1b050b91dd09b86bc308f5d0373003c2981)
stage packages
split staging restored from cache: 23ba678c53eae41ddcfb75e0b1d69610becf7a5a6be67a45f2c98d44ebfb1777
package artifacts
debug: compressed 1 man pages and rewrote 0 symlinks in /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/pkg/pigz
debug: stripped: usr/bin/pigz
debug: stripped 1 files in /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/pkg/pigz
debug: cleaning up build profile: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
error build failed
subject: pigz
phase: build
cause: failed to create package archive
details: failed to resolve package cache; build_profile=/mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
When building a custom recipe for pigz (see below) inside a rootless Podman container (also below), the build fails with the following message:
```
error build failed
subject: pigz
phase: build
cause: failed to create package archive
details: failed to resolve package cache; build_profile=/mere/dev/build/pigz-2.8-1-<hash>/profile
```
"Failed to create package archive" appears at [/src/build_orchestrator/packaging.zig:513][src-pkg-513], and "failed to resolve package cache" is at [/src/cli/commands/build.zig:187][src-build-187]. I've not yet dug further to see from where these are called.
I also tested using the [zstd recipe][recipe-zstd] and got the same error pattern:
```
error build failed
subject: zstd
phase: build
cause: failed to create package archive
details: failed to resolve package cache; build_profile=/mere/dev/build/zstd-1.5.7-2-<hash>/profile
```
Should I attach cold-cache verbose output too? Compilation for pigz is quite short, but there's a fair bit of output from staging the build dependencies.
[recipe-zstd]: https://codeberg.org/merelinux/recipes/src/branch/main/recipes/core/zstd/recipe.kdl
[src-build-187]: https://codeberg.org/merelinux/mere/src/branch/main/src/cli/commands/build.zig#L187
[src-pkg-513]: https://codeberg.org/merelinux/mere/src/branch/main/src/build_orchestrator/packaging.zig#L513
******
Podman run command (pwd has `src/recipe_{pigz,zstd}.kdl`):
```zsh
podman run -v .:/test-mere:ro -it alpine-mere:proto bash
```
<details>
<summary>Containerfile for alpine-mere:proto</summary>
```dockerfile
FROM alpine:3.23
ARG \
SRC_DIR=/src \
ZIG_VERSION=0.16.0
RUN <<EOF
## variables for installing Zig
## - PLATFORM :: e.g. ~x86_64-linux~
## - ZIG_TARFILE :: Zig download file
## - ZIG_TARDIR :: Zig tar file directory
## - ZIG_URL :: Zig download URL
## - ZIG_DIR :: output Zig directory
## - SRC_DIR :: e.g. Mere project source
PLATFORM="$(uname -mo | tr ' ' - | awk '{print tolower(0ドル)}')"
ZIG_TARFILE="zig-${PLATFORM}-${ZIG_VERSION}.tar.xz"
ZIG_TARDIR="${ZIG_TARFILE/\.tar\.xz/}"
ZIG_URL="https://ziglang.org/download/${ZIG_VERSION}/${ZIG_TARFILE}"
ZIG_DIR="/etc/zig/${ZIG_VERSION}"
## initialise Alpine package keeper
apk update
apk upgrade
## minimum packages:
## - build-base, curl, git, linux-headers, make :: common
## project download, compilation, and installation things
## - cmake :: extra for Mere build
## - bash, wget :: nicer general tools
apk add \
bash \
build-base \
cmake \
curl \
git \
linux-headers \
make \
wget
## clean package cache to minimise output image size
apk cache clean
apk cache purge
## download, unpack, and install the Zig distribution
## NOTE the APK version is out of date: v0.15.0; need v0.16.0
wget -q -O "${ZIG_TARFILE}" "${ZIG_URL}"
tar -xf "${ZIG_TARFILE}"
mkdir -p "$(dirname ${ZIG_DIR})"
mv "${ZIG_TARDIR}" "${ZIG_DIR}"
unlink "${ZIG_TARFILE}"
ln -s "${ZIG_DIR}/zig" /usr/bin/
EOF
RUN <<EOF
## clone and build Mere, then clear out the source directory
mkdir "${SRC_DIR}"
git clone https://codeberg.org/merelinux/mere.git "${SRC_DIR}/mere"
cd "${SRC_DIR}/mere"
zig build \
install \
--prefix /usr \
--release=fast
cd -
rm -fr "${SRC_DIR}"
EOF
RUN <<EOF
## set up Mere
mere store init
wget -q -O /mere/config.kdl https://pkgs.merelinux.org/config.kdl
wget -q -O /mere/keys/mere.pub https://pkgs.merelinux.org/mere.pub
EOF
```
</details>
<details>
<summary>Custom pigz recipe</summary>
```kdl
recipe {
name "pigz"
description "Parallel implementation of gzip"
url "https://zlib.net/pigz/"
version "2.8"
release 1
licenses "zlib"
archs "x86_64"
depends "busybox" "llvm" "make" "musl-dev" "zlib-ng-dev"
env CFLAGS="-O3 -flto=auto"
}
source "https://zlib.net/pigz/pigz-${recipe.version}.tar.gz" {
blake3 "fa165f414a12851806d9d54920879dd989917b9aa410aec671c602b18773b236"
}
build {
script r#"
make pigz CC=clang
"#
}
check {
script r#"
make test
"#
}
install {
script r#"
echo "${DESTDIR}"
install \
-Dm0755 pigz \
-t "${DESTDIR}"/usr/bin
ln -s pigz "${DESTDIR}"/usr/bin/unpigz
install \
-Dm0644 pigz.1 \
-t "${DESTDIR}"/usr/share/man/man1
"#
}
package "pigz" {
files \
"usr/bin/pigz" \
"usr/bin/unpigz" \
"usr/share/man/man1/pigz.1"
}
```
</details>
<details>
<summary>Verbose build output, pigz (warm cache)</summary>
```
/root# mere dev -v build /test-mere/src/recipe_pigz.kdl
debug: loading system config from: /mere/config.kdl
debug: reading config file: /mere/config.kdl
debug: parsing repository from kdl
debug: validating name and url values
debug: creating repo config with name=mere url=https://pkgs.merelinux.org/mere priority=100
debug: successfully created repo config with name=mere enabled=true
debug: validating 1 repos
debug: checking repo 0 name=mere
debug: validating unique name
debug: validating name length
debug: validating url length
debug: validating url
debug: done validating 1 repos
debug: validating 1 repos
debug: checking repo 0 name=mere
debug: validating unique name
debug: validating name length
debug: validating url length
debug: validating url
debug: done validating 1 repos
prepare pigz-2.8
fetch sources
sources restored from cache: 4a425a98b70f17606ec8b84c7f57c6d3d77cef4398a74e6bce4f6b728caaaa41
unpack
source tree restored from cache: c8c4f88478fe54812ffcd4f6684ba3cb504b88b4c71a1c9deaabcb08704b73f9
build pigz-2.8
create profile
debug: creating isolated build profile
debug: creating build profile at: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
debug: created build profile at: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
profile created: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
install dependencies
dependency profile restored from cache: f6b7832269f41fdeed2ddb2b5f5014b2568172c98f80af0c888bb90314a3e9e6
recipe execution
debug: using profile for namespace: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
log writing: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/build.log
build
phase restored from cache: build (04f8f871bc33edb84dd8a9e51e8656121316a17798c417abbc31829d6c0fd2e9)
check
phase restored from cache: check (04f8f871bc33edb84dd8a9e51e8656121316a17798c417abbc31829d6c0fd2e9)
install
phase restored from cache: install (29f653447cb9c6bd8a4a82680832f1b050b91dd09b86bc308f5d0373003c2981)
stage packages
split staging restored from cache: 23ba678c53eae41ddcfb75e0b1d69610becf7a5a6be67a45f2c98d44ebfb1777
package artifacts
debug: compressed 1 man pages and rewrote 0 symlinks in /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/pkg/pigz
debug: stripped: usr/bin/pigz
debug: stripped 1 files in /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/pkg/pigz
debug: cleaning up build profile: /mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
error build failed
subject: pigz
phase: build
cause: failed to create package archive
details: failed to resolve package cache; build_profile=/mere/dev/build/pigz-2.8-1-db2e996eab575cc6/profile
```
</details>