Skip to content

Commit 839d19c

Browse files
authored
Merge pull request #10517 from ajaysehwal/android-16kb-update
build: add Android 16KB page size flags to Makefile
2 parents 7cdf976 + bb1b56f commit 839d19c

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ IOS_BUILD_DIR := $(MOBILE_BUILD_DIR)/ios
2222
IOS_BUILD := $(IOS_BUILD_DIR)/Lndmobile.xcframework
2323
ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR)/android
2424
ANDROID_BUILD := $(ANDROID_BUILD_DIR)/Lndmobile.aar
25+
# For Android, set max page size to 16KB to support devices using 16KB memory pages.
26+
# Reference: https://developer.android.com/guide/practices/page-sizes
27+
ANDROID_MAX_PAGE_SIZE := 16384
28+
ANDROID_EXTLDFLAGS := -extldflags '-Wl,-z,max-page-size=$(ANDROID_MAX_PAGE_SIZE)'
2529

2630
COMMIT := $(shell git describe --tags --dirty)
2731

@@ -494,7 +498,7 @@ macos: mobile-rpc
494498
android: mobile-rpc
495499
@$(call print, "Building Android library ($(ANDROID_BUILD)).")
496500
mkdir -p $(ANDROID_BUILD_DIR)
497-
$(GOMOBILE_BIN) bind -target=android -androidapi 21 -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" -ldflags "$(RELEASE_LDFLAGS)" -v -o $(ANDROID_BUILD) $(MOBILE_PKG)
501+
$(GOMOBILE_BIN) bind -target=android -androidapi 21 -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" -ldflags "$(RELEASE_LDFLAGS) $(ANDROID_EXTLDFLAGS)" -v -o $(ANDROID_BUILD) $(MOBILE_PKG)
498502

499503
#? mobile: Build mobile RPC stubs and project templates for iOS and Android
500504
mobile: ios android

docs/release-notes/release-notes-0.21.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@
378378
and transitioning the documentation to focus on a more reliable "Simnet"
379379
workflow while removing obsolete faucet references.
380380

381+
* [Android Lndmobile 16 KB page size for native libraries](https://github.com/lightningnetwork/lnd/pull/10517)
382+
The Android `Lndmobile.aar` build now passes `-Wl,-z,max-page-size=16384` to
383+
the linker, keeping the generated native library compatible with newer
384+
Android devices that use 16 KB memory pages while preserving compatibility
385+
with existing 4 KB page-size devices.
386+
381387
# Contributors (Alphabetical Order)
382388

383389
* bitromortac

0 commit comments

Comments
 (0)