-
Notifications
You must be signed in to change notification settings - Fork 938
[Merged by Bors] - Cross-compile to vendored x86_84, aarch64 (Raspberry Pi 4) #1497
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
66065ab
First working cross-compile
paulhauner f977ea9
Rename build target
paulhauner 912134f
Squash in #1495
paulhauner e9ed847
First working cross-compile
paulhauner 0a68ec0
Rename build target
paulhauner 48fd312
Add option for portable cross builds
paulhauner 9419bea
Fix ARM cross commands
paulhauner bedf6d6
Remove unused Cross.toml
paulhauner 867e829
Merge branch 'cross-compile' of github.com:sigp/lighthouse into cross…
paulhauner 814d0fd
Remove old Cross.toml
paulhauner 4618b38
Update docs
paulhauner dd6346c
Merge branch 'cross-compile' of github.com:sigp/lighthouse into cross…
paulhauner 857e0be
Fix typos in docs
paulhauner 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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,41 @@ | ||
| # Cross-compiling | ||
|
|
||
| Lighthouse supports cross-compiling, allowing users to run a binary on one | ||
| platform (e.g., `aarch64`) that was compiled on another platform (e.g., | ||
| `x86_64`). | ||
|
|
||
|
|
||
| ## Instructions | ||
|
|
||
| Cross-compiling requires [`Docker`](https://docs.docker.com/engine/install/), | ||
| [`rustembedded/cross`](https://github.com/rust-embedded/cross) and for the | ||
| current user to be in the `docker` group. | ||
|
|
||
| The binaries will be created in the `target/` directory of the Lighthouse | ||
| project. | ||
|
|
||
| ### Targets | ||
|
|
||
| The `Makefile` in the project contains four targets for cross-compiling: | ||
|
|
||
| - `build-x86_64`: builds an optimized version for x86_64 processors (suitable | ||
| for most users). | ||
| - `build-x86_64-portable`: builds a version x86_64 processors which avoids | ||
| using some modern CPU instructions that might cause an "illegal | ||
| instruction" error on older CPUs. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's still an issue with pre-SSSE3 CPUs. I've opened #1504 to track it |
||
| - `build-aarch64`: builds an optimized version for 64bit ARM processors | ||
| (suitable for Raspberry Pi 4). | ||
| - `build-aarch64-portable`: builds a version 64 bit ARM processors which avoids | ||
| using some modern CPU instructions that might cause an "illegal | ||
| instruction" error on older CPUs. | ||
|
|
||
|
|
||
| ### Example | ||
|
|
||
| ```bash | ||
| cd lighthouse | ||
| make build-aarch64 | ||
| ``` | ||
|
|
||
| The `lighthouse` binary will be compiled inside a Docker container and placed | ||
| in `lighthouse/target/aarch64-unknown-linux-gnu/release`. | ||
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
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
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
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that this produces a portable binary, but it seems to (I ran the v0.2.2 release on my laptop just fine). The binary must still be compiled with
-march=nativeinside the Docker image, which would tailor it to the host machine, so I'm not sure if we just got lucky with the choice of host. I've opened #1505 to track this.