Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| buildingonnonfreebsd [2020/09/30 12:25] – Update for current status AlexRichardson | buildingonnonfreebsd [2023/10/02 18:13] (current) – redirect to handbook MateuszPiotrowski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Building on non-FreeBSD hosts ====== | ====== Building on non-FreeBSD hosts ====== | ||
| - | Until recently, %%FreeBSD%% could only be built on a %%FreeBSD%% host. However, most CI systems do not include %%FreeBSD%% build slaves by default. | + | <callout type=" |
| - | If we allow %%FreeBSD%% | + | **Moved |
| - | Furthermore, | + | |
| - | ===== Why crossbuilding from non-FreeBSD didn't work ===== | + | The building process is now documented in the %%FreeBSD%% Handbook. https:// |
| + | </ | ||
| - | * Some build tools depend | + | Until recently, %%FreeBSD%% could only be built on a %%FreeBSD%% |
| - | * The version of clang contained in the %%FreeBSD%% | + | If we allow %%FreeBSD%% |
| - | * Could build the bootstrap clang using CMake+ninja | + | Furthermore, it allows developers who do not have a %%FreeBSD%% |
| - | * Current solution | + | |
| - | * However, some features such as ifunc-noplt are not in upstream clang | + | |
| - | * The build system often falls back to invoking binaries in $PATH | + | |
| - | * This can cause strange build errors if that binary was not bootstrapped and an incompatible versions is executed | + | |
| - | * can also happen when building on %%FreeBSD%% | + | |
| - | * Building with a clean $PATH [[https:// | + | |
| - | ===== Current status ===== | + | ===== Instructions for building on Linux/ |
| - | + | ||
| - | As of September 2020 all required patches have been merged to HEAD. | + | |
| - | + | ||
| - | ==== Instructions for building on Linux/macOS ==== | + | |
| Since Linux and macOS don't include a version of bmake by default, building should be done using the script '' | Since Linux and macOS don't include a version of bmake by default, building should be done using the script '' | ||
| - | Additionally it will set the required XCC,XLD etc variables that are needed to build with an [[ExternalToolchain]]. | + | Additionally it will set the required XCC,XLD etc variables that are needed to build with an [[ExternalToolchain]] |
| - | If you have a recent version of bmake installed using homebrew or another package manager you can also set the required variables manually (the easiest way to obtain them is by running '' | + | If you have a recent version of bmake installed using homebrew or another package manager you can also set the required variables manually (the easiest way to obtain them is by running '' |
| Usage: | Usage: | ||
| < | < | ||
| - | MAKEOBJDIRPREFIX=... | + | MAKEOBJDIRPREFIX=... tools/ |
| </ | </ | ||
| - | === Prerequisites on macOS === | + | ==== Prerequisites on macOS ==== |
| - | '' | + | '' |
| < | < | ||
| - | brew install | + | brew install |
| </ | </ | ||
| - | === Prerequisites on Linux === | + | ==== Prerequisites on Linux ==== |
| - | You will need a recent version of clang (ideally 10.0) and the libarchive + libbz2 headers. | + | You will need a recent version of clang (ideally 10.0) and the libarchive + libbz2 headers |
| + | |||
| + | ==== Using the in-tree toolchain ==== | ||
| + | |||
| + | Instead of installing clang via your system' | ||
| + | |||
| + | ===== History ===== | ||
| + | |||
| + | ==== Why crossbuilding from non-FreeBSD didn't work ==== | ||
| + | |||
| + | * Some build tools depended on host headers being compatible with target headers (e.g. localedef). This required some refactoring of the xlocale headers to fix properly. | ||
| + | * The version of clang contained in the %%FreeBSD%% source tree could not be bootstrapped with the makefiles from base since the config headers depended on %%FreeBSD%% | ||
| + | * Could have built the in-tree clang using CMake+ninja (which should also be much faster than the current Makefile solution), but that would have been a lot of effort | ||
| + | * Initial solution was to just use upstream clang as an external toolchain until the config headers and build system were patched to support Linux and macOS | ||
| + | * However, some features such as ifunc-noplt are not in upstream clang | ||
| + | * The build system often falls back to invoking binaries in $PATH | ||
| + | * This can cause strange build errors if that binary was not bootstrapped and an incompatible versions is executed | ||
| + | * Can also happen when building on %%FreeBSD%% (e.g. running dtc from an old %%FreeBSD%% version) | ||
| + | * Building with a clean $PATH [[https:// | ||
| - | ===== Open issues ===== | + | ==== Issues |
| | Name | STATUS | Owner | Review | Commits | Comments | | | Name | STATUS | Owner | Review | Commits | Comments | | ||
| | MK_PMC broken | Committed | AlexRichardson | [[https:// | | MK_PMC broken | Committed | AlexRichardson | [[https:// | ||
| | MK_BSNMP broken | Committed | | [[https:// | | MK_BSNMP broken | Committed | | [[https:// | ||
| - | | MK_CDDL broken | Needs review | + | | MK_CDDL broken | Committed |
| | MK_BOOT broken | Committed | | ? | ? | BOOT contains some assembly files that cannot be built with clang | | | MK_BOOT broken | Committed | | ? | ? | BOOT contains some assembly files that cannot be built with clang | | ||
| | MK_TESTS broken | Committed | AlexRichardson | [[https:// | | MK_TESTS broken | Committed | AlexRichardson | [[https:// | ||
| | MK_LOCALES broken | Committed | AlexRichardson | [[https:// | | MK_LOCALES broken | Committed | AlexRichardson | [[https:// | ||
| - | | Clang+LLD cannot be built | Not started/Bad idea | | | | This requires tablegen to be bootstrapped but won't work with the existing makefiles/config.h. Using an external toolchain is preferable | + | | Clang+LLD cannot be built | Committed |
| | Building without inheriting $PATH | Committed | AlexRichardson | [[https:// | | Building without inheriting $PATH | Committed | AlexRichardson | [[https:// | ||
| - | | Add compatibility headers for bootstrap phase | Needs review | + | | Add compatibility headers for bootstrap phase | Committed |
| + | | Add wrapper script to bootstrap bmake | Committed | AlexRichardson | [[https:// | ||
| ---- | ---- | ||
| - | {{tag>Project Project}} | + | {{tag>HowTo}} |