Skip to content
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

Fix MSVC Host Cross Compilation #218

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

nathaniel-daniel
Copy link
Contributor

Closes #118

Without this patch, cross compilation on MSVC seems to directly embed backslashes from the prefix argument as various string constants in a C file via defines, like ENGINESDIR. This causes a build failure, as these backslashes get picked up as escape sequences.

Windows GNU targets are not affected by this issue, as they already do something similar to this patch within sanitize_sh.

I think this issue is caused by OpenSSL using the unix makefile template for cross-building to Linux, which I believe is not capable of escaping backslashes in the prefix argument. I believe that this is why a normal MSVC build works and why cross builds fail.

I have tested that this on Windows 11; this patch allows me to cross compile from x86_64-pc-windows-msvc to x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu.

Copy link
Owner

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you include a comment in the code about why this is being done?

@nathaniel-daniel
Copy link
Contributor Author

Added a comment, let me know if it should be more/less detailed.

@alexcrichton alexcrichton merged commit 86ad505 into alexcrichton:main Nov 30, 2023
16 checks passed
@nathaniel-daniel nathaniel-daniel deleted the fix-msvc-host-cross branch December 2, 2023 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while cross compiling from Windows 10 to Raspberry Pi 2 (armv7-unknown-linux-gnueabihf)
2 participants