2

It's ridiculous that sometimes I cannot build some open source projects by myself. Here for SkiaSharp.Desktop (a binding project in the big solution SkiaSharp). I download the source by clicking on Download ZIP (under Clone or Download dropdown button). Almost the source code can be downloaded OK but somehow the dll file libSkiaSharp.dll is missing (also could not be found on the project's GitHub page). Not even a note mentioned about this in the README doc. I could not easily download those dlls (for 3 versions: win-x86, win-x64 and nano-server-x64) somewhere else.

Here are the error messages after trying rebuilding the whole solution:

Could not copy the file "....\output\native\windows\x64\libSkiaSharp.dll" because it was not found. SkiaSharp.Desktop D:\Libraries\SkiaSharp-master\source\SkiaSharp.Build.targets

Could not copy the file "....\output\native\nanoserver\x64\libSkiaSharp.dll" because it was not found. SkiaSharp.Desktop D:\Libraries\SkiaSharp-master\source\SkiaSharp.Build.targets

Could not copy the file "....\output\native\windows\x86\libSkiaSharp.dll" because it was not found. SkiaSharp.Desktop D:\Libraries\SkiaSharp-master\source\SkiaSharp.Build.targets

The output folder does not even exist in the original project directories on the GitHub page. In the project tree for SkiaSharp.Desktop, I can see a folder named runtimes looking like this:

enter image description here

All the folders from runtimes down the directories tree do not exist, nor do the dll files. I understand that they may be solution folders (which are virtual and just like some kind of categories) but the files should exist.

How can I build the SkiaSharp projects successfully (in my case just the SkiaSharp.Desktop)? I could not understand why downloading the source and building it by ourselves is not very easy as it should be. At least all the important things (to help build the source code successfully) need to be included in some noting files like README.

Community
  • 1
  • 1
Hopeless
  • 4,397
  • 5
  • 37
  • 64
  • Here you're https://github.com/mono/SkiaSharp I've contacted with the main contributor to that project and already knew how to build. But still not succeeded – Hopeless Dec 09 '19 at 02:33
  • Please try to change Build Action of the three dlls to **Content**. – Mr Qian Dec 09 '19 at 07:58
  • Just an FYI, the code cannot be built from the downloaded zip as there are several required submodules. Check out the build wiki: https://github.com/mono/SkiaSharp/wiki/Building-SkiaSharp – Matthew Dec 28 '19 at 17:14

1 Answers1

0

I could not understand why downloading the source and building it by ourselves is not very easy as it should be. At least all the important things (to help build the source code successfully) need to be included in some noting files like README.

Test

l have tested the open source code in the latest VS2019 and when I opened the project and faced the same issue as you described.It turns that the system can not find the three dlls in the local machine.

After some research, l think the reason is that the Build Action of three dlls are None by default.

None: The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file.

So when you choose None, they are actually excluded from the project and you can not do any operation such as copy task and just as explanatory documents.

enter image description here

Solution

Please change None to Content so that they will include into the projects and you can build the project successfully without any errors.(It works in my side)

Also, you can refer to this document to know the parameters of the build action.

Edit:

After l followed the build steps of the instructions-----run the bootstrapper.ps1 in powershell, l have got the error like:

enter image description here

Since the first error, l have found in the path

C:\Users\Admin\Downloads\SkiaSharp-master\cake\native-shared.cake

I think the problem for the first error is that the system cannot capture the path to PYTHON_EXE

var PYTHON_EXE = Argument("python", EnvironmentVariable("PYTHON_EXE") ?? "python");

Just as a suggestion, you can define the variable in the System Environment and then input the specific location for python.exe. If it does not work and for the second error, I think you should contact with the author about it.

Hope it could help you.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • this makes the building succeeded but actually it somehow by-passes the copying post-build script (after switching BuildAction from None to Content). So that's why it can build OK because the native dlls are not required at compile time. However when running (such as debugging right in VS), the native dlls are required and you will not be able to run it. My original purpose is mainly to be able to debug it (building is just a test to see if everything is OK) – Hopeless Dec 09 '19 at 19:55
  • we actually need to follow the building instruction (from the author) by running the `bootstrapper.ps1` first, it will pull the remaining resources (including the missing native dll files). After that we will be able to debug the solution normally. That's how it works, however as I said before I've not successfully run the `bootstrapper.ps1` (there is some error about resource not found (404)). The author has not responded anything yet (I contacted him via email). Looks like he's too busy and I don't really hope any response from him. At least I understand the steps to help build the solution – Hopeless Dec 09 '19 at 20:00
  • Yes I did contact with the author but looks like the connection was disconnected, no reply yet. In my case the error code is 404 (something is not found) after executing the `bootstrapper.ps1`, thanks for your effort. – Hopeless Dec 11 '19 at 04:00
  • Since 404 is always the issue that it cannot access some website and l think you could check the powershell script and find the command about accessing the Internet and check whether they have any errors. – Mr Qian Dec 20 '19 at 12:38
  • the problem is something wrong right in the `.ps1` file, I know that some url (to download some file) is wrong or not updated or the server had something changed. Such an error is out of my control, only the author could help. – Hopeless Dec 23 '19 at 06:33
  • 1
    Thanks for your understanding. If you have any other issues that we can help you, please feel free to let us know. – Mr Qian Dec 23 '19 at 10:53
  • Thanks for hopping in here when I was AFK. The reason for the issue with python is that is should either be in PATH or in the PYTHON_EXE. I also have this, and more info in the wiki for building SkiaSharp: https://github.com/mono/SkiaSharp/wiki/Building-SkiaSharp @Hopeless I know building SkiaSharp is a bit of a pain as there are many different platforms and moving parts. I update that wiki every time more info is needed, so just open an issue if you find something missing. – Matthew Dec 28 '19 at 17:13
  • The access denied issue is just that the compiler can't build things in a non-existent folder. – Matthew Dec 28 '19 at 17:14