NetBSD was the first operating system CloudABI was ported to after it had initially been developed on FreeBSD. Support for CloudABI on NetBSD is fairly complete, though it has not been integrated into upstream sources yet.
This document describes how NetBSD can be used to both develop and run CloudABI applications.
CloudABI uses a toolchain based on LLVM, Clang and LLD for building C and C++ software. Though the version of Clang shipped with pkgsrc (3.8.0) is sufficient for compiling code for CloudABI, only the upcoming version of LLD (3.9.0) is mature enough to generate executables properly. Until this version has been released and packaged by pkgsrc, we advise that LLVM is built from trunk.
The following commands can be used to build LLVM, Clang and LLD from SVN and install them into /usr/local/llvm-trunk:
After installing LLVM, we can create a number of symbolic links in /usr/local/bin that point to the utilities provided by LLVM, having the CloudABI cross compilation target prefixed to their name. LLVM automatically acts like a cross compiler for CloudABI when invoked through these symbolic links.
The commands above set up the Clang C and C++ compiler for every architecture supported by CloudABI, thus making it very easy to cross compile software for other hardware:
The CloudABI Ports Collection provides copies of precompiled libraries that you can use to build complex CloudABI applications. Software that is part of the CloudABI Ports Collection is automatically packaged for a variety of systems, including NetBSD's pkg_add.
As pkg_add can fetch packages by URL directly, there is no need to change any system configuration files to access the CloudABI Ports Collection. The NetBSD packages can be browsed online at https://nuxi.nl/distfiles/cloudabi-ports/netbsd/.
It typically makes sense to at least install the standard C++ runtime environment package, so that it is possible to compile C and C++ applications that depend on just core C, C++ and POSIX interfaces:
A patchset for the NetBSD kernel to add support for running CloudABI applications can be found on GitHub. It is sufficient to rebuild and install the kernel with the COMPAT_CLOUDABI64 configuration option enabled. Once booted, it should be possible to run CloudABI applications from the command line directly:
The cloudabi-run utility is not yet supported on NetBSD.