Revision 1 of 2026-11-25 20:31 UTC by tux, the current one. Current version - History
Multi-arch
5.1
SliTaz 5.1 is built for two architectures: i486, the 32-bit one, for old PCs, and x86_64. Both come from the same wok: one receipt per package, and the build host cooks each receipt once for each architecture. This page shows how a receipt says where it builds, how it handles what differs between the two, and how to cook both. The receipt itself is explained in Receipt.
What changes from one arch to the other
The architecture is ARCH in /etc/slitaz/cook.conf: i486 or
x86_64. cook sets from it:
- the compiler flags:
-march=i486or-march=x86-64, both with-Os; HOST_SYSTEM,i486-slitaz-linuxorx86_64-slitaz-linux, passed to./configurein$CONFIGURE_ARGS;- the package file name:
hello-2.12.tazpkgon i486,hello-2.12-x86_64.tazpkgon x86_64. A package without binaries (scripts, data, themes) is-anyon x86_64 and has no suffix on i486. cook decides it by looking at the files it packs.
Libraries go to /usr/lib on both: SliTaz x86_64 has no separate
lib64. cook sets it for ./configure; with CMake, pass
-DCMAKE_INSTALL_LIBDIR=lib, as many receipts of the wok do.
HOST_ARCH: where a receipt builds
HOST_ARCH lists the architectures a receipt is cooked for:
HOST_ARCH="i486 x86_64"
- not set: the receipt is cooked on every architecture;
"i486 x86_64": both, said explicitly. Many receipts also listarm, from the old ARM port;"i486": 32-bit only, for code that cannot build or run in 64-bit (x86 assembly, a 32-bit binary blob, a dependency missing on x86_64);"x86_64": 64-bit only, for programs that need a modern CPU or too much RAM for the machines i486 is meant for;"any": the package holds no binary, only scripts or data.
On an architecture left out, cook does not fail: it prints
package "foo" doesn't cook or is not included in x86_64 and stops.
When you leave an architecture out, say why in a comment, so the next
person knows what to fix:
HOST_ARCH="i486" # no bdep libwebkit in x86_64
When a 32-bit program fails on x86_64, cook gives a hint at the end of
the log: a -march forced in a Makefile ("CPU you selected does not
support x86-64"), or 32-bit registers and inline assembly. Remove the
forced flag, or set HOST_ARCH="i486".
case "$ARCH": one receipt, two ways
When something differs, test $ARCH with a case in the receipt.
Outside the functions, it can change the source, here a prebuilt
binary (restic):
case "$ARCH" in
i?86) TARBALL="${PACKAGE}_${VERSION}_linux_386.bz2" ;;
*) TARBALL="${PACKAGE}_${VERSION}_linux_amd64.bz2" ;;
esac
or even the version, when the two architectures follow different releases (the Firefox language packs):
case "$ARCH" in
x86_64) VERSION="153.0esr"; MOZ_ARCH="linux-x86_64" ;;
*) VERSION="140.13.0esr"; MOZ_ARCH="linux-i686" ;;
esac
Inside compile_rules, it fixes the build for one architecture only,
here a Makefile that forces 32-bit code (chntpw):
case "$ARCH" in
x86_64) sed -i 's/ -m32//g' Makefile ;;
esac
Two habits:
- match i486 with
i?86), as most receipts do; - when the
casesets a value, give it a*)branch. Without it, the variable stays empty on the other architecture: an option quietly missing, a plugin not built, an empty URL.
Cooking for both
On an x86_64 SliTaz you can cook for both: the 64-bit kernel runs
32-bit programs, so an i486 chroot works. cook runs its i486 builds
with a 32-bit personality, so build scripts that ask the system see
i686, not x86_64. An i486 system cannot cook for x86_64.
Make an i486 chroot with tazdev, as root (package
slitaz-dev-tools):
# tazdev gen-chroot --arch=i486 \
--mirror=https://mirror.slitaz.org/i486/cooking/packages/
# tazdev chroot --arch=i486
See Building in a chroot
in the Handbook. The chroot shares /home/slitaz/src with your system,
so a source is downloaded once, but not your wok: copy the package
directory into the chroot's /home/slitaz/wok, then cook it there as
usual. Its packages land in /home/slitaz/cooking/i486/packages on
your system.
Cook in a chroot even for your own architecture before you share a
receipt: the build host starts from a clean system and installs only
what BUILD_DEPENDS lists.
One wok, both arches
The wok is one Mercurial repository for both architectures: commit a
fix once, and the build host cooks it on i486 and x86_64. If you keep
two clones, one per chroot, commit in one and hg pull -u in the
other: the same change committed in both makes two heads to merge.
See Mercurial.
After a push, check the result of both architectures on cook.slitaz.org: a receipt can build on one and break on the other.
Links
- Cookutils manual:
cook.conf,cook-setupand the receipt functions. - Handbook: Building in a chroot.
- The cooking wok: search it for
case "$ARCH"to see more examples.