Skip to content

Commit

Permalink
Fix cross build of rust-skia in cross docker containers
Browse files Browse the repository at this point in the history
Since skia-bindings-0.71.0, bindings.cpp includes SkFontMgr_fontconfig.h, which in turn includes fontconfig/fontconfig.h.

In cross docker containers, the fontconfig headers are installed in /usr/include - there's no sysroot.

For the actual build of bindings.cpp, this is fine - gcc will search in /usr/include and find it.

For the bindgen phase, certain clang versions do not look in -I/usr/include by default when a --target is present - generally a sensible approach probably. However in this very setup, it's okay, so teach bindgen about it by setting BINDGEN_EXTRA_CLANG_ARGS_target. Typically that's used to pass for example `--sysroot=`, but we're using it to explicitly add /usr/include.
  • Loading branch information
tronical committed Feb 29, 2024
1 parent 2b2afaf commit c6534af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/Dockerfile.aarch64-unknown-linux-gnu
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes software-propert
git config --global safe.directory '*'

ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig

# In the absence of a sysroot, the header files we install earlier (such as libfontconfig1-dev:arm64) are in /usr/include
# so remember to teach bindgen to also look there, despite its --target.
ENV BINDGEN_EXTRA_CLANG_ARGS_aarch64_unknown_linux_gnu=-I/usr/include
4 changes: 4 additions & 0 deletions docker/Dockerfile.armv7-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes software-propert
git config --global safe.directory '*'

ENV PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig

# In the absence of a sysroot, the header files we install earlier (such as libfontconfig1-dev:armhf) are in /usr/include
# so remember to teach bindgen to also look there, despite its --target.
ENV BINDGEN_EXTRA_CLANG_ARGS_armv7_unknown_linux_gnueabihf=-I/usr/include
4 changes: 4 additions & 0 deletions docker/Dockerfile.riscv64gc-unknown-linux-gnu
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes software-propert
git config --global safe.directory '*'

ENV PKG_CONFIG_PATH=/usr/lib/riscv64-linux-gnu/pkgconfig

# In the absence of a sysroot, the header files we install earlier (such as libfontconfig1-dev:riscv64) are in /usr/include
# so remember to teach bindgen to also look there, despite its --target.
ENV BINDGEN_EXTRA_CLANG_ARGS_riscv64gc_unknown_linux_gnu=-I/usr/include

0 comments on commit c6534af

Please sign in to comment.