-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve compilation error on 32-bit (#2424)
## Issue Addressed Closes #1661 ## Proposed Changes Add a dummy package called `target_check` which gets compiled early in the build and fails if the target is 32-bit ## Additional Info You can test the efficacy of this check with: ``` cross build --release --manifest-path lighthouse/Cargo.toml --target i686-unknown-linux-gnu ``` In which case this compilation error is shown: ``` error: Lighthouse requires a 64-bit CPU and operating system --> common/target_check/src/lib.rs:8:1 | 8 | / assert_cfg!( 9 | | target_pointer_width = "64", 10 | | "Lighthouse requires a 64-bit CPU and operating system", 11 | | ); | |__^ ```
- Loading branch information
1 parent
9461ac2
commit 379664a
Showing
5 changed files
with
36 additions
and
0 deletions.
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 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 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,8 @@ | ||
[package] | ||
name = "target_check" | ||
version = "0.1.0" | ||
authors = ["Michael Sproul <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
static_assertions = "1.1.0" |
This file contains 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,11 @@ | ||
//! This crate checks properties of the target architecture to ensure that it's compatible with | ||
//! Lighthouse. | ||
use static_assertions::assert_cfg; | ||
|
||
// In many places we assume `usize` and `u64` have the same in-memory representation. | ||
// We also use memory-mapped files extensively which are only really viable with 64-bit addressing. | ||
// It's unlikely we will want to support 128-bit architectures any time soon. | ||
assert_cfg!( | ||
target_pointer_width = "64", | ||
"Lighthouse requires a 64-bit CPU and operating system", | ||
); |
This file contains 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