Repository navigation
installation
After install, go to Getting started.
z88dk changes often. Prefer a nightly build or a git build when you need current tools. Prefer those over an old release snapshot.
You must set both variables. Without them, zcc cannot find targets.
| Variable | Value |
|---|---|
PATH |
Include z88dk/bin (or z88dk/bin.x86 on 32-bit Windows) |
ZCCCFG |
z88dk/lib/config |
- Open a new shell (so it loads the updated environment).
- Run:
zcc
- You must see the zcc banner and a note that a target is required.
- If the command is not found, fix
PATH. - If the tool runs but cannot open a target config, fix
ZCCCFG.
| Host | Method | Section |
|---|---|---|
| Windows | Nightly zip binary | Binary on Windows |
| macOS | Nightly zip binary | Binary on macOS |
| Linux / Unix | Build from source (or nightly tarball) | Build from source |
| Linux (Snap) | Snap package | Snap · Snap-usage |
| Any | Docker | Snap · Docker-Usage |
| VS Code / Codespaces style | Dev container example | Dev container |
| Releases | GitHub release archives | GitHub releases |
Nightly site: http://nightly.z88dk.org/
Git build summary: git clone --recursive https://github.com/z88dk/z88dk.git then ./build.sh (see build.sh -h). Set BUILD_SDCC=1 when you need zsdcc.
- Download the latest nightly Windows build from http://nightly.z88dk.org/
- Unzip into a destination directory. Avoid spaces in the path when you can.
- Note the tree root. This document calls that folder
{z88dk}. - Set environment variables (Windows 8 example):
- Open Control Panel → User Accounts.
- Open Change my environment variables.
- Add:
| Variable | Value |
|---|---|
ZCCCFG |
{z88dk}\lib\config |
- Add to Path:
- 64-bit Windows:
;{z88dk}\bin - 32-bit Windows:
;{z88dk}\bin.x86
- 64-bit Windows:
- Open a new command prompt.
- Run
zccas in section 1.
- Delete the old install tree.
- Download a new nightly build.
- Unzip into the same location.
- Keep the same
PATHandZCCCFGvalues.
Some virus scanners report trojans in the z88dk kit. These are false detections. They seem to trigger on the MinGW/gcc used to build the binaries. All binaries and kits are cross-compiled from Linux and have not run on a Windows machine used for packaging. See issue #2474.
- Download and unzip the latest package:
curl -O http://nightly.z88dk.org/z88dk-osx-latest.zip
unzip z88dk-osx-latest.zip- Set
ZCCCFGto{z88dk}/lib/config(replace{z88dk}with the full path to the unzipped tree). - Add
{z88dk}/bintoPATH. - You can keep the tree where you unzipped it. You do not need a system-wide install.
The default shell for macOS is often zsh. You may use bash and store z88dk under your home directory. Example permanent config:
vi ~/.bash_profileExample contents:
# Suppress message about using zsh
export BASH_SILENCE_DEPRECATION_WARNING=1
# Export z88dk path and environment
export PATH=${PATH}:${HOME}/z88dk/bin
export ZCCCFG=${HOME}/z88dk/lib/configAdjust ${HOME}/z88dk if your tree is elsewhere.
- Delete the old tree.
- Download a new nightly build.
- Unzip in the same location.
A snap package is available for some Linux distributions. Details: Snap usage.
Details: Docker Usage.
Based on the docker image, an example devcontainer project is:
https://github.com/z88dk/z88dk-devcontainer-example
Build needs the tools below. The listed version is a minimum. Example: gcc 9 is fine when the table says gcc 8.
| Ubuntu package | Min version | Description |
|---|---|---|
| gcc-8 | 8 | GNU C compiler version 8, supporting C++17 and std::filesystem |
| libboost-all-dev | 1.71 | Boost C++ Libraries development files |
| perl | 5.30 | Larry Wall's Practical Extraction and Report Language |
| ragel | 6.10 | State Machine Compiler, compiles finite state machines into code in various languages |
| re2c | 1.3 | tool for generating fast C-based recognizers |
| ccache | 3.7 | Compiler cache for fast recompilation of C/C++ code |
| dos2unix | 7.4 | convert text file line endings between CRLF and LF |
| texinfo | 6.7 | Documentation system for on-line information and printed output |
| texi2html | 1.82 | Convert Texinfo files to HTML |
| curl | 7.68 | command line tool for transferring data with URL syntax |
| cpanminus | 1.7044 | script to get, unpack, build and install modules from CPAN |
| pkg-config | manage compile and link flags for libraries | |
| libxml2-dev | Development files for the GNOME XML library | |
| libgmp3-dev | Arbitrary precision library |
The build environment and test tools use Perl and these modules:
| Ubuntu package | CPAN package | Min version | Description |
|---|---|---|---|
| liblocal-lib-perl | local::lib | 2.000024 | module to use a local path for Perl modules |
| libyaml-perl | YAML | 1.30 | YAML Ain't Markup Language |
| libmodern-perl-perl | Modern::Perl | 1.20200211 | module for enabling all of the features of Modern Perl |
| libtemplate-perl | Template | 2.27 | "Template Toolkit" template processing system in Perl |
| libtemplate-plugin-yaml-perl | Template::Plugin::YAML | 1.23 | simple Template Toolkit Plugin Interface to the YAML module |
| libcapture-tiny-perl | Capture::Tiny | 0.48 | module to capture STDOUT and STDERR |
| libpath-tiny-perl | Path::Tiny | 0.108 | file path utility |
| libtext-table-perl | Text::Table | 1.132 | Create tables that adapt to alignment requirements |
| libdata-hexdump-perl | Data::HexDump | 0.02 | hexadecimal dumper |
| libregexp-common-perl | Regexp::Common | 2017060201 | module with common regular expressions |
| libclone-perl | Clone | 0.43 | module for recursively copying Perl datatypes |
To install Perl modules without sudo, add this line to .bashrc (or a similar shell startup script). Run it before the next CPAN step:
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"Install these additional Perl modules via CPAN:
cpanm App::Prove File::Path CPU::Z80::Assembler Object::Tiny::RW List::UniqCI package truth: https://github.com/z88dk/z88dk/blob/master/.github/workflows/build-on-ubuntu.yml
- Get sources. Either nightly tarball:
wget http://nightly.z88dk.org/z88dk-latest.tgz
tar -xzf z88dk-latest.tgz
Or clone GitHub with submodules:
git clone --recursive https://github.com/z88dk/z88dk.git
- Install host packages (Ubuntu/Debian style example):
sudo apt install build-essential bison flex libxml2-dev zlib1g-dev m4 ragel re2c dos2unix texinfo texi2html gdb curl perl cpanminus ccache libboost-all-dev libmodern-perl-perl libyaml-perl liblocal-lib-perl libcapture-tiny-perl libpath-tiny-perl libtext-table-perl libdata-hexdump-perl libregexp-common-perl libclone-perl libfile-slurp-perl pkg-config libgmp3-dev
- Install Perl modules used by the build and tests:
cpanm --local-lib=~/perl5 App::Prove CPU::Z80::Assembler Data::Dump Data::HexDump Test::HexDifferences File::Path List::Uniq Modern::Perl Object::Tiny::RW Regexp::Common Test::Harness Text::Diff Text::Table YAML::Tiny
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- Build (includes zsdcc when
BUILD_SDCC=1):
cd z88dk
export BUILD_SDCC=1
export BUILD_SDCC_HTTP=1
chmod 777 build.sh
export PATH=${PATH}:`pwd`/bin
export ZCCCFG=`pwd`/lib/config
./build.sh
- To skip zsdcc, omit
export BUILD_SDCC=1. - SDCC sources may come from svn (can be slow). If that fails, set
export BUILD_SDCC_HTTP=1before./build.shso the build downloads a tarball from the nightly site. - Keep the tree in place. Set
ZCCCFGto{z88dk}/lib/configand put{z88dk}/binonPATHas in section 1.
If you use bash and keep z88dk under your home directory:
vi ~/.bash_profile
Example lines:
export PATH=${PATH}:${HOME}/z88dk/bin
export ZCCCFG=${HOME}/z88dk/lib/config
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)A full system install is not fully supported. If you still want to merge into a prefix:
-
export PREFIX=/path/before the build. - After the build finishes, run
make install. - On systems where
/bin/shis dash (for example Ubuntu), use:make SHELL=/bin/bash install.
The default build skips many tests. To run them, add -t to build.sh. For z80asm unit tests, these Perl packages are required:
App::Prove Modern::Perl Capture::Tiny Path::Tiny File::Path Template Template::Plugin::YAML CPU::Z80::Assembler Data::HexDump Object::Tiny::RW Regexp::Common List::Uniq
- Install prerequisites with Homebrew:
brew install gmp libxml2 pkg-config
- On Apple silicon, Homebrew packages are not always on the default compile path. After
brew shellenv, add to.zprofile:
export CPATH="$HOMEBREW_PREFIX/include:$CPATH"
export LIBRARY_PATH="$HOMEBREW_PREFIX/lib:$LIBRARY_PATH"- Then follow the same clone/
build.shflow as Linux (withPATHandZCCCFGset to the tree).
WSL runs a Linux distribution on the Windows host. These steps use Ubuntu 22.04 LTS. Other distributions are similar.
There is a longstanding bug for USB-to-serial on WSL2. Prefer WSL1 for development that needs serial hardware.
- Install WSL1 using Microsoft instructions.

- Install Ubuntu 22.04.x LTS from the Microsoft Store.

- From a Windows command prompt, confirm WSL1 and Ubuntu-22.04:
wsl -l -v
- Set the default distribution:
wsl -s Ubuntu-22.04

- Open Ubuntu 22.04 and finish first-boot setup as you need.

- Follow Linux / Unix build steps.
To use older z88dk versions, nightly kits or Docker builds are the easiest path. If you build old sources, you may need extra compiler flags. Newer host compilers find more issues and may reject older C by default.
With recent GNU compilers, z88dk v2.2 may fail to compile because of an incorrect initialization in some Next-related Appmake code. If that happens:
- Run
export CFLAGS=-Wno-int-conversion - Retry the build
Getting started — first zcc command after install.
- Home
- Installation
- Getting started
- Examples
- Load and run
- Disk and files
- Troubleshooting
- Glossary
- Docker Usage
- Snap usage
- Licence
- Overview
- Platform List
- Unsupported Platforms
- i8080/5 Support
- KR580VM1
- math32
- math16
- Homebrew hardware quickstart
- Retargetting
- Building the libraries
- Clang support
- Pragmas
- Adding to Classic
- Newlib overview
- Introduction (newlib only)
- Library Configuration
- CRT
- Header Files
- Assembly Language
- Library in Depth
- File I/O and FatFS
- Embedded Platform
- Adding to NewLib
- Benchmarks
- Datatypes
- Debugging
- Decompression
- More than 64k
- Deficiencies
- Compiling Larger Applications
- Importing routines written in 8080 assembly mnemonics
- Using CP/M libraries in REL format with z88dk
- Writing optimal code
- Speeding up Compilation
- CMake usage