Optimize Skia build for Android

594 views
Skip to first unread message

Md. Shamsul Arifin Mozumder

unread,
Aug 28, 2015, 12:24:44 AM8/28/15
to skia-discuss

Hi,

I have built skia for android and followed this tutorial:
https://sites.google.com/site/skiadocs/user-documentation/quick-start-guides/android


After building skia, my shared lib(libskia.so) file size has been around 50-60MB (for debug and release build).


Is there any way to optimize the build and make shared lib file size under 10MB?


Thanks,

Arifin

Mike Klein

unread,
Aug 28, 2015, 9:24:40 AM8/28/15
to skia-discuss
If you're using our GYP files to build Skia, you're using build scripts mostly designed for development (even Release) where we don't pay much attention to library structure or size.  They're all built with -g, which bloats the file size considerably.

I can reproduce your issue:
$ platform_tools/android/bin/android_ninja -d arm_v7_neon -t Release skia_lib
...
$ ls -lh out/config/android-arm_v7_neon/Release/lib/libskia_android.so
-rwxr-xr-x  1 mtklein  staff    50M Aug 28 09:19 out/config/android-arm_v7_neon/Release/lib/libskia_android.so

Here's what I'd suggest to fix it:
$ env CPPFLAGS=-g0 platform_tools/android/bin/android_ninja -d arm_v7_neon -t Release skia_lib
...
$ ls -lh out/config/android-arm_v7_neon/Release/lib/libskia_android.so
-rwxr-xr-x  1 mtklein  staff   5.5M Aug 28 09:23 out/config/android-arm_v7_neon/Release/lib/libskia_android.so

There's still quite a lot in there you might not need, but that ought to get you within expected size.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Jim Van Verth

unread,
Aug 28, 2015, 9:32:17 AM8/28/15
to skia-discuss
Stripping out the debug symbols might also do what you need: strip --strip-unneeded libskia_android.so

Mike Klein

unread,
Aug 28, 2015, 9:35:04 AM8/28/15
to skia-discuss
Yep, either way works.

Mike Reed

unread,
Aug 28, 2015, 9:37:24 AM8/28/15
to skia-d...@googlegroups.com
Lets try to capture this on our site or build-dox

Heather Miller

unread,
Aug 28, 2015, 4:30:36 PM8/28/15
to skia-d...@googlegroups.com

If someone hasn't yet, I will start a doc draft and share it for edits on our build output, options.

Heather

Reply all
Reply to author
Forward
0 new messages