6 ms·
Skia is a great library, but as all things Google it's a pain to build. They don't use CMake and building it from source takes 20-30 minutes on a modern laptop.
by coffeeaddict1 3y ago
Skia is a great library, but as all things Google it's a pain to build. They don't use CMake and building it from source takes 20-30 minutes on a modern laptop. Furthermore, it's constantly changing its APIs and much of it is undocumented and unclear on how to use optimally. Most of the decisions taken by development team aren't discussed in the open and this makes it hard to understand the codebase.
I wish there was a nice and small vector graphics library with GPU acceleration. So far Skia is the only real option, despite its downsides.
- deleted 3y ago[deleted]
- danpalmer 3y agoOut of interest what's difficult about it to build? In my experience CMake isn't exactly a great developer experience, and many projects of this size take similar times to build. Is the problem specific to Skia or Google open source projects, or is it more based on the (necessary) size of the project?
- pcwalton 3y agoThe difficult parts change all the time and usually boil down to some sort of undocumented or poorly-documented dependency, especially if you're trying to enable the GPU backends. Every time someone I know tries to get it building it takes them a week to figure out how to do it.
- Lutger 3y agoI used to do that when I started out with C/C++...15 years ago. Now my patience is running out after 10 minutes. Tooling has become so much better, but it seems not that much with some C/C++ projects. At least the build times are better, I remember big libs would could take hours to build.
- ho_schi 3y agoMeson and ninja improved a lot in this area for C/C++.
- twic 3y agoDoes Skia have a continuous build somewhere? Is there any way to piggyback off the config for that? I found this: https://github.com/google/skia-buildbot https://github.com/google/skia-buildbot Assuming that the Skia maintainers keep that working, it might be easier to build the buildbot and use that to build Skia, than to build Skia directly!
- jupp0r 3y agoYes, it's built as part of Chrome IIRC.
- rstat1 3y agoTook me less than an hour to figure out how to build it just reading the instructions they have on their website for building. Skia really isn't that hard to use IMO even for GPU accelerated stuff.
- wokwokwok 3y ago> In my experience CMake isn't exactly a great developer experience o_O unlike GN? Have you used it much? https://gn.googlesource.com/gn/ https://gn.googlesource.com/gn/
- deleted 3y ago[deleted]
- danpalmer 3y agoI haven't used GN, I'm mostly thinking of Bazel, but was also just interested in the specifics.
- rstat1 3y agoYes GN IMO is a much better experience than CMake. Its fully self-contained in a single binary that you can easily just distribute with your code. I have a small python script I use with it to regen files, and then to run Ninja to do the actual builds. I've been using it for years and have no complaints.
- pcwalton 3y agoOur joke was "the recommended way to build Skia is to become a Google employee, but there are workarounds available if for some reason that isn't practical". There's also the question of "which parts of Skia". If there are five different conceivable ways to implement something in vector graphics, Skia will implement all five, and there will be some sort of hidden obscure configuration setting that Chrome and Android will use to determine which one actually gets used. It's a very unfriendly piece of software to use, honestly.
- tjpnz 3y agoIn 2024 it would probably be faster to hire a xoogler.
- deleted 3y ago[deleted]
- dkjaudyeqooe 3y ago> I wish there was a nice and small vector graphics library with GPU acceleration. I'm personally skeptical about GPU acceleration being the answer to 2D rendering for various reasons. I'm looking forward to Blend2D < https://blend2d.com/ https://blend2d.com/ > which is JIT based maturing and being the preferred solution.
- gigatexal 3y agoWhat happened to Cairo the 2d graphics tool?
- jb1991 3y agoNothing happened to it. It’s just slow.
- yetihehe 3y agoIt's not that slow, I was amazed by performance when I first used it, but maybe other libs are even faster.
- mort96 3y agoIt's perfectly decent for a CPU renderer, CPU rendering is just slow.
- yetihehe 3y agoI had to make a map module for python desktop application , options were either embed full browser inside and use google maps, or do it myself. C module using cairo was MUCH faster and easier to achieve in 2013. So much faster I didn't have to implement some optimizations I planned because it was already running at about 50fps on average computers with ~1000 individually drawn markers on a map. Requiring any gpu for this was not possible anyway.
- gigatexal 3y ago
- pavlov 3y agoI have an open source project that uses Skia, and I just keep static libraries for all target platforms because the Skia build process is so painful. Maybe once a year I bite the bullet, do a new Skia build on all the platforms, and then I have to figure out how the C++ API has changed. At least that’s just rote work of fixing compiler errors by looking at the new header files. Even though it’s a pain in the ass, I still use Skia because it’s got the best combination of performance and features. Sadly Cairo doesn’t quite compete. Skia gives my project a pretty good guarantee that 2D graphics render like in Chrome, and that’s important for this use case.
- gcr 3y agoOut of curiosity, why do you rebuild? What kinds of new features would get you to want to upgrade?
- Calavar 3y agoHave you considered Blend2D? It's much easier to build, and performance is on par with Skia.
- intblku32 3y agoI thought Blend2D was a CPU-only library. Skia offers hardware acceleration via the GPU.
- charcircuit 3y agoI was skeptical of your claims about building it so I went ahead and downloaded skia and built it myself. It was simple and on my 4 year old desktop (8 cores) it took under a minute to compile skia after it had downloaded its dependencies. All I did was run 2 commands ./tools/git-sync-deps and bazel build //:skia_public. This was not painful at all.
- newaccount74 3y agoHow long did downloading dependencies take? That's part of the build process. As a maintainer of a project that includes another popular library from Google, here's why it's difficult to build: - building requires downloading Googles custom toolchain and build system - dependencies are huge, so you have lenghty download times even on fast connections - it usually works if you are using a recent versions of OS and Python, but if you try running the same command in a year or two it might fail because they changed the requirements - if anything fails you have to dig through multiple levels of abstractions to figure out where it failed and why - if you want to maintain software for a few years, you'll have to keep fixing the build process because the build will suddenly stop working for unknown reasons once a year or so
- charcircuit 3y ago>How long did downloading dependencies take? Around 5 minutes. >That's part of the build process. It's dependent on one's internet speed so I didn't think it made much sense to time it. If it took 20 to 30 minutes to download I would have mentioned it.
- mid-kid 3y agoThis doesn't reflect my experiences at all. I've never built it with bazel, are you sure it's not using some prebuilt binary? The official instructions are https://skia.org/docs/user/build/ https://skia.org/docs/user/build/
- surajrmal 3y agoIt looks like they are several years into a migration to bazel and support both a bazel and gn based build. Bazel is usually faster. It's possible the gn based build builds everything in the repo including all tests, but the bazel one is more targeted, building less things https://skia.org/docs/dev/contrib/bazel/ https://skia.org/docs/dev/contrib/bazel/
- DrScientist 3y agoNot an expert on graphics libs - but I did notice that the Google project Flutter is moving away from Skia to something new called Impeller. https://medium.com/@gauravswarankar/flutter-will-use-an-impeller-instead-of-skia-a5c645b83cc8 https://medium.com/@gauravswarankar/flutter-will-use-an-impe...
- jenadine 3y agoI believe Impeller is even worse with regards to all the issues mentioned in the parent comment. In particular since it is so tight to Flutter.
- DrScientist 3y agoI get the point about it being developed with one primary objective - but perhaps a naive question here - in the end isn't that primary objective a shared one - to render text, lines, curves and images as fast as possible, via some sort of higher level API? And to do so onto multiple OS & hardware backends?
- WorldMaker 3y agoIt's the old coupling versus cohesion problem, isn't it? The tighter the coupling the more likely that abstractions leak across API boundaries. The tighter the monorepo the less likely there's a concerted effort to avoid breaking changes and consider long term API stability.
- loic-sharma 3y agoSkia relies heavily on runtime shader compilation, which is slow and causes frame jank but improves peak performance. Skia also supports much older devices than Flutter does. There’s no free lunch, Impeller has a different set of trade offs that are a better fit for Flutter.
- zozbot234 3y ago> I wish there was a nice and small vector graphics library with GPU acceleration. https://github.com/linebender/vello https://github.com/linebender/vello is written in Rust and already used as the backend for Xilem, a reactive framework for native UI.
- nox101 3y agoVello is used in Skia https://skia.googlesource.com/skia/+/2e551697dc56/third_party/vello/BUILD.gn https://skia.googlesource.com/skia/+/2e551697dc56/third_part...
- djmcnab 3y agoDisclaimer: I work on Vello[0], but not on the Skia integration directly My understanding, having not dug into it too much, is that the Skia integration does exist, but isn't enabled by default/any clients at the moment. That is, I don't know that this integration is shipping anywhere. Vello still has some definite rough edges at the moment, so I'm not sure I'd recommend using it in a production application at the moment. We also don't have a C API, which might rule it out for some cases where you'd be considering Skia. [0]: https://linebender.org/blog/xilem-2024/ https://linebender.org/blog/xilem-2024/
- jupp0r 3y agoI'd encourage you to look into bazel. It's really a great build system, albeit super opinionated. Should be relatively easy to build Skia as part of your project if you are using Bazel yourself.
- c-smile 3y ago> it's a pain to build Yes. So in Sciter I've replaced its build system with relatively simple premake5 script. That replacement took couple of days but was worth it. Premake5 generates human-readable IDE solutions and make files. So you need just a compiler to build the whole thing. > building it from source takes 20-30 minutes on a modern laptop. It is not that bad actually. Just tried full rebuild of x64/Windows version: Whole sciter.dll (HTML/CSS/JS/Graphics) with Skia backend: sciter.dll build completed at 9:11 AM and took 07:03.415 minutes Same sciter.dll but with Direct2D backend: sciter.dll build completed at 9:22 AM and took 02:34.412 minutes So Skia takes ~4 minutes to build on pretty average development desktop machine. > it's constantly changing its APIs That's very true and is a pain indeed if to change its version frequently. Yet there is no such concept as "Skia version" - just revisions/milestones. It used to be an attempt to make stable plain C API but AFAIR it was removed recently. Same thing about Google ANGLE that I started to use recently in Sciter.GLX: https://sciter.com/sciter-glx-beta2/ https://sciter.com/sciter-glx-beta2/
- c-smile 3y agoAbout premake5 in general. premake5 is a monolithic/portable executable that contains Lua + specific runtime. Thus it does not rely on installed Python as in GN case as other tools. Having standard and well known and documented Lua on board benefits the maker a lot. In my opinion any modern build system must include generic and known PL. And that above is the problem of modern CMake. It started as simple static declarative thing but life forced it to evolve into dynamic programming language with very strange notation and runtime model.
- sounds 3y ago> it does not rely on installed Python as in GN case as other tools. I'm curious if you can expand on how you're using python, and what pain points you have there? I think python 3.9 was one for us but not too bad.
- adamjs 3y agoWe wrote exactly that for our game-focused port of WebKit [1]. CPU renderer uses a tiny, custom fork of Skia (we only use the path rasterizer and their SSE2, AVX2, NEON backends) and our GPU renderer draws directly on GPU via tessellated paths / hardware MSAA (DX11, DX12, GL, Metal, Vulkan). [1] https://ultralig.ht https://ultralig.ht
- grandinj 3y agoThis. We use it in LibreOffice, but its a right pain to update versions and debugging it is.... challenging. The upside is that the Google Skia team is super friendly and willing to help.
- irq-1 3y ago> I wish there was a nice and small vector graphics library with GPU acceleration. Check out nanovg: https://github.com/memononen/nanovg https://github.com/memononen/nanovg
- gct 3y agoI recommend blend2d: https://blend2d.com/ https://blend2d.com/. Very well done, very fast. No GPU acceleration but it has a JIT and you can probably get further than you think without it.
- niutech 3y agoThere are some Skia alternatives: - NanoVG - bgfx with vg-renderer - Impeller - Starling