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

Statically link to the C runtime in MSVC #670

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

saulecabrera
Copy link
Member

Description of the change

Javy version 1.4.0 statically linked to the C runtime. Such version was built with Rust 1.75.

Javy version 2.0.0, built with Rust 1.79.0, which doesn't perform static linking by default. This commit adds a directive to preserve the same behavior as in v 1.4.0.

Checklist

  • I've updated the relevant CHANGELOG files if necessary. Changes to javy-cli and javy-core do not require updating CHANGELOG files.
  • I've updated the relevant crate versions if necessary. Versioning policy for library crates
  • I've updated documentation including crate documentation if necessary.

@saulecabrera saulecabrera force-pushed the fix-msvc-build branch 2 times, most recently from 37ba579 to e95c407 Compare June 17, 2024 19:44
Javy version 1.4.0 statically linked to the C runtime. Such version was
built with Rust 1.75.

Javy version 2.0.0, built with Rust 1.79.0, which doesn't perform static
linking by default. This commit adds a directive to preserve the same
behavior as in v 1.4.0.
@saulecabrera
Copy link
Member Author

saulecabrera commented Jun 17, 2024

Testing

The best way to test this change at this time is to download the Windows executable available in my fork and make sure that it runs correctly e.g. javy --version.

I considered adding a CI step, but unfortunately there are several considerations:

  1. All Windows runners are pre-provisioned with Visual C++, and apparently: (i) there's no way to uninstall it (ii) there's no way to configure GitHub Actions to provide a fresh runner, without any dependencies. Additionally the GitHub Actions team is not planning on supporting this feature.. The recommended way to modify Windows runners is through Chocolatey, but as far as I investigated, it can't be used uninstall Visual C++ (not surprising).
  2. The recommended approach, as per the link in the previous point is to introduce a custom runner. Which we could adopt if we wanted to, and if we do, my suggestion would be to do it a follow up PR. But generally speaking, the change in this PR is probably enough. If this issue were to happen again, there's a very easy fix that users can apply, which is installing Visual C++.

Copy link
Collaborator

@jeffcharles jeffcharles left a comment

Choose a reason for hiding this comment

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

Tested on my Windows PC without Visual Studio and it seems to work. I probably have a bunch of redistributable Visual Studio dlls installed but not really sure how to be more certain within a reasonable amount of time.

@saulecabrera saulecabrera merged commit 0fa9b05 into bytecodealliance:main Jun 18, 2024
14 checks passed
@saulecabrera saulecabrera deleted the fix-msvc-build branch June 18, 2024 14:43
@saulecabrera saulecabrera mentioned this pull request Jun 18, 2024
3 tasks
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.

None yet

2 participants