Issue with Skia build: is_official_build argument makes build to fail

632 views
Skip to first unread message

Pavel Dey

unread,
Mar 20, 2021, 6:06:59 PM3/20/21
to skia-discuss
Hi,
I am from Adobe India. I am using Skia for creating a video editing application for android. I am building Skia as a shared library and using it in my app. I am trying to keep minimal things in skia library to reduce total app size. As per Skia documentation setting is_official_build argument to true optmizes the build, removes all debug symbols and makes the library suitable for build. I have used the following to build skia 
>> bin/gn gen out/ReleaseXXX --args='is_official_build=true ndk="/Users/myName/Library/Android/sdk/ndk/22.0.7026061" target_cpu="arm64" '

But I am getting this error

[32/1158] compile ../../src/ports/SkFontMgr_android_parser.cpp

FAILED: obj/src/ports/fontmgr_android.SkFontMgr_android_parser.o 

/Users/pavdey/Library/Android/sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang++ -MD -MF obj/src/ports/fontmgr_android.SkFontMgr_android_parser.o.d -DNDEBUG -DSK_GAMMA_APPLY_TO_A8 -DSK_GAMMA_EXPONENT=1.4 -DSK_GAMMA_CONTRAST=0.0 -DSKIA_IMPLEMENTATION=1 -I../.. -Wno-attributes -fstrict-aliasing -fPIC -fvisibility=hidden --sysroot=/Users/pavdey/Library/Android/sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -O3 -fdata-sections -ffunction-sections -Wno-sign-conversion -Wno-unused-parameter -std=c++17 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -c ../../src/ports/SkFontMgr_android_parser.cpp -o obj/src/ports/fontmgr_android.SkFontMgr_android_parser.o

../../src/ports/SkFontMgr_android_parser.cpp:21:10: fatal error: 'expat.h' file not found

#include <expat.h>

         ^~~~~~~~~

1 error generated.

When I tried to remove this error by setting font manager libraries to false, I started getting other errors. I could not actually remove all font related libraries because I need to facilitate text effects in my application.
But if I execute >> bin/gn gen out/Release19 --args='is_official_build=false is_component_build=true is_debug=false ndk="/Users/myName/Library/Android/sdk/ndk/22.0.7026061" target_cpu="arm64" ' I don't see any build error. After this I enable/disable different third party library to reduce skia lib size. lib size is now ~30 mb but I want to make it <10mb. I think this will be more effective and appropriate when is_official_build=true.

Is there anything I can do to fix this? Also, any other suggestion to reduce library size will be extremely helpful.

Thanks

Pavel

Marcus Stenbeck

unread,
Mar 26, 2021, 7:46:28 AM3/26/21
to skia-discuss
Looks like there's a missing dependency. Are you sure that expat.h is resolvable in your standard include paths?

The easiest is to make sure available in the standard include path, but you can also add extra args to the bin/gn gen command:

extra_cflags=["-I/path/to/libexpat/include"]

extra_ldflags=["-lexpat"] 
or extra_ldflags=["-L/path/to/libexpat/lib"]

bin/gn gen out/ReleaseXXX --args='is_official_build=true ...... extra_cflags=[<flags here>] extra_ldflags=[<flags here>]'

You could also run ninja with the verbose flag: ninja -C out/ReleaseXXX <target> -v 
Reply all
Reply to author
Forward
0 new messages