Skip to content

Building on Linux

Matthew Leibowitz edited this page Mar 25, 2018 · 42 revisions

SkiaSharp v1.60.1 has not yet been released, thus some commands may not work properly - specifically the v1.60.1 branch. To build now, use the xamarin-mobile-bindings branch.

As of v1.60.1, building libSkiaSharp.so is very easy and does not even require the mono/SkiaSharp repository. However, it is best to just clone the mono/SkiaSharp repository as it also pulls down additional tools used to build skia, namely depot_tools.

Prior to v1.60.1, use the "Building on Linux (LEGACY)" guide.

Downloading

The first step is to clone the mono/skia repository:

$ git clone https://github.com/mono/skia.git -b v1.60.1

To build the current master, check out xamarin-mobile-bindings as this is the Xamarin "master" - the master branch is reserved for the Google "master".

In order to build libSkiaSharp, Google's depot_tools is also required:

$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

Building

Once skia and depot_tools are cloned, building happens in 3 steps:

$ cd skia
$ python tools/git-sync-deps
$ ./bin/gn 'out/Linux/x64' --args='is_official_build=true skia_enable_tools=false target_os="linux" target_cpu="x64" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_enable_gpu=true extra_cflags=[ "-DSKIA_C_DLL" ] linux_soname_version="60.1.0"'
$ ../depot_tools/ninja 'SkiaSharp' -C 'out/Linux/x64'