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

Choice of ABI for host code on Windows #46

Closed
jschwe opened this issue Dec 11, 2022 · 1 comment
Closed

Choice of ABI for host code on Windows #46

jschwe opened this issue Dec 11, 2022 · 1 comment

Comments

@jschwe
Copy link

jschwe commented Dec 11, 2022

Assuming the following input:

      name: Install Rust
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: stable
        targets: x86_64-pc-windows-gnu

The following line

- run: rustup default ${{steps.parse.outputs.toolchain}}

runs e.g. rustup default stable, but this is incorrect on windows if previously there was already a different stable toolchain (stable-x86_64-pc-windows-msvc) installed (as is the case in github actions). The default toolchain after the action has run will still be the one with msvc abi, which is likely not what most github actions users would expect.

Since the action does allow multiple targets to be installed, I'm not sure how best to fix this.

@dtolnay
Copy link
Owner

dtolnay commented Dec 11, 2022

I think this is working correctly. Rustup's host toolchain on Windows is always x86_64-pc-windows-msvc by default. When you install a toolchain with support for the x86_64-pc-windows-gnu target, that is a cross-compilation toolchain. Code that is built for the host, such as build scripts and proc macros, are going to get built with MSVC ABI; code that is built for the target would get GNU ABI. Just like if you were targeting any other arbitrary non-Windows target with a cross-compiler.

If you want GNU ABI for host code, you would need to install toolchain: stable-x86_64-pc-windows-gnu.

@dtolnay dtolnay closed this as completed Dec 11, 2022
@dtolnay dtolnay changed the title Wrong default toolchain Choice of ABI for host code on Windows Dec 11, 2022
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

2 participants