skia2/tools/sk_app
Kevin Lubick 7a14f783bd [bazel] Sketching out HelloWorld sk_app using GL
bazel run //example:hello_world --config=clang
causes a window to open and draws a circle and a square.
Text to follow in a future CL.

To make this work, I had to get rid of musl and use glibc.
All the shared libraries (.so files) that were pre-built
and available for download (e.g. from https://packages.debian.org/bullseye/amd64/libgl1/download)
were compiled against glibc. When I tried to run a
program statically linked with musl and dynamically linked
against things using glibc, I got a segmentation fault
on things like calloc().

Initial attempts to use glibc had failed because it was thought
that the libc.so.6 file could only be referred to by absolute
path (and thus Bazel would not be happy about it). As it turns out,
that was simply a misconfiguration of the builtin_sysroot
parameter to cc_common.create_cc_toolchain_config_info
(see //toolchain/clang_toolchain_config.bzl). By setting that
to `external/clang_linux_amd64` and not
`external/clang_linux_amd64/usr`, the libc binary which had
been extracted to `external/clang_linux_amd64/lib/x86_64-linux-gnu`
was perfectly reachable from
`external/clang_linux_amd64/usr/usr/lib/x86_64-linux-gnu/libc.so`

To bring in the shared libraries to link against (e.g. X11, GL)
I made build_toolchain.bzl easier to modify in that we simply need
to add a debian download url and sha256 hash to a list (rather than
having to plumb this through via arguments).

Recommended Review Order:
 - example/BUILD.bazel (not sure if we always want to set bare
   link arguments like that or if we want to use "features" to
   pass those along to the toolchain).
 - tools/sk_app/BUILD.bazel to see initial cc_library for
   wrapping sk_app code.
 - toolchain/build_toolchain.bzl to see removal of musl and
   new list of debs.
 - toolchain/clang_toolchain_config.bzl (where use of the
   no-canonical-prefixes was key to compilation success).
   Notice also that we statically linked libc++ (I did not
   have any shared libraries for it locally, so I guessed
   a typical developer might not either).
 - Rest of toolchain/ for trivial renames.
 - bazel/Makefile to see extra docs on those targets and
   a new target that compiles all the exes so far for a
   quick way to test the build.
 - third_party/BUILD.bazel and src/gpu/BUILD.bazel which have
   non-generated changes. (all other BUILD.bazel files do).
 - go.mod, which needed to update the infra repo version in
   order to pick up http://review.skia.org/491736).

Change-Id: I8687bd227353040eca2dffa9465798d8bd395027
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492117
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-11 13:06:19 +00:00
..
android [bazel] Try adding cc_binary rules that use generated rules 2021-11-30 18:18:53 +00:00
ios [bazel] Try adding cc_binary rules that use generated rules 2021-11-30 18:18:53 +00:00
mac [bazel] Try adding cc_binary rules that use generated rules 2021-11-30 18:18:53 +00:00
unix [bazel] Try adding cc_binary rules that use generated rules 2021-11-30 18:18:53 +00:00
wasm Set up basic hello world sk_app 2022-01-06 20:29:35 +00:00
win [bazel] Try adding cc_binary rules that use generated rules 2021-11-30 18:18:53 +00:00
Application.h Remove SampleApp and convert HelloWorld to sk_app 2017-11-21 18:37:19 +00:00
BUILD.bazel [bazel] Sketching out HelloWorld sk_app using GL 2022-01-11 13:06:19 +00:00
CommandSet.cpp Migrate SK_strcasecmp to SkStringUtils.h. 2021-12-08 22:52:04 +00:00
CommandSet.h tools/skui: put all enums in a common namespace 2019-08-29 15:39:32 +00:00
DawnWindowContext.cpp Fix usage of deprecated wgpu::TextureUsage::OutputAttachment 2021-05-17 14:42:30 +00:00
DawnWindowContext.h Update the sk_app WindowContext to hold a GrDirectContext 2020-07-10 18:27:03 +00:00
DisplayParams.h Hide binaryArchive use in Viewer behind a flag. 2020-11-25 17:27:47 +00:00
GLWindowContext.cpp Rename GrContextPriv to GrDirectContextPriv 2020-10-14 16:46:01 +00:00
GLWindowContext.h Update the sk_app WindowContext to hold a GrDirectContext 2020-07-10 18:27:03 +00:00
GraphiteMetalWindowContext.h [graphite] Add support to Mac Viewer. 2021-09-30 21:38:25 +00:00
GraphiteMetalWindowContext.mm [graphite] Add support to Mac Viewer. 2021-09-30 21:38:25 +00:00
MetalWindowContext.h Fix ODR violation in Metal code. 2021-10-20 21:33:32 +00:00
MetalWindowContext.mm Reland "Add new GrSurfaceInfo class and related backend structs." 2021-09-20 20:44:53 +00:00
RasterWindowContext.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
VulkanWindowContext.cpp VulkanWindowContext uses sample-able swap VkImages when available. 2020-10-09 21:53:43 +00:00
VulkanWindowContext.h VulkanWindowContext uses sample-able swap VkImages when available. 2020-10-09 21:53:43 +00:00
Window.cpp Add activation events to sk_app. 2020-11-16 16:44:08 +00:00
Window.h [graphite] Add support to Mac Viewer. 2021-09-30 21:38:25 +00:00
WindowContext.cpp [graphite] Add support to Mac Viewer. 2021-09-30 21:38:25 +00:00
WindowContext.h [graphite] Add support to Mac Viewer. 2021-09-30 21:38:25 +00:00