-
Notifications
You must be signed in to change notification settings - Fork 0
Fix: support 16kb page sizes #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
1c84a97
15a0d3f
61ac391
12915ba
2d7ea97
fd49fc6
654fedf
8cbccd1
279c4f5
45704ce
ee2ad95
66956d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| name: Build and Verify 16KB Page Size Alignment | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master, main, develop ] | ||
| pull_request: | ||
| branches: [ master, main, develop ] | ||
|
|
||
| jobs: | ||
| build-and-verify: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| - name: Cache Gradle packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Build with Gradle | ||
| run: ./gradlew build | ||
|
|
||
| - name: Verify 16KB Page Size Alignment | ||
| run: | | ||
| echo "🔍 Checking 16KB page size alignment of 64-bit native libraries..." | ||
|
|
||
| # Function to check alignment of a shared library | ||
| check_alignment() { | ||
| local lib_path="$1" | ||
| local lib_name=$(basename "$lib_path") | ||
|
|
||
| echo "Checking $lib_name..." | ||
|
|
||
| # Use llvm-readelf from NDK to check alignment | ||
| local ndk_path="$ANDROID_NDK_ROOT" | ||
| local readelf="$ndk_path/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf" | ||
|
|
||
| if [ ! -f "$readelf" ]; then | ||
| echo "❌ Error: llvm-readelf not found at $readelf" | ||
| return 1 | ||
| fi | ||
|
|
||
| # Check LOAD segments alignment | ||
| local alignments=$($readelf -l "$lib_path" | grep "LOAD" | awk '{print $NF}') | ||
|
|
||
| local all_aligned=true | ||
| for alignment in $alignments; do | ||
| # Convert hex to decimal | ||
| local decimal_alignment=$((alignment)) | ||
| local kb_alignment=$((decimal_alignment / 1024)) | ||
|
|
||
| echo " Segment alignment: $alignment ($decimal_alignment bytes = ${kb_alignment}KB)" | ||
|
|
||
| if [ $decimal_alignment -ne 16384 ]; then | ||
| echo " ❌ Not 16KB aligned (expected 0x4000 = 16384 bytes)" | ||
| all_aligned=false | ||
| else | ||
| echo " ✅ 16KB aligned" | ||
| fi | ||
| done | ||
|
|
||
| if [ "$all_aligned" = true ]; then | ||
| echo "✅ $lib_name is properly 16KB aligned" | ||
| return 0 | ||
| else | ||
| echo "❌ $lib_name has incorrect alignment" | ||
| return 1 | ||
| fi | ||
| } | ||
|
||
|
|
||
| # Find all .so files in build outputs (64-bit architectures only) | ||
| echo "Finding 64-bit native libraries in build outputs..." | ||
| so_files=$(find . -path "*/build/intermediates/cxx/*/obj/*/*.so" -type f | grep -E "(Release|RelWithDebInfo)" | grep -E "(arm64-v8a|x86_64)" | head -20) | ||
|
|
||
| if [ -z "$so_files" ]; then | ||
| echo "❌ No native libraries found in build outputs" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found native libraries:" | ||
| echo "$so_files" | ||
| echo | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Check alignment for each library | ||
| all_libs_aligned=true | ||
| for so_file in $so_files; do | ||
| if ! check_alignment "$so_file"; then | ||
| all_libs_aligned=false | ||
| fi | ||
| echo | ||
| done | ||
|
|
||
| # Summary | ||
| echo "📊 Alignment Verification Summary:" | ||
| if [ "$all_libs_aligned" = true ]; then | ||
| echo "🎉 All native libraries are properly 16KB aligned!" | ||
| echo "✅ This build is compatible with 16KB page size devices" | ||
| else | ||
| echo "❌ Some libraries are not properly aligned" | ||
| echo "💡 Ensure you're using Android Gradle Plugin 8.5.1+ and target SDK 35+" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify AAR Contents | ||
| run: | | ||
| echo "🔍 Verifying AAR files contain native libraries..." | ||
|
|
||
| # Find AAR files | ||
| aar_files=$(find . -name "*.aar" -path "*/build/outputs/aar/*" -type f) | ||
|
|
||
| if [ -z "$aar_files" ]; then | ||
| echo "❌ No AAR files found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found AAR files:" | ||
| for aar in $aar_files; do | ||
| echo "📦 $(basename $aar)" | ||
|
|
||
| # Check if AAR contains native libraries | ||
| native_libs=$(unzip -l "$aar" | grep -E "jni/.*\.so$" | wc -l) | ||
|
|
||
| if [ $native_libs -gt 0 ]; then | ||
| echo " ✅ Contains $native_libs native libraries" | ||
| echo " 📋 Native library details:" | ||
| unzip -l "$aar" | grep -E "jni/.*\.so$" | awk '{print " " $4}' | ||
| else | ||
| echo " ℹ️ No native libraries (library may be pure Java/Kotlin)" | ||
| fi | ||
| echo | ||
| done | ||
|
|
||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: build-outputs | ||
| path: | | ||
| **/build/outputs/aar/*.aar | ||
| **/build/intermediates/cxx/*/obj/*/*.so | ||
| retention-days: 7 | ||
|
|
||
| - name: Upload lint reports | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: lint-reports | ||
| path: | | ||
| **/build/reports/lint-results-*.html | ||
| retention-days: 7 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,4 +9,5 @@ build/ | |
| *.spvchain | ||
| *.wallet | ||
|
|
||
| .DS_Store | ||
| .DS_Store | ||
| local.properties | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "dash-sdk-bindings" | ||
| version = "2.0.0" | ||
| version = "2.0.2" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "dash-sdk-bindings" | ||
| version = "2.0.0" | ||
| version = "2.0.2" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "platform-mobile" | ||
| version = "2.0.0" | ||
| version = "2.0.2" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.