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

build.rs issues when cross-compiling #1367

Open
catvir opened this issue Nov 14, 2023 · 0 comments
Open

build.rs issues when cross-compiling #1367

catvir opened this issue Nov 14, 2023 · 0 comments

Comments

@catvir
Copy link

catvir commented Nov 14, 2023

Hi! Thanks a lot for bringing V8 to rust world! This is awesome! :)

I've found a little issue when cross-compiling this wonderful library and I'm happy to share my findings to contribute to this project and wonderful rust community.

In my particular case my host is x86_64-unknown-linux-gnu and target is x86_64-pc-windows-msvc.
I used magnificent cargo-xwin package to achieve that. However it turns out that in rusty_v8 build.rs target conditions work great when host and target is the same, but not in such case. The culprit is that build.rs uses $[cfg(target_os = ...)], however in this context target_os refers to target of build.rs, which is compiled to be run on host, and this is not what target_os of rusty_v8 is.

This is a misunderstanding that I've seen happen in other projects too, like druid (maan2003/druid@229a3e1) for example, and using CARGO_CFG_TARGET_OS env instead seems to do the trick.

In my case the effect of this was that script tried to download prebuild .a file for windows platform, which does not exist and results in 404. As a workaround I specified the RUSTY_V8_ARCHIVE env var manually which allowed me to build the crate using correct .lib file. If anyone encounters same difficulties, then I also had to set CXXSTDLIB to msvcprt, because I got linking errors due to missing __ExceptionPtrCreate symbols.

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

No branches or pull requests

1 participant