I’m trying to “build” (see below) a package for another architecture. I made it through (by disabling, frankly) most of the steps.

Long story short, I end up running something like this:

debuild -us -uc --host-type riscv64-linux-gnu -d -C/dev/null

but debuild keeps failing on this line:

[...]
make[1]: Leaving directory '/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0'
   dh_shlibdeps -a
   dh_installdeb
   dh_gencontrol
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'zigdev' in '../zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_riscv64.deb'.
 dpkg-genbuildinfo -O../zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_riscv64.buildinfo
 dpkg-genchanges -C/dev/null -O../zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_riscv64.changes
dpkg-genchanges: info: including full source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: full upload (original source is included)
debuild: fatal error at line 1062:
can't open zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_amd64.changes for reading: No such file or directory

So the *1_amd64.changes file does not exist, but riscv64 does:

zigdev-0.0.0+t20240906145412.egg.gbc271d0
zigdev_0.0.0+t20240906145412.egg.gbc271d0-1.debian.tar.xz
zigdev_0.0.0+t20240906145412.egg.gbc271d0-1.dsc
zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_amd64.build
zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_riscv64.buildinfo
zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_riscv64.changes
zigdev_0.0.0+t20240906145412.egg.gbc271d0-1_riscv64.deb
zigdev_0.0.0+t20240906145412.egg.gbc271d0.orig.tar.gz

Building with amd64 architecture finishes correctly *_amd64.changes exists and is used.

First, do I really need this .changes file? (I’m not planning to upload this to Debian archive.) And if so, how to make debuild use the correct file?

The environment (when calling env inside rules file) looks like this:

ASFLAGS=
CFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong -Wformat -Werror=format-security
CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2
CXXFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong -Wformat -Werror=format-security
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/11111/bus
DEBEMAIL=Me <netvor@example.com>
DEB_BUILD_ARCH=amd64
DEB_BUILD_ARCH_ABI=base
DEB_BUILD_ARCH_BITS=64
DEB_BUILD_ARCH_CPU=amd64
DEB_BUILD_ARCH_ENDIAN=little
DEB_BUILD_ARCH_LIBC=gnu
DEB_BUILD_ARCH_OS=linux
DEB_BUILD_GNU_CPU=x86_64
DEB_BUILD_GNU_SYSTEM=linux-gnu
DEB_BUILD_GNU_TYPE=x86_64-linux-gnu
DEB_BUILD_MULTIARCH=x86_64-linux-gnu
DEB_BUILD_OPTIONS=notest parallel=8
DEB_HOST_ARCH=riscv64
DEB_HOST_ARCH_ABI=base
DEB_HOST_ARCH_BITS=64
DEB_HOST_ARCH_CPU=riscv64
DEB_HOST_ARCH_ENDIAN=little
DEB_HOST_ARCH_LIBC=gnu
DEB_HOST_ARCH_OS=linux
DEB_HOST_GNU_CPU=riscv64
DEB_HOST_GNU_SYSTEM=linux-gnu
DEB_HOST_GNU_TYPE=riscv64-linux-gnu
DEB_HOST_MULTIARCH=riscv64-linux-gnu
DEB_RULES_REQUIRES_ROOT=binary-targets
DEB_TARGET_ARCH=riscv64
DEB_TARGET_ARCH_ABI=base
DEB_TARGET_ARCH_BITS=64
DEB_TARGET_ARCH_CPU=riscv64
DEB_TARGET_ARCH_ENDIAN=little
DEB_TARGET_ARCH_LIBC=gnu
DEB_TARGET_ARCH_OS=linux
DEB_TARGET_GNU_CPU=riscv64
DEB_TARGET_GNU_SYSTEM=linux-gnu
DEB_TARGET_GNU_TYPE=riscv64-linux-gnu
DEB_TARGET_MULTIARCH=riscv64-linux-gnu
DFLAGS=-frelease
DH_INTERNAL_BUILDFLAGS=1
DH_INTERNAL_OPTIONS=
DH_INTERNAL_OVERRIDE=dh_auto_install
FAKED_MODE=unknown-is-root
FAKEROOTKEY=2071757222
FCFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong
FFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong
GCJFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong
GPG_AGENT_INFO=/run/user/11111/gnupg/S.gpg-agent:0:1
HOME=/home/netvor
LANG=en_US.UTF-8
LC_COLLATE=C
LDFLAGS=-Wl,-z,relro
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libfakeroot:/usr/lib64/libfakeroot:/usr/lib32/libfakeroot
LD_PRELOAD=libfakeroot-sysv.so
LOGNAME=netvor
MAKEFLAGS=w
MAKELEVEL=2
MFLAGS=-w
OBJCFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong -Wformat -Werror=format-security
OBJCXXFLAGS=-g -O2 -ffile-prefix-map=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0=. -fstack-protector-strong -Wformat -Werror=format-security
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
PREFIX=/usr
PWD=/home/netvor/.cache/mkittool/debstuff/build/zigdev-0.0.0+t20240906145412.egg.gbc271d0
SOURCE_DATE_EPOCH=1456533483
TERM=rxvt-unicode
ZIGDEV_ZIG_VERSION=0.13.0
ZIGSITE=/opt/zigdev
ZIGSITE_PREP=debian/tmp/opt/zigdev

Open “spoiler” below to read more about my goals. Since the fact I don’t actually want to build Zig properly here might confuse and annoy people,

Project overview

First and foremost, I want to learn more and become more familiar with Debian build system as well as Zig and system-level programming.

How I want to do it is to start creating zig-based binary packages for personal/experimental use. Now, already have a pipeline and tooling ecosystem which I use for Python and Bash packages: my system is DEB centric and handles package lifecycle from git repo to APT (or DNF, really) repository and I prefer when any new project can be immediately built and deployed as .deb.

So now I want to add Zig support. But means my Zig-based projects will need something to put to Build-Depends, and since Zig does not officially provide APT repo, I want to create my own – this is what I’m focusing on right now.

So I’m creating this hacky package called zigdev whose only purpose will be to exist in my internal APT repos and deploy /opt/zigdev/zig to my test machines. One day, this package will can be easily replaced by official zig package, so for now (while building this particular zigdev package), I’m trying to cut every corner I can:

  • I don’t actually build Zig, I just download tarball using curl.

  • I’m trying to disable every truly arch-specific step, since these would typically need arch-specific chroot or similar setup.

    For example, I don’t care about dynamic linking, stripping or reproducibility.

Once I get this zigdev package running, I can start building my hello_world.zig’s and similar. At that point I will start slowly moving towards creating a more proper binary packages by refining an rules template for my zig projects (using zig tooling, though.) (All this while also learning Zig itself and system-level programming in general, of which I have almost no experience with, so that will move with glacial speed.)