{"id":946,"date":"2024-08-18T12:35:14","date_gmt":"2024-08-18T19:35:14","guid":{"rendered":"https:\/\/porkrind.org\/missives\/?p=946"},"modified":"2024-08-18T12:44:59","modified_gmt":"2024-08-18T19:44:59","slug":"building-slint-on-macos-with-the-skia-backend","status":"publish","type":"post","link":"https:\/\/porkrind.org\/missives\/building-slint-on-macos-with-the-skia-backend\/","title":{"rendered":"Building Slint on macOS with the skia backend"},"content":{"rendered":"<p>I got a weird error while trying to compile a <a href=\"https:\/\/slint.dev\">slint<\/a> program with the skia backend on my macOS machine:<\/p>\n<pre><code>   Compiling skia-bindings v0.75.0\nerror: failed to run custom build command for `skia-bindings v0.75.0`\n\n[\u2026a huge section of output snipped\u2026]\n\n  clang -MD -MF obj\/third_party\/externals\/libpng\/libpng.png.o.d -DPNG_SET_OPTION_SUPPORTED -DNDEBUG  -w -Wno-attributes -ffp-contract=off -fstrict-aliasing -fPIC -fvisibility=hidden -isysroot \/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/MacOSX.platform\/Developer\/SDKs\/MacOSX14.5.sdk -target arm64-apple-macos11 -O3 -O0 -isystem \/Users\/me\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/libpng -isystem \/Users\/me\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/externals\/libpng -isystem \/Users\/me\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/externals\/zlib  -c ..\/..\/..\/..\/..\/..\/..\/..\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/externals\/libpng\/png.c -o obj\/third_party\/externals\/libpng\/libpng.png.o\n  In file included from ..\/..\/..\/..\/..\/..\/..\/..\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/externals\/libpng\/png.c:14:\n  \/Users\/me\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/externals\/libpng\/pngpriv.h:945:4: error: ZLIB_VERNUM != PNG_ZLIB_VERNUM       \"-I (include path) error: see the notes in pngpriv.h\"\n  #  error ZLIB_VERNUM != PNG_ZLIB_VERNUM \\\n     ^\n  1 error generated.\n  [767\/827] compile ..\/..\/..\/..\/..\/..\/..\/..\/.cargo\/registry\/src\/index.crates.io-6f17d22bba15001f\/skia-bindings-0.75.0\/skia\/third_party\/externals\/libpng\/pngerror.c\n  FAILED: obj\/third_party\/externals\/libpng\/libpng.pngerror.o \n<\/code><\/pre>\n<p>There wasn&#8217;t a lot of info online (Google returned nothing of interest for <code>\"ZLIB_VERNUM != PNG_ZLIB_VERNUM\"<\/code>) but <a href=\"https:\/\/duckduckgo.com\">DuckDuckGo<\/a> eventually led me to <a href=\"https:\/\/github.com\/zlib-ng\/zlib-ng\/issues\/1174#issuecomment-1080013105\">this<\/a>. I checked and noticed I had this environment variable set:<\/p>\n<pre><code class=\"language-shell\">CPATH=\/Users\/me\/.nix-profile\/include:\/opt\/homebrew\/include:\n<\/code><\/pre>\n<p>Turns out that was causing the issue. I did a quick <code>unset CPATH<\/code> and then <code>cargo build<\/code> worked!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got a weird error while trying to compile a slint program with the skia backend on my macOS machine: Compiling skia-bindings v0.75.0 error: failed to run custom build command for `skia-bindings v0.75.0` [\u2026a huge section of output snipped\u2026] clang -MD -MF obj\/third_party\/externals\/libpng\/libpng.png.o.d -DPNG_SET_OPTION_SUPPORTED -DNDEBUG -w -Wno-attributes -ffp-contract=off -fstrict-aliasing -fPIC -fvisibility=hidden -isysroot \/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/MacOSX.platform\/Developer\/SDKs\/MacOSX14.5.sdk -target arm64-apple-macos11 &hellip; <a href=\"https:\/\/porkrind.org\/missives\/building-slint-on-macos-with-the-skia-backend\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Building Slint on macOS with the skia backend<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-946","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/comments?post=946"}],"version-history":[{"count":4,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/946\/revisions"}],"predecessor-version":[{"id":952,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/946\/revisions\/952"}],"wp:attachment":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/media?parent=946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/categories?post=946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/tags?post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}