duckduckgo / sync_crypto

Apache License 2.0
4 stars 2 forks source link

Android : Fix problem that native lib on 16KB page size devices might crash. #18

Open KuanChunChen opened 3 months ago

KuanChunChen commented 3 months ago

Description

Android 15 introduces a new feature related to 16KB page sizes, which may cause crashes on some devices.

The Android official documentation provides details on this update. For more information, please refer to the official website: https://developer.android.com/guide/practices/page-sizes#cmake

If you run the DuckDuckGo app on Android 15 devices that use 16KB page sizes, you may encounter crash exceptions like the one shown below: 截圖 2024-08-30 下午3 22 52

How

  1. Add the following declaration to set the maximum page size:
    target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,max-page-size=16384")
  2. Rebuild 1.0.20 libsodium with the updated page size declaration and integrate it into this repository:
    export LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=16384 -Wl,--gc-sections"