Skip to content

Conversation

@wuyisheng
Copy link

As stated in the documentation, for NDK versions prior to r22, you should add common-page-size 16384.

Compile-r22-lower

https://developer.android.com/guide/practices/page-sizes#compile-r22-lower

In addition to the step outlined for NDK r26 and lower, you must set common-page-size=16384 if you are using NDK r22 or lower. Setting common-page-size=16384 is required due to bugs in earlier versions of the GNU ld and LLVM lld linkers. However, we strongly recommend that you update your tooling to a more recent version to avoid these bugs entirely.

Ndk version of conscrypt-android:2.5.3 is r21d.

https://mvnrepository.com/artifact/org.conscrypt/conscrypt-android/2.5.3

$ aarch64-linux-android-readelf -x 16 libconscrypt_jni_2.5.3.so

Hex dump of section '.note.android.ident':
  0x001e876c 08000000 84000000 01000000 416e6472 ............Andr
  0x001e877c 6f696400 15000000 72323164 00000000 oid.....r21d....
  0x001e878c 00000000 00000000 00000000 00000000 ................
  0x001e879c 00000000 00000000 00000000 00000000 ................
  0x001e87ac 00000000 00000000 00000000 00000000 ................
  0x001e87bc 00000000 00000000 36353238 31343700 ........6528147.
  0x001e87cc 00000000 00000000 00000000 00000000 ................
  0x001e87dc 00000000 00000000 00000000 00000000 ................
  0x001e87ec 00000000 00000000 00000000 00000000 ................
  0x001e87fc 00000000 00000000                   ........

Missing this configuration will cause a crash.

java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/~~Bgddz-rAFdbf6xQ==
/org.yeshen.test-CXXXBddPqZMq5gEtDMpA==/lib/arm64/libconscrypt_jni.so" 
program alignment (4096) cannot be smaller than system page size (16384)
	at java.lang.Runtime.loadLibrary0(Runtime.java:1090)
	at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
	at java.lang.System.loadLibrary(System.java:1765)
	at org.conscrypt.NativeCryptoJni.init(Proguard:27)
	at org.conscrypt.NativeCrypto.<clinit>(Proguard:1)
	at org.conscrypt.OpenSSLProvider.<init>(Proguard:4)
	at org.conscrypt.OpenSSLProvider.<init>(Proguard:2)
	at org.conscrypt.OpenSSLProvider.<init>(Proguard:1)

@google-cla
Copy link

google-cla bot commented Jul 31, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Author

@wuyisheng wuyisheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked in my pixel's phone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant