|
| 1 | +Requirements to build dotnet/runtime on FreeBSD |
| 2 | +===================== |
| 3 | + |
| 4 | +This guide will walk you through the requirements needed to build dotnet/runtime on FreeBSD. We'll start by showing how to set up your environment from scratch. |
| 5 | +Since there is no official build and FreeBSD package, native build on FreeBSD is not trivial. There are generally three options, sorted by ease of use: |
| 6 | +- cross-compile on Linux using Docker |
| 7 | +- cross-compile on Linux using Toolchain |
| 8 | +- build on FreeBSD |
| 9 | + |
| 10 | + |
| 11 | +Environment |
| 12 | +=========== |
| 13 | + |
| 14 | +These instructions were validated for and on FreeBSD 11.3 and 12.1. |
| 15 | + |
| 16 | +Build using Docker on Linux |
| 17 | +--------------------------- |
| 18 | + |
| 19 | +This is similar to [Linux](linux-requirements.md) instructions. https://github.com/dotnet/dotnet-buildtools-prereqs-docker repro provides images |
| 20 | +with all needed prerequisites to build. As the example bellow may become stale, https://github.com/dotnet/versions/blob/master/build-info/docker/image-info.dotnet-dotnet-buildtools-prereqs-docker-master.json offers list of latest Docker tags. |
| 21 | + |
| 22 | +```sh |
| 23 | +TAG=mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-freebsd-11-20200430154008-a84b0d2 |
| 24 | +docker run --rm --volume $(pwd):$(pwd) --workdir $(pwd) --env ROOTFS_DIR=/crossrootfs/x64 -ti $TAG ./build.sh -cross -FreeBSD |
| 25 | +``` |
| 26 | + |
| 27 | +Build using Toolchain Setup |
| 28 | +--------------------------- |
| 29 | +To build FreeBSD images, prerequisites described in [Linux](linux-requirements.md) are needed. Additionally, crossrootfs for FreeBSD needs to be constructed. |
| 30 | +In order to successfully build FreeBSD crossrootfs, few more packages needs to be installed. Following example is for Ubuntu 18: |
| 31 | +```sh |
| 32 | +apt-get install -y libbz2-dev libz-dev liblzma-dev libarchive-dev libbsd-dev |
| 33 | +``` |
| 34 | +With prerequisites for crossrootfs one can run: |
| 35 | +```sh |
| 36 | +./eng/common/cross/build-rootfs.sh freebsd11 $(pwd)/rootfs/freebsd |
| 37 | +``` |
| 38 | +After that, FreeBSD build can be started by running |
| 39 | +``` |
| 40 | +ROOTFS_DIR=$(pwd)/rootfs/freebsd ./build.sh -cross -os FreeBSD |
| 41 | +``` |
| 42 | + |
| 43 | + |
| 44 | +Building on FreeBSD |
| 45 | +------------------- |
| 46 | + |
| 47 | +Building dotnet/runtime depends on several tools to be installed. |
| 48 | + |
| 49 | +Install the following packages: |
| 50 | + |
| 51 | +- cmake |
| 52 | +- autoconf |
| 53 | +- automake |
| 54 | +- libtool |
| 55 | +- icu |
| 56 | +- libunwind |
| 57 | +- lttng-ust |
| 58 | +- krb5 |
| 59 | +- openssl (optional) |
| 60 | + |
| 61 | +The lines to install all the packages above using package manager. |
| 62 | + |
| 63 | +```sh |
| 64 | +sudo pkg install --yes libunwind icu libinotify lttng-ust krb5 cmake autoconf automake openssl |
| 65 | +``` |
| 66 | + |
| 67 | +Additionally, working dotnet cli with SDK is needed. On other platforms this would be downloaded automatically during build but it is not currently available for FreeBSD. |
| 68 | +It needs to be built once on supported platform or obtained via community resources. |
| 69 | + |
0 commit comments