Building SkiaSharp on Windows

BradRobinsonBradRobinson AUMember ✭✭✭

Hi Guys,

Because of this I'm trying to build SkiaSharp from source. I've followed the instructions on github page.

But getting build errors like so:

c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt.h(175): fatal error C1083: Cannot open include file: 'winapifamily.h': No such file or directory

Are there some steps or installation pre-requisites missing from the instructions?

(I have both VS2015 and VS2017 installed if that matters)

Brad

Answers

  • mattleibowmattleibow ZAXamarin Team Xamurai

    You have to install the 10.0.10240.0 Windows 10 SDK and the Universal Runtime packages.

  • BradRobinsonBradRobinson AUMember ✭✭✭
    edited November 2017

    Thanks Matt.

    Still struggling with this. I got past the original problem by starting with a fresh VM and installing:

    1. Python 27 and updated path
    2. .NET Core 2
    3. Git
    4. Visual Studio 2015 with options:

    (From the instructions on the github page is sounds like on Windows I don't need the Android SDK right?)

    Now I'm getting errors about Platform Toolset v141 missing (which is weird cause as the above screen shot shows they're installed or is "Tools v1.4.1" something different?):

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\brad\Projects\SkiaSharp\native-builds\libSkiaSharp_uwp\libSkiaSharp.vcxproj]


    On another machine where I have both VS2015 and 2017 installed, it seems to get further, but then fails with this:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1979,3): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. [C:\Users\win7\Projects\SkiaSharp\native-builds\libSkiaSharp_uwp\libSkiaSharp.vcxproj]


    Could you please clarify exactly what needs to be installed in order for this to build.

    Also, is there a way to just build the Windows desktop components instead of everything?

  • DavidLedgerDavidLedger AUMember ✭✭

    I didn't know skiasharp functioned with python either way this may help:
    https://github.com/mono/SkiaSharp/wiki/SkiaSharp-with-Python

    You need to use nuget from your project to get skiasharp.

  • BradRobinsonBradRobinson AUMember ✭✭✭

    @DavidLedger, that doesn't help. I'm trying to build from source because I'd prefer use statically linked versions of libSkiaSharp.dll which don't ship in the nuget package.

  • BradRobinsonBradRobinson AUMember ✭✭✭

    OK, I think I've made a little progress. Not sure exactly what changed but I've turned on a few more options in the VS2017 installer (in particular the win 10 10240 SDK) and also did a clean:

    .\bootstrapper.ps1 -Target clean
    

    It seems to get a lot further along (builds a couple of different configurations of the skia cpp files) before failing with this:

    C:\Users\Brad\Projects\SkiaSharp\native-builds\libSkiaSharp_uwp\obj\ARM\Release\libSkiaSharp\SkiaKeeper.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM' [C:\Users\Brad\Projects\SkiaSharp\native-builds\libSkiaSharp_uwp\libSkiaSharp.vcxproj]

  • BradRobinsonBradRobinson AUMember ✭✭✭

    Phew! Got it to work, by building just the Windows bits:

    .\bootstrapper.ps1 -Target externals-windows

    @mattleibow : any chance of updating the build instructions page to better describe the installation prerequisites (I'm still not sure if its VS2015 or 2017), the required Visual Studio options and SDKs as well as a list of the available build targets.

    Now to figure out how to make a statically linked version...

Sign In or Register to comment.