mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-31 14:50:42 +00:00
## Proposed Changes
Enable multiple database backends for the slasher, either MDBX (default) or LMDB. The backend can be selected using `--slasher-backend={lmdb,mdbx}`.
## Additional Info
In order to abstract over the two library's different handling of database lifetimes I've used `Box::leak` to give the `Environment` type a `'static` lifetime. This was the only way I could think of using 100% safe code to construct a self-referential struct `SlasherDB`, where the `OpenDatabases` refers to the `Environment`. I think this is OK, as the `Environment` is expected to live for the life of the program, and both database engines leave the database in a consistent state after each write. The memory claimed for memory-mapping will be freed by the OS and appropriately flushed regardless of whether the `Environment` is actually dropped.
We are depending on two `sigp` forks of `libmdbx-rs` and `lmdb-rs`, to give us greater control over MDBX OS support and LMDB's version.
47 lines
1.7 KiB
Markdown
47 lines
1.7 KiB
Markdown
# 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 for x86_64 processors which avoids using some modern CPU
|
|
instructions that are incompatible with older CPUs.
|
|
- `build-aarch64`: builds an optimized version for 64-bit ARM processors (suitable for Raspberry Pi 4).
|
|
- `build-aarch64-portable`: builds a version for 64-bit ARM processors which avoids using some
|
|
modern CPU instructions. In practice, very few ARM processors lack the instructions necessary to
|
|
run the faster non-portable build.
|
|
|
|
For more information about optimized vs portable builds see
|
|
[Portability](./installation-binaries.md#portability).
|
|
|
|
### 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`.
|
|
|
|
## Feature Flags
|
|
|
|
When using the makefile the set of features used for building can be controlled with
|
|
the environment variable `CROSS_FEATURES`. See [Feature
|
|
Flags](./installation-source.md#feature-flags) for available features.
|