ruby-prism-sys runs both cc and bindgen at build time. When host != target, clang gets --target but no target sysroot, so it parses host headers and fails.
Reproduction (macOS arm64 host)
$ cargo new xrepro --lib && cd xrepro
$ cargo add ruby-prism@1.9
$ rustup target add x86_64-unknown-linux-gnu
$ cargo build --target x86_64-unknown-linux-gnu
vendor/prism-1.9.0/include/prism/defines.h:12:10: fatal error: 'ctype.h' file not found
failed to build Prism from source
In environments where the C toolchain is configured per target (rake-compiler-dock, building precompiled Ruby gems), the C stage succeeds and the same failure moves to bindgen:
/usr/include/features.h:461:12: fatal error: 'sys/cdefs.h' file not found
Unable to generate prism bindings: ClangDiagnostic(...)
Suggestion
#4169 (unreleased) adds RUBY_PRISM_CFLAGS, and CFLAGS_<target> / BINDGEN_EXTRA_CLANG_ARGS_<target> already work — but all of these require users to discover and hardcode per-target sysroot paths.
Would you consider shipping pregenerated bindings (run bindgen at release time, like most -sys crates)? Prism's public API is largely fixed-width types, so the bindings should be target-independent. Cross-compilation would then work out of the box, and the libclang build requirement would go away.
ruby-prism-sysruns bothccandbindgenat build time. When host != target, clang gets--targetbut no target sysroot, so it parses host headers and fails.Reproduction (macOS arm64 host)
In environments where the C toolchain is configured per target (rake-compiler-dock, building precompiled Ruby gems), the C stage succeeds and the same failure moves to bindgen:
Suggestion
#4169 (unreleased) adds
RUBY_PRISM_CFLAGS, andCFLAGS_<target>/BINDGEN_EXTRA_CLANG_ARGS_<target>already work — but all of these require users to discover and hardcode per-target sysroot paths.Would you consider shipping pregenerated bindings (run bindgen at release time, like most -sys crates)? Prism's public API is largely fixed-width types, so the bindings should be target-independent. Cross-compilation would then work out of the box, and the libclang build requirement would go away.