Assistance Needed for Building Skia Statically and Removing Explicit Pthread Linking

28 views
Skip to first unread message

Ninad Dafale

unread,
May 25, 2023, 8:44:06 AM5/25/23
to skia-discuss
Hello Skia Community,

I'm currently working on building Skia statically. These are the build arguments I'm using:

bin/gn gen out/Static --args='is_official_build=false skia_use_system_freetype2=false skia_use_gl=false skia_use_fontconfig=false'

I've also created a file called snapshot.cpp, which is responsible for capturing a snapshot of the provided image using skia. I'm compiling snapshot.cpp using the following command:

clang++ -g -std=c++17 snapshot.cpp -o snapshot -I/home/maint/skia -L/home/maint/skia/out/Static -lskia -pthread

In this command, I need to explicitly link against pthread and specify -std=c++17 in order to compile it successfully.

Could you please advise me on the different arguments I should use so that I don't need to link against pthread explicitly and mention -std=c++17?

Thank you in advance...!!

Brian Osman

unread,
May 25, 2023, 9:15:51 AM5/25/23
to skia-d...@googlegroups.com
I don't think that's possible. Skia takes advantage of C++17 features, so any code that includes Skia headers will need to target C++17 (or later). Although Skia doesn't ever create threads, it does use pthreads to ensure thread-safe access to certain caches and other objects. There is no option to disable that behavior. Is there a reason that you want to remove the C++17 flag and the pthread dependency?

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/a8feb387-205f-43f6-b213-52dcaaed3b04n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages