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 package detection and build when cross-compiling from MSVC to GNU #180

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

amyspark
Copy link
Contributor

Hi!

I and @dragonmux found two issues when building libusb from a MSVC host to a MinGW target. When the build.rs script is built for the MSVC host,

  • the vcpkg crate is used for detection (which correctly detects the MinGW target and reports an unsupported ABI)
  • a MSVC flag is applied to the build (and thus breaking the build altogether)

This commit fixes both issues by changing vcpkg to a Windows-wide dependency, and then if CARGO_CFG_TARGET_ENV is indeed MSVC, it is used and the /source-charset:utf-8 flag is applied.

Please let us know what you think.

@amyspark amyspark force-pushed the fix-msvc-to-mingw-compilation branch 2 times, most recently from bff9bba to ef1a593 Compare August 26, 2023 01:16
@a1ien
Copy link
Owner

a1ien commented Feb 6, 2024

If you rebase you PR i can merge it

I and @dragonmux found two issues when building libusb from a MSVC host
to a MinGW target. When the build.rs script is built for the MSVC host,

- the vcpkg crate is used for detection (which correctly detects the
  MinGW target and reports an unsupported ABI)
- a MSVC flag is applied to the build (and thus breaking the build
  altogether)

This commit fixes both issues by changing vcpkg to a Windows-wide
dependency, and then if CARGO_CFG_TARGET_ENV is indeed MSVC, it is used
and the /source-charset:utf-8 flag is applied.
@amyspark amyspark force-pushed the fix-msvc-to-mingw-compilation branch from ef1a593 to 307a315 Compare February 6, 2024 22:53
@a1ien
Copy link
Owner

a1ien commented Mar 5, 2024

Thank you. LGTM.

@a1ien a1ien merged commit 29694b9 into a1ien:master Mar 5, 2024
6 of 8 checks passed
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