slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.69k stars 613 forks source link

Can't use skia-vulkan #5781

Open Horbin-Magician opened 3 months ago

Horbin-Magician commented 3 months ago

Win11, Slint 1.7.1, Rust

I can't compile successfully when use skia-vulkan, errors are:

error: failed to run custom build command for `skia-bindings v0.75.0`

Caused by:
  process didn't exit successfully: `E:\Project\rotor\target\debug\build\skia-bindings-1e0152954f61cdf5\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=DOCS_RS
  cargo:rerun-if-env-changed=SKIA_DEBUG
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=SKIA_SOURCE_DIR
  cargo:rerun-if-env-changed=FORCE_SKIA_BUILD
  cargo:rerun-if-env-changed=FORCE_SKIA_BINARIES_DOWNLOAD
  TRYING TO DOWNLOAD AND INSTALL SKIA BINARIES: 0.75.0/e7e538647512cab844c3-x86_64-pc-windows-msvc-d3d-gl-textlayout-vulkan
  cargo:rerun-if-env-changed=SKIA_BINARIES_URL
    FROM: https://github.com/rust-skia/skia-binaries/releases/download/0.75.0/skia-binaries-e7e538647512cab844c3-x86_64-pc-windows-msvc-d3d-gl-textlayout-vulkan.tar.gz
  DOWNLOAD AND INSTALL FAILED: curl error code: Some(22)
  curl stderr: Ok("")
  STARTING A FULL BUILD
  cargo:rerun-if-env-changed=CLANGCC
  cargo:rerun-if-env-changed=CC
  cargo:rerun-if-env-changed=CLANGCXX
  cargo:rerun-if-env-changed=CXX
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=OPT_LEVEL
  cargo:rerun-if-env-changed=SKIA_USE_SYSTEM_LIBRARIES
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=SDKTARGETSYSROOT
  cargo:rerun-if-env-changed=SDKROOT
  HOST: x86_64-pc-windows-msvc
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=VCINSTALLDIR
  cargo:rerun-if-env-changed=LLVM_HOME
  cargo:rerun-if-env-changed=USERPROFILE

  --- stderr
  Checking for "C:\\Program Files\\LLVM\\bin\\clang-cl.exe"
  Checking for "C:\\LLVM\\bin\\clang-cl.exe"
  Checking for "C:\\Users\\22400\\scoop\\apps\\llvm\\current\\bin\\clang-cl.exe"
  thread 'main' panicked at D:\Interpreter\Rust\cargo\registry\src\index.crates.io-6f17d22bba15001f\skia-bindings-0.75.0\build_support\platform\windows.rs:32:13:
  Unable to locate LLVM installation
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

I also can not find "x86_64-pc-windows-msvc-d3d-gl-textlayout-vulkan.tar.gz" in the release page

image

tronical commented 3 months ago
  Checking for "C:\\Program Files\\LLVM\\bin\\clang-cl.exe"
  Checking for "C:\\LLVM\\bin\\clang-cl.exe"
  Checking for "C:\\Users\\22400\\scoop\\apps\\llvm\\current\\bin\\clang-cl.exe"
  thread 'main' panicked at D:\Interpreter\Rust\cargo\registry\src\index.crates.io-6f17d22bba15001f\skia-bindings-0.75.0\build_support\platform\windows.rs:32:13:
  Unable to locate LLVM installation

This is the heart of the error message. You need to install LLVM with clang. In your CI we use chocolate and call choco upgrade llvm, but it might be different on your Windows system.

I'll take this as a doc issue as we should cover this error in https://releases.slint.dev/1.7.1/docs/slint/src/advanced/backends_and_renderers#troubleshooting

Horbin-Magician commented 3 months ago
  Checking for "C:\\Program Files\\LLVM\\bin\\clang-cl.exe"
  Checking for "C:\\LLVM\\bin\\clang-cl.exe"
  Checking for "C:\\Users\\22400\\scoop\\apps\\llvm\\current\\bin\\clang-cl.exe"
  thread 'main' panicked at D:\Interpreter\Rust\cargo\registry\src\index.crates.io-6f17d22bba15001f\skia-bindings-0.75.0\build_support\platform\windows.rs:32:13:
  Unable to locate LLVM installation

This is the heart of the error message. You need to install LLVM with clang. In your CI we use chocolate and call choco upgrade llvm, but it might be different on your Windows system.

I'll take this as a doc issue as we should cover this error in https://releases.slint.dev/1.7.1/docs/slint/src/advanced/backends_and_renderers#troubleshooting

After installing LLVM with clang, there is still a probleam:

error: failed to run custom build command for `skia-bindings v0.75.0`

Caused by:
  process didn't exit successfully: `E:\Project\rotor\target\release\build\skia-bindings-939a0a886707418b\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=DOCS_RS
  cargo:rerun-if-env-changed=SKIA_DEBUG
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=SKIA_SOURCE_DIR
  cargo:rerun-if-env-changed=FORCE_SKIA_BUILD
  cargo:rerun-if-env-changed=FORCE_SKIA_BINARIES_DOWNLOAD
  TRYING TO DOWNLOAD AND INSTALL SKIA BINARIES: 0.75.0/e7e538647512cab844c3-x86_64-pc-windows-msvc-d3d-gl-textlayout-vulkan
  cargo:rerun-if-env-changed=SKIA_BINARIES_URL
    FROM: https://github.com/rust-skia/skia-binaries/releases/download/0.75.0/skia-binaries-e7e538647512cab844c3-x86_64-pc-windows-msvc-d3d-gl-textlayout-vulkan.tar.gz
  DOWNLOAD AND INSTALL FAILED: curl error code: Some(22)
  curl stderr: Ok("")
  STARTING A FULL BUILD
  cargo:rerun-if-env-changed=CLANGCC
  cargo:rerun-if-env-changed=CC
  cargo:rerun-if-env-changed=CLANGCXX
  cargo:rerun-if-env-changed=CXX
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=OPT_LEVEL
  cargo:rerun-if-env-changed=SKIA_USE_SYSTEM_LIBRARIES
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=SDKTARGETSYSROOT
  cargo:rerun-if-env-changed=SDKROOT
  HOST: x86_64-pc-windows-msvc
  HOST: x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=VCINSTALLDIR
  cargo:rerun-if-env-changed=LLVM_HOME
  cargo:rerun-if-env-changed=USERPROFILE
  cargo:rerun-if-env-changed=SKIA_NINJA_COMMAND
  cargo:rerun-if-env-changed=SKIA_GN_COMMAND
  Probing 'python'
  Python 3 found: "python"
  Synchronizing Skia dependencies
  Skipping "bin".
  ...rd_party/externals/d3d12allocator @ 169895d529dfce00390a20e69c2f516066fe7a3b
  skia\third_party/externals/expat     @ 441f98d02deafd9b090aea568282b28f66a50e36
  skia\third_party/externals/freetype  @ a46424228f0998a72c715f32e18dca8a7a764c1f
  skia\third_party/externals/icu       @ 364118a1d9da24bb5b770ac3d762ac144d6da5a4
  skia\third_party/externals/libwebp   @ 845d5476a866141ba35ac133f856fa62f0b7445f
  skia\third_party/externals/harfbuzz  @ b74a7ecc93e283d059df51ee4f46961a782bcdb8
  skia\third_party/externals/wuffs     @ e3f919ccfe3ef542cfc983a82146070258fb57f8
  ...third_party/externals/spirv-cross @ b8fcf307f1f347089e3c46eb4451d27f32ebc8d3
  ...y/externals/vulkanmemoryallocator @ a6bfc237255a6bac1513f7c1ebde6d8aed6b5191
  skia\third_party/externals/brotli    @ 6d03dfbedda1615c4cba1211f8d81735575209c8
  ...ird_party/externals/libjpeg-turbo @ ed683925e4897a84b3bffc5c1414c85b97a129a3
  skia\third_party/externals/libpng    @ ed217e3e601d8e462f7fd1e04bed43ac42212429
  skia\third_party/externals/zlib      @ 646b7f569718921d7d4b5b8e22572ff6c76f2596
  Skia args: is_official_build=true is_debug=false skia_enable_svg=false skia_enable_gpu=true skia_enable_skottie=false skia_enable_pdf=true skia_use_gl=true skia_use_egl=false skia_use_x11=false skia_use_system_libpng=false skia_use_libwebp_encode=false skia_use_libwebp_decode=false skia_use_system_zlib=false skia_use_xps=false skia_use_dng_sdk=false skia_use_freetype_woff2=false cc="clang" cxx="clang++" skia_use_vulkan=true skia_enable_spirv_validation=false skia_use_direct3d=true skia_enable_skshaper=true skia_use_icu=true skia_use_system_icu=false skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_harfbuzz=false skia_enable_skparagraph=true skia_use_freetype=false skia_use_system_libjpeg_turbo=false skia_use_expat=true skia_use_system_expat=false clang_win="C:\Program Files\LLVM" clang_win_version="C:\Program Files\LLVM\lib\clang\18" target_cpu="x86_64" extra_cflags=["/MD","--target=x86_64-pc-windows-msvc"] extra_asmflags=["--target=x86_64-pc-windows-msvc"]
  WARNING at the command-line "--args":1:366: Build argument has no effect.
  is_official_build=true is_debug=false skia_enable_svg=false skia_enable_gpu=true skia_enable_skottie=false skia_enable_pdf=true skia_use_gl=true skia_use_egl=false skia_use_x11=false skia_use_system_libpng=false skia_use_libwebp_encode=false skia_use_libwebp_decode=false skia_use_system_zlib=false skia_use_xps=false skia_use_dng_sdk=false skia_use_freetype_woff2=false cc="clang" cxx="clang++" skia_use_vulkan=true skia_enable_spirv_validation=false skia_use_direct3d=true skia_enable_skshaper=true skia_use_icu=true skia_use_system_icu=false skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_harfbuzz=false skia_enable_skparagraph=true skia_use_freetype=false skia_use_system_libjpeg_turbo=false skia_use_expat=true skia_use_system_expat=false clang_win="C:\Program Files\LLVM" clang_win_version="C:\Program Files\LLVM\lib\clang\18" target_cpu="x86_64" extra_cflags=["/MD","--target=x86_64-pc-windows-msvc"] extra_asmflags=["--target=x86_64-pc-windows-msvc"]

     ^----
  The variable "skia_use_freetype_woff2" was set as a build argument
  but never appeared in a declare_args() block in any buildfile.

  To view all possible args, run "gn args --list <out_dir>"

  The build continued as if that argument was unspecified.

  Done. Made 84 targets from 47 files in 3718ms
  ninja: Entering directory `E:\Project\rotor\target\release\build\skia-bindings-1a3a00f8f0d320fa\out\skia'
warning: build failed, waiting for other jobs to finish...
tronical commented 3 months ago

I haven't seen this error before. For me skia_use_freetype_woff2 is declared in skia-bindings/skia/third_party/freetype2/BUILD.gn. I suspect that something with the source checkout didn't work. Perhaps this is a different manifestation of the spaces in path problem of https://releases.slint.dev/1.7.1/docs/slint/src/advanced/backends_and_renderers#troubleshooting ? Could you try the suggested workaround?

Horbin-Magician commented 3 months ago

I haven't seen this error before. For me skia_use_freetype_woff2 is declared in skia-bindings/skia/third_party/freetype2/BUILD.gn. I suspect that something with the source checkout didn't work. Perhaps this is a different manifestation of the spaces in path problem of skia-bindings/skia/third_party/freetype2 ? Could you try the suggested workaround?

I am familiar with neither Cargo nor skia, could you give me more detailed guidance?

tronical commented 3 months ago

Apologies, that wasn't very clear. Maybe try this:

  1. Create a directory c:\cargo_home
  2. Set the CARGO_HOME environment variable to c:\cargo_home
  3. Build again
Horbin-Magician commented 3 months ago

Apologies, that wasn't very clear. Maybe try this:

  1. Create a directory c:\cargo_home
  2. Set the CARGO_HOME environment variable to c:\cargo_home
  3. Build again

I have tried, but the same problem arises. By the way, my workflow have the same problem: https://github.com/Horbin-Magician/rotor/actions/runs/10287601639/job/28471018090#step:4:657

tronical commented 3 months ago

Ahh, thanks, that link brings forward what I think is the actual error.

error: unable to create file reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp: Filename too long ninja: error: FindFirstFileExA(../../../../../../../../../../c:/users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/skia-bindings-0.75.0/skia/modules/skparagraph/src): The filename, directory name, or volume label syntax is incorrect.

What's odd is that we don't see the issues when building Skia on Windows in GitHub actions. We're also using windows-2022.

Horbin-Magician commented 3 months ago

Ahh, thanks, that link brings forward what I think is the actual error.

error: unable to create file reference/opt/shaders-msl/comp/argument-buffers-runtime-array-buffer.argument.device-argument-buffer.argument-tier-1.msl2.comp: Filename too long ninja: error: FindFirstFileExA(../../../../../../../../../../c:/users/runneradmin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/skia-bindings-0.75.0/skia/modules/skparagraph/src): The filename, directory name, or volume label syntax is incorrect.

What's odd is that we don't see the issues when building Skia on Windows in GitHub actions. We're also using windows-2022.

In my PC, I also meet the "Filename too long" error. After I lifted the filename length limit, this error disappears, leaving with the one we said before:

The variable "skia_use_freetype_woff2" was set as a build argument but never appeared in a declare_args() block in any buildfile.

tronical commented 3 months ago

I just tried on my fresh Windows VM and the Skia build works fine for me :-(

tronical commented 3 months ago

I've also scheduled a build in our CI with a forced skia build: https://github.com/slint-ui/slint/commit/f54ecc6ffbde4203cbf9b786f037a09b2de0e89e . The build_and_test job at https://github.com/slint-ui/slint/actions/runs/10315465559/job/28555700314 is green with it... :-(

hunger commented 3 weeks ago

I find it strange that skia_use_freetype=false while skia_use_freetype_woff2 is set as well. That might be a build configuration problem upstream in the skia crate or in how we call that.

hunger commented 3 weeks ago

https://github.com/rust-skia/rust-skia/issues/1054 is about the same issue I think.