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.64k stars 607 forks source link

skia-bindings fail to build with the cc/cpp crates #6875

Open igiona opened 13 hours ago

igiona commented 13 hours ago

Bug Description

After updating some dependencies, the cc/cpp crates got bumped as well. This is now causing my Slint application to fail building the skia-bindings crate with a cryptic error.

  cargo:rerun-if-changed=/home/impy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/skia-bindings-0.78.2/skia/include
  HOST: x86_64-unknown-linux-gnu
  HOST: x86_64-unknown-linux-gnu
  COMPILING BINDINGS: ["src/bindings.cpp", "src/gl.cpp", "src/gpu.cpp", "src/shaper.cpp", "src/paragraph.cpp"]
    DEFINES: NDEBUG= SK_CODEC_DECODES_BMP= SK_CODEC_DECODES_WBMP= SK_R32_SHIFT=16 SK_ENABLE_PRECOMPILE= SK_GANESH= SK_DISABLE_TRACING= SK_USE_PERFETTO= SK_GAMMA_APPLY_TO_A8= SK_ENABLE_AVX512_OPTS= SKIA_IMPLEMENTATION=1 SK_TYPEFACE_FACTORY_FREETYPE= SK_FONTMGR_ANDROID_AVAILABLE= SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE= SK_FONTMGR_FREETYPE_EMBEDDED_AVAILABLE= SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE= SK_FONTMGR_FONTCONFIG_AVAILABLE= SK_GL= SK_SUPPORT_PDF= SK_CODEC_DECODES_JPEG= SK_CODEC_DECODES_ICO= SK_CODEC_DECODES_PNG= SK_HAS_WUFFS_LIBRARY= SK_CODEC_DECODES_GIF= SK_XML= SKSHAPER_IMPLEMENTATION=1 SK_SHAPER_PRIMITIVE_AVAILABLE= SK_SHAPER_HARFBUZZ_AVAILABLE= SK_SHAPER_UNICODE_AVAILABLE= SK_UNICODE_AVAILABLE= SK_UNICODE_ICU_IMPLEMENTATION= SK_ENABLE_PARAGRAPH= SKUNICODE_IMPLEMENTATION=1 U_SHOW_CPLUSPLUS_API=0 U_USING_ICU_NAMESPACE=0 U_DISABLE_RENAMING=1 SK_USING_THIRD_PARTY_ICU= U_COMMON_IMPLEMENTATION= U_STATIC_IMPLEMENTATION= U_ENABLE_DYLOAD=0 U_I18N_IMPLEMENTATION= _XOPEN_SOURCE=0
    ARGS: -std=c++17 -fno-rtti -I/usr/arm-linux-gnueabi/include/c++/7/arm-linux-gnueabi -I/usr/arm-linux-gnueabi/include --sysroot=/home/impy/sdks/lcd_sdk2/sysroots/armv7vet2hf-neon-org-linux-gnueabi

  --- stderr
  fatal: not a git repository (or any of the parent directories): .git

  error occurred: unknown target `arm-org-linux-gnueabi`

If I pin the cc/cpp crates to the older version the build works again as expected:

diff --git a/Cargo.lock b/Cargo.lock
index 7c169bf..dae4842 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -656,9 +656,9 @@ dependencies = [

 [[package]]
 name = "cc"
-version = "1.2.1"
+version = "1.1.30"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
+checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945"
 dependencies = [
  "jobserver",
  "libc",
@@ -957,18 +957,18 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"

 [[package]]
 name = "cpp"
-version = "0.5.10"
+version = "0.5.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f36bcac3d8234c1fb813358e83d1bb6b0290a3d2b3b5efc6b88bfeaf9d8eec17"
+checksum = "bfa65869ef853e45c60e9828aa08cdd1398cb6e13f3911d9cb2a079b144fcd64"
 dependencies = [
  "cpp_macros",
 ]

 [[package]]
 name = "cpp_build"
-version = "0.5.10"
+version = "0.5.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27f8638c97fbd79cc6fc80b616e0e74b49bac21014faed590bbc89b7e2676c90"
+checksum = "0e361fae2caf9758164b24da3eedd7f7d7451be30d90d8e7b5d2be29a2f0cf5b"
 dependencies = [
  "cc",
  "cpp_common",
@@ -981,9 +981,9 @@ dependencies = [

 [[package]]
 name = "cpp_common"
-version = "0.5.10"
+version = "0.5.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25fcfea2ee05889597d35e986c2ad0169694320ae5cc8f6d2640a4bb8a884560"
+checksum = "3e1a2532e4ed4ea13031c13bc7bc0dbca4aae32df48e9d77f0d1e743179f2ea1"
 dependencies = [
  "lazy_static",
  "proc-macro2",
@@ -992,9 +992,9 @@ dependencies = [

 [[package]]
 name = "cpp_macros"
-version = "0.5.10"
+version = "0.5.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d156158fe86e274820f5a53bc9edb0885a6e7113909497aa8d883b69dd171871"
+checksum = "47ec9cc90633446f779ef481a9ce5a0077107dd5b87016440448d908625a83fd"
 dependencies = [
  "aho-corasick",
  "byteorder",

Maybe a newer skia-safe and skia-bindings already fixes this issue, but I couldn't try it out because I can't pin these version on my side, it has to be done via the slint packages.

Reproducible Code (if applicable)

No response

Environment Details

Product Impact

Blocker

tronical commented 12 hours ago

I've noticed the same. Your workaround is correct. I've been talking to cc upstream folks. Will try https://github.com/rust-lang/cc-rs/pull/1298 and remove the target() call from Skia Rust bindings.

tronical commented 12 hours ago

If you see this in the context of a CMake build: 1.8 is not affected because the C++ release comes with a Cargo.lock file. For 1.9 I'll try to make sure that they lock file also pins cc to a version that compiles for Yocto.

igiona commented 12 hours ago

If you see this in the context of a CMake build: 1.8 is not affected because the C++ release comes with a Cargo.lock file. For 1.9 I'll try to make sure that they lock file also pins cc to a version that compiles for Yocto.

I'm not sure what you mean here, I'm building against the official 1.8 release. I use rust, so no CMake of my own around.

tronical commented 12 hours ago

Okay. Yeah then you'll need to maintain your lock file until we have a fix upstream :-/. Sorry!