|
| 1 | +Build CoreCLR on NetBSD |
| 2 | +======================= |
| 3 | + |
| 4 | +This guide will walk you through building CoreCLR on NetBSD. We'll start by showing how to set up your environment from scratch. |
| 5 | + |
| 6 | +Environment |
| 7 | +=========== |
| 8 | + |
| 9 | +These instructions are written on NetBSD 7.x on the amd64 platform, since that's the release the team uses. |
| 10 | + |
| 11 | +Older releases aren't supported because building CoreCLR requires the modern LLVM stack (Clang, libunwind, and LLDB) that is developed against the NetBSD-7.x branch. |
| 12 | + |
| 13 | +Pull Requests are welcome to address other ports (like i386 or evbarm) as long as they don't break the ability to use NetBSD/amd64. |
| 14 | + |
| 15 | +Minimum RAM required to build is 1GB. |
| 16 | + |
| 17 | +The pkgsrc framework is required to build .NET projects on NetBSD. Minimal pkgsrc version required is 2016Q1. |
| 18 | + |
| 19 | +pkgsrc setup |
| 20 | +------------ |
| 21 | + |
| 22 | +Fetch pkgsrc and install to the system. By default it's done in the /usr directory as root: |
| 23 | + |
| 24 | +``` |
| 25 | +ftp -o- ftp://ftp.netbsd.org/pub/pkgsrc/stable/pkgsrc.tar.gz | tar -zxpf- -C /usr |
| 26 | +``` |
| 27 | + |
| 28 | +The .NET projects are tracked in pkgsrc-wip. |
| 29 | + |
| 30 | +In order to use pkgsrc-wip, git must be installed: |
| 31 | + |
| 32 | + |
| 33 | +``` |
| 34 | +cd /usr/pkgsrc/devel/git-base && make install |
| 35 | +``` |
| 36 | + |
| 37 | +To access resources over SSL link, mozilla-rootcerts must be installed: |
| 38 | + |
| 39 | +``` |
| 40 | +cd /usr/pkgsrc/security/mozilla-rootcerts && make install |
| 41 | +``` |
| 42 | + |
| 43 | +And follow the MESSAGE commands to finish the installation. |
| 44 | + |
| 45 | + |
| 46 | +Installing pkgsrc-wip |
| 47 | +--------------------- |
| 48 | + |
| 49 | +Type the following command to fetch the pkgsrc-wip sources: |
| 50 | + |
| 51 | + |
| 52 | +``` |
| 53 | +cd /usr/pkgsrc |
| 54 | +git clone --depth 1 git://wip.pkgsrc.org/pkgsrc-wip.git wip |
| 55 | +``` |
| 56 | + |
| 57 | +Then install the CoreCLR package you need: |
| 58 | + |
| 59 | +``` |
| 60 | +cd /usr/pkgsrc/wip/coreclr-git |
| 61 | +make install |
| 62 | +``` |
| 63 | + |
| 64 | +CoreCLR is installed in `/usr/pkg/CoreCLR` subdirectory by default. |
| 65 | + |
| 66 | + |
| 67 | +PAL tests |
| 68 | +========= |
| 69 | + |
| 70 | +To run PAL tests on NetBSD, use the `make test` in the coreclr-git package from pkgsrc-wip: |
| 71 | + |
| 72 | +``` |
| 73 | +cd /usr/pkgsrc/wip/coreclr-git |
| 74 | +make test |
| 75 | +``` |
| 76 | + |
| 77 | +Build CoreFX |
| 78 | +============ |
| 79 | + |
| 80 | +The CoreFX package is located in pkgsrc-wip as corefx-git. In order to build it you need to perform the following command: |
| 81 | + |
| 82 | +``` |
| 83 | +cd /usr/pkgsrc/wip/coreclr-git |
| 84 | +make |
| 85 | +``` |
| 86 | + |
| 87 | +At the moment there is no install or test target in the pkgsrc framework. |
| 88 | + |
| 89 | +CoreFX tests |
| 90 | +============ |
| 91 | + |
| 92 | +The steps to run CoreFX managed code tests: |
| 93 | + |
| 94 | +Build CoreCLR (with pkgsrc-wip/coreclr-git) on NetBSD x64, Debug and install the Product dir to /usr/pkg/CoreCLR: |
| 95 | + |
| 96 | +``` |
| 97 | +cd /usr/pkgsrc/wip/coreclr-git && make install |
| 98 | +``` |
| 99 | + |
| 100 | +Build CoreFX native x64 Debug and the work (build) dir is in /usr/pkgsrc/wip/corefx-git/work/corefx: |
| 101 | + |
| 102 | +``` |
| 103 | +cd /usr/pkgsrc/wip/corefx-git && make |
| 104 | +``` |
| 105 | + |
| 106 | +Build CoreCLR Debug x64 on Linux and copy mscorlib.dll from ./bin/Product/Linux.x64.Debug/mscorlib.dll to NetBSD machine under /usr/pkg/CoreCLR: |
| 107 | + |
| 108 | +``` |
| 109 | +./build.sh mscorlib Debug |
| 110 | +``` |
| 111 | + |
| 112 | +Build CoreFX Debug x64 on Linux and copy bin/ to NetBSD machine under /public/bin: |
| 113 | + |
| 114 | +``` |
| 115 | +./build.sh /p:OSGroup=NetBSD /p:SkipTests=true |
| 116 | +``` |
| 117 | + |
| 118 | +Run ./run-test.sh: |
| 119 | + |
| 120 | +``` |
| 121 | +$ pwd |
| 122 | +/usr/pkgsrc/wip/corefx-git/work/corefx |
| 123 | +$ ./run-test.sh \ |
| 124 | +--coreclr-bins /usr/pkg/CoreCLR/ \ |
| 125 | +--mscorlib-bins /usr/pkg/CoreCLR/ \ |
| 126 | +--corefx-tests /public/bin/tests/NetBSD.AnyCPU.Debug/ \ |
| 127 | +--corefx-native-bins ./bin/NetBSD.x64.Debug/Native/ |
| 128 | +``` |
0 commit comments