Fix cross compilation of binding-generator#720
Conversation
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",
[...]
There was a problem hiding this comment.
Pull request overview
This PR adjusts how the binding generator discovers Clang’s default C/C++ include search paths so cross-compilation header parsing won’t accidentally pick up host system include directories.
Changes:
- Pass
-nostdlibinctoclang_sys::support::Clang::find(...)when collectingcpp_search_paths, to prevent host standard library include paths from being captured and later forwarded into the libclang parse.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This breaks the CI unfortunately, with errors indicating being unable to include system headers, e.g.: |
|
I have no idea why the ubuntu 22.04 build breaks As the include paths compared to ubuntu 24.04 are identical beside the version number, I suspect the LLVM-14 installation is somehow borked. For Mac the include paths look good I don't have a Mac so I don't know where the |
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",
[...]
Please also consider adding this as a fix to 0.99.1. Currently build breaks on master for systems with both openvc5 and opencv4 installed, but the project requiring opencv4.