-
Notifications
You must be signed in to change notification settings - Fork 410
Standard library headers not found by bindgen when cross-compiling for Windows #1147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
just a tip for you. [target.x86_64-pc-windows-gnu]
dockerfile = "Dockerfile" would automatically build the dockerfile for you. But also it could be replaced with [target.x86_64-pc-windows-gnu]
image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:main"
pre-build = ["apt-get update && apt-get install --assume-yes --no-install-recommends libclang-dev clang"] |
This is partially a duplicate of #1112, and also linked to #1110. However, there's still issues afterwards. The relevant part of the log is below, and as we can see, the toolchain and CMake configuration is done, however, the build script is now unable to find
This should be part of the search path, but oddly, it's not found: $ `x86_64-w64-mingw32-gcc-posix -print-prog-name=cc1plus` -v
ignoring nonexistent directory "/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/../../../../x86_64-w64-mingw32/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/include/c++
/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/include/c++/x86_64-w64-mingw32
/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/include/c++/backward
/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/include
/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/include-fixed
/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/../../../../x86_64-w64-mingw32/include
End of search list. We might need to modify the bindgen sysroot or something. EDIT: A similar issue seems to occur on
Here, for some reason, it's trying to include the host |
I've run into a similar case in: where I get a stack trace of:
On a native runner, just installing multilib is sufficient there, but here, I can't seem to get this to work unfortunately: [workspace.metadata.cross.target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt update && apt install -y g++ g++-multilib libclang-dev clang"
]
[workspace.metadata.cross.target.armv7-unknown-linux-gnueabihf]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt update && apt install -y g++ g++-multilib libclang-dev clang"
] I tried going extra with dependencies, e.g. [workspace.metadata.cross.target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt install -y g++:$CROSS_DEB_ARCH gcc:$CROSS_DEB_ARCH g++-9:$CROSS_DEB_ARCH gcc-9:$CROSS_DEB_ARCH cpp:$CROSS_DEB_ARCH binutils:$CROSS_DEB_ARCH"
] But that didn't do the trick either. |
Checklist
Describe your issue
When cross-compiling for Windows, bindgen fails to find standard C++ library headers.
What target(s) are you cross-compiling for?
x86_64-pc-windows-gnu
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
cross 0.2.4, on cargo 1.67.0-nightly (a3dfea71c 2022-11-11)
Example
This produces the following error:
Additional information / notes
A workaround is to pass
-I/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/include/c++ -I/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/include/c++/x86_64-w64-mingw32
as arguments to the underlying Clang process:Building this crate for
x86_64-unknown-linux-gnu
succeeds.The text was updated successfully, but these errors were encountered: