mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: tell jemalloc to use 64-KiB pages when cross building aarch64 (#7123)
This commit is contained in:
@ -2,4 +2,9 @@
|
|||||||
pre-build = [
|
pre-build = [
|
||||||
# rust-bindgen dependencies: llvm-dev libclang-dev (>= 5.0) clang (>= 5.0)
|
# rust-bindgen dependencies: llvm-dev libclang-dev (>= 5.0) clang (>= 5.0)
|
||||||
"apt-get update && apt-get install --assume-yes --no-install-recommends llvm-dev libclang-6.0-dev clang-6.0"
|
"apt-get update && apt-get install --assume-yes --no-install-recommends llvm-dev libclang-6.0-dev clang-6.0"
|
||||||
|
]
|
||||||
|
|
||||||
|
[build.env]
|
||||||
|
passthrough = [
|
||||||
|
"JEMALLOC_SYS_WITH_LG_PAGE",
|
||||||
]
|
]
|
||||||
@ -28,7 +28,7 @@ RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json
|
|||||||
|
|
||||||
# Build application
|
# Build application
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --no-default-features --locked --bin reth
|
RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin reth
|
||||||
|
|
||||||
# ARG is not resolved in COPY so we have to hack around it by copying the
|
# ARG is not resolved in COPY so we have to hack around it by copying the
|
||||||
# binary to a temporary location
|
# binary to a temporary location
|
||||||
|
|||||||
20
Makefile
20
Makefile
@ -82,23 +82,29 @@ op-build-native-%:
|
|||||||
#
|
#
|
||||||
# The resulting binaries will be created in the `target/` directory.
|
# The resulting binaries will be created in the `target/` directory.
|
||||||
|
|
||||||
|
# For aarch64, disable asm-keccak optimizations and set the page size for
|
||||||
|
# jemalloc. When cross compiling, we must compile jemalloc with a large page
|
||||||
|
# size, otherwise it will use the current system's page size which may not work
|
||||||
|
# on other systems. JEMALLOC_SYS_WITH_LG_PAGE=16 tells jemalloc to use 64-KiB
|
||||||
|
# pages. See: https://github.com/paradigmxyz/reth/issues/6742
|
||||||
|
build-aarch64-unknown-linux-gnu: FEATURES := $(filter-out asm-keccak,$(FEATURES))
|
||||||
|
build-aarch64-unknown-linux-gnu: export JEMALLOC_SYS_WITH_LG_PAGE=16
|
||||||
|
|
||||||
|
op-build-aarch64-unknown-linux-gnu: FEATURES := $(filter-out asm-keccak,$(FEATURES))
|
||||||
|
op-build-aarch64-unknown-linux-gnu: export JEMALLOC_SYS_WITH_LG_PAGE=16
|
||||||
|
|
||||||
# No jemalloc on Windows
|
# No jemalloc on Windows
|
||||||
build-x86_64-pc-windows-gnu: FEATURES := $(filter-out jemalloc jemalloc-prof,$(FEATURES))
|
build-x86_64-pc-windows-gnu: FEATURES := $(filter-out jemalloc jemalloc-prof,$(FEATURES))
|
||||||
|
|
||||||
# Disable asm-keccak optimizations and jemalloc.
|
|
||||||
# Some aarch64 systems use larger page sizes and jemalloc doesn't play well.
|
|
||||||
# See: https://github.com/paradigmxyz/reth/issues/6742
|
|
||||||
build-aarch64-unknown-linux-gnu: FEATURES := $(filter-out asm-keccak jemalloc jemalloc-prof,$(FEATURES))
|
|
||||||
|
|
||||||
# Note: The additional rustc compiler flags are for intrinsics needed by MDBX.
|
# Note: The additional rustc compiler flags are for intrinsics needed by MDBX.
|
||||||
# See: https://github.com/cross-rs/cross/wiki/FAQ#undefined-reference-with-build-std
|
# See: https://github.com/cross-rs/cross/wiki/FAQ#undefined-reference-with-build-std
|
||||||
build-%:
|
build-%:
|
||||||
RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \
|
RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \
|
||||||
cross build --bin reth --target $* --features "$(FEATURES)" --profile "$(PROFILE)"
|
cross build --bin reth --target $* --features "$(FEATURES)" --profile "$(PROFILE)"
|
||||||
|
|
||||||
op-build-%:
|
op-build-%:
|
||||||
RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \
|
RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \
|
||||||
cross build --bin op-reth --target $* --features "optimism,$(FEATURES)" --profile "$(PROFILE)"
|
cross build --bin op-reth --target $* --features "optimism,$(FEATURES)" --profile "$(PROFILE)"
|
||||||
|
|
||||||
# Unfortunately we can't easily use cross to build for Darwin because of licensing issues.
|
# Unfortunately we can't easily use cross to build for Darwin because of licensing issues.
|
||||||
# If we wanted to, we would need to build a custom Docker image with the SDK available.
|
# If we wanted to, we would need to build a custom Docker image with the SDK available.
|
||||||
|
|||||||
Reference in New Issue
Block a user