-
Notifications
You must be signed in to change notification settings - Fork 142
Document .NET cross-building and the CrossBuild=true requirement for foreign-ROOTFS builds #5501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d06abac
Initial plan
Copilot 473f49f
Document cross-build requirement for linux-x64 Docker builds
Copilot 2bdbf2d
Move cross-build doc to dedicated file and add Documentation/README.m…
Copilot 10cd8ea
Expand cross-building.md with general definition, sysroot explanation…
Copilot b247112
Revise cross-building.md: broaden scope, add scenarios table, reframe…
Copilot 1a2bb68
Update Documentation/cross-building.md
mthalman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Source-Build Documentation | ||
|
|
||
| ## Building .NET from Source | ||
|
|
||
| | Document | Description | | ||
| |---|---| | ||
| | [System Requirements](system-requirements.md) | Hardware, OS, and architecture requirements | | ||
| | [Bootstrapping Guidelines](bootstrapping-guidelines.md) | How to acquire or build a bootstrapping SDK | | ||
| | [Cross-Building](cross-building.md) | How to build .NET for a target platform using a cross-build container | | ||
| | [How to Run a Stage 2 Build](how-to-stage2-build.md) | How to perform a stage 2 source build for validation | | ||
| | [Adding Support for a New OS](boostrap-new-os.md) | Steps to bring up .NET on a new operating system | | ||
|
|
||
| ## Maintaining Source-Build | ||
|
|
||
| | Document | Description | | ||
| |---|---| | ||
| | [CI Platform Coverage Guidelines](ci-platform-coverage-guidelines.md) | Guidelines for which platforms to test in CI | | ||
| | [Feature Band Source Building](feature-band-source-building.md) | Guide for Linux distro maintainers on building feature band branches | | ||
| | [Packaging and Installation](packaging-installation.md) | How to install or package a source-built .NET SDK | | ||
| | [Patching Guidelines](patching-guidelines.md) | How to address build errors and other issues via patches | | ||
| | [Package Dependency Flow](package-dependency-flow.md) | How package dependencies are managed within source-build | | ||
| | [Eliminating Pre-builts](eliminating-pre-builts.md) | How to eliminate pre-built binaries in .NET repositories | | ||
| | [Leak Detection](leak-detection.md) | How the poisoning mechanism works to detect pre-built leaks | | ||
| | [Poison Report Format](poison-report-format.md) | How to interpret the poison report | | ||
|
|
||
| ## Repo Owner's Handbook | ||
|
|
||
| See [sourcebuild-in-repos/README.md](sourcebuild-in-repos/README.md) for documentation | ||
| aimed at repository owners who participate in source-build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Cross-Building | ||
|
|
||
| Cross-building is the process of building .NET for a target platform on a | ||
| different host platform. For example, building for `linux-x64` on a host that | ||
| uses the `azurelinux-3.0-net10.0-cross-amd64` container image with a | ||
| dedicated sysroot. | ||
|
|
||
| ## When is Cross-Building Required? | ||
|
|
||
| Cross-building is required when: | ||
|
|
||
| - The build environment uses a cross-build container image (e.g. | ||
| `mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-amd64`) | ||
| that provides a sysroot via the `ROOTFS_DIR` environment variable, even when | ||
| building for the same architecture as the host (e.g. `linux-x64`). | ||
|
|
||
| ## Enabling Cross-Building | ||
|
|
||
| When building in a cross-build container with `ROOTFS_DIR` set, you must pass | ||
| `/p:CrossBuild=true` to the build command. Without this flag, the runtime build | ||
| will not use the sysroot when searching for native dependencies such as OpenSSL, | ||
| causing the build to fail. | ||
|
|
||
| ## Example | ||
|
|
||
| ```bash | ||
| docker run \ | ||
| --rm \ | ||
| --volume /path/to/dotnet:/dotnet \ | ||
| --workdir /dotnet \ | ||
| --env ROOTFS_DIR=/crossrootfs/x64 \ | ||
| mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-amd64 \ | ||
| ./build.sh \ | ||
| --clean-while-building \ | ||
| --source-only \ | ||
| --arch x64 \ | ||
| --os linux \ | ||
| /p:CrossBuild=true | ||
| ``` | ||
|
|
||
| > **Note:** `/p:CrossBuild=true` is only required when using a cross-build | ||
| > container with `ROOTFS_DIR` set. It is not needed when building natively on | ||
| > the target platform. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.