From 5d66fcda0e057bf264749aadc052b78f85bd95df Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Sat, 18 Jul 2026 17:16:48 +0200 Subject: [PATCH] Fix cross compilation of binding-generator Pass -nostdlibinc to clang so that host path will not be included, as they will break compilation with target SDK toolchain: === Using OpenCV headers from: /opt/sdk/dev/sysroots/armv8a-tq-linux/usr/include/opencv4 === Clang: clang version 22.1.8 === Clang command line args: [ "-isystem/opt/sdk/dev/sysroots/x86_64-tqsdk-linux/usr/lib/clang/22/include", "-isystem/usr/local/include", "-isystem/usr/include", [...] --- binding-generator/src/generator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding-generator/src/generator.rs b/binding-generator/src/generator.rs index 048a1e34..34ffcad1 100644 --- a/binding-generator/src/generator.rs +++ b/binding-generator/src/generator.rs @@ -383,7 +383,7 @@ impl Drop for Generator { impl Generator { pub fn new(opencv_include_dir: &Path, additional_include_dirs: &[&Path], src_cpp_dir: &Path) -> Self { - let clang_bin = clang_sys::support::Clang::find(None, &[]).expect("Can't find clang binary"); + let clang_bin = clang_sys::support::Clang::find(None, &["-nostdlibinc".to_string()]).expect("Can't find clang binary"); let mut clang_include_dirs = clang_bin.cpp_search_paths.unwrap_or_default(); for additional_dir in additional_include_dirs { match canonicalize(additional_dir) {