Build skia as shared library on Windows

1,315 views
Skip to first unread message

Kristian

unread,
Dec 7, 2017, 10:07:42 AM12/7/17
to skia-d...@googlegroups.com
Hi,

I am trying to build skia as a shared library on Windows. For this, I
am caling these commands:

> set "GN=<Path>\gn.bat"
> call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
> call "%GN%" gen out/Release --ide=vs --args="is_debug=false is_official_build=true is_component_build=true"
> devenv out/Release/all.sln /Build GN

When starting devenv, I am getting these warning messages:

> skia\out\Release\obj\arm64.vcxproj : warning : The build tools for v141 cannot be found. Install v141 to build using the v141 build tools.

Due to this answer (https://stackoverflow.com/a/44062264), this is
because I have Visual Studio 2015 and Visual Studio 2017 installed on
the system. But I would assume, I would get the Platform Tools for
2015, when running
> call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
before starting GN.

Kristian

unread,
Dec 7, 2017, 10:59:13 AM12/7/17
to skia-d...@googlegroups.com
And when I am compiling with ninja, I am getting also a bunch of
erros, like these:

[6/691] compile ../../src/opts/SkOpts_avx.cpp
FAILED: obj/src/opts/avx.SkOpts_avx.obj
"C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/amd64/cl.exe" /nologo /showIncludes /FC
@obj/src/opts/avx.SkOpts_avx.obj.rsp /c ../../src/opts/SkOpts_avx.cpp
/Foobj/src/opts/avx.SkOpts_avx.obj /Fd"obj/avx_c.pdb"
...\skia\build\skia\include\core\skrefcnt.h(115): error C2220: warning
treated as error - no 'object' file generated
...\skia\build\skia\include\core\skrefcnt.h(115): warning C4251:
'SkRefCntBase::fRefCnt': struct 'std::atomic<int>' needs to have
dll-interface to be used by clients of class 'SkRefCntBase'
c:\program files (x86)\microsoft visual studio
14.0\vc\include\xxatomic(180): note: see declaration of
'std::atomic<int>'
...\skia\build\skia\include\core\skimageinfo.h(346): warning C4251:
'SkImageInfo::fColorSpace': class 'sk_sp<SkColorSpace>' needs to have
dll-interface to be used by clients of struct 'SkImageInfo'
...\skia\build\skia\include\core\skcolorspace.h(79): note: see
declaration of 'sk_sp<SkColorSpace>'

My calls to call the build were these:

> set "GN=<Path>\gn.bat"
> set "NINJA=<Path>\ninja.exe"
> call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
> call "%GN%" gen out/Release --args="is_debug=false is_official_build=true is_component_build=true"
> "%NINJA%" -C out/Release

Kristian

unread,
Dec 7, 2017, 11:23:53 AM12/7/17
to skia-d...@googlegroups.com
When compiling with these commands:

> set "GN=<Path>\gn.bat"
> set "NINJA=<Path>\ninja.exe"
> call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
> call "%GN%" gen out/Release --args="is_component_build=true"
> "%NINJA%" -C out/Release

the compile process looks better, but there are also some errors:

[429/691] compile ../../src/images/SkJPEGWriteUtility.cpp
FAILED: obj/src/images/jpeg.SkJPEGWriteUtility.obj
"C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/amd64/cl.exe" /nologo /showIncludes /FC
@obj/src/images/jpeg.SkJPEGWriteUtility.obj.rsp /c
../../src/images/SkJPEGWriteUtility.cpp
/Foobj/src/images/jpeg.SkJPEGWriteUtility.obj /Fd"obj/jpeg_c.pdb"
...\skia\build\skia\src\codec\skjpegpriv.h(20): fatal error C1083:
Cannot open include file: 'jpeglib.h': No such file or directory

[432/691] compile ../../src/pdf/SkDeflate.cpp
FAILED: obj/src/pdf/pdf.SkDeflate.obj
"C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/amd64/cl.exe" /nologo /showIncludes /FC
@obj/src/pdf/pdf.SkDeflate.obj.rsp /c ../../src/pdf/SkDeflate.cpp
/Foobj/src/pdf/pdf.SkDeflate.obj /Fd"obj/pdf_c.pdb"
...\build\skia\src\pdf\skdeflate.cpp(15): fatal error C1083: Cannot
open include file: 'zlib.h': No such file or directory

[435/691] compile ../../src/codec/SkJpegCodec.cpp
FAILED: obj/src/codec/jpeg.SkJpegCodec.obj
"C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/amd64/cl.exe" /nologo /showIncludes /FC
@obj/src/codec/jpeg.SkJpegCodec.obj.rsp /c
../../src/codec/SkJpegCodec.cpp /Foobj/src/codec/jpeg.SkJpegCodec.obj
/Fd"obj/jpeg_c.pdb"
...\build\skia\src\codec\skjpegpriv.h(20): fatal error C1083: Cannot
open include file: 'jpeglib.h': No such file or directory

Mike Klein

unread,
Dec 7, 2017, 11:26:16 AM12/7/17
to skia-d...@googlegroups.com
I don't think the vcvarsall.bat scripts have any effect on our GN builds.

There should be a bit on skia.org/user/build describing how to choose between 2015 and 2017.

--
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 https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages