Consider disabling some OpenSSL features on Android
libTor.so
grew a little bit between stable and the first APK I've built after the toolchain update.
It grew from 9MB to 11MB in x86_64. Or, after compression, from 3.6MB to 4.2MB.
I found this GitHub issue in which they suggested to disable features.
I tried (without no_dh
, which is needed by Tor), and I went back to 3.6MB (after compression with 7z a -mx9
).
This was my diff:
diff --git a/projects/openssl/config b/projects/openssl/config
index 8801a3d7..66371a3b 100644
--- a/projects/openssl/config
+++ b/projects/openssl/config
@@ -26,7 +26,7 @@ targets:
configure_opts: '--cross-compile-prefix=[% c("var/build_target") %]- darwin64-[% c("var/macos_arch") %]-cc enable-ec_nistp_64_gcc_128'
android:
var:
- configure_opts: 'CC=[% c("var/CC") %] android-[% c("var/toolchain_arch") %] -no-shared -D__ANDROID_API__=[% c("var/android_min_api") %]'
+ configure_opts: 'CC=[% c("var/CC") %] android-[% c("var/toolchain_arch") %] -no-shared -D__ANDROID_API__=[% c("var/android_min_api") %] -ffunction-sections -fdata-sections no-argon2 no-aria no-async no-bf no-blake2 no-camellia no-cast no-cmp no-cms no-comp no-des no-dgram no-dsa no-ec2m no-engine no-gost no-http no-idea no-md4 no-mdc2 no-multiblock no-nextprotoneg no-ocb no-ocsp no-quic no-rc2 no-rc4 no-rmd160 no-scrypt no-seed no-siphash no-siv no-sm2 no-sm3 no-sm4 no-srp no-srtp no-ts no-whirlpool -Os'
input_files:
- project: container-image
I tried -ffunction-sections -fdata-sections
to potentially allow strip
/the linker to remove more, but it didn't work.
Also, I wonder if we can skip -Os
.
Edited by Pier Angelo Vendrame