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

rustup's libgcc_s_dw2-1.dll breaks gcc under i686-pc-windows-gnu #3045

Closed
tspiteri opened this issue Jul 20, 2022 · 7 comments
Closed

rustup's libgcc_s_dw2-1.dll breaks gcc under i686-pc-windows-gnu #3045

tspiteri opened this issue Jul 20, 2022 · 7 comments
Labels

Comments

@tspiteri
Copy link

Problem

When I install the stable-i686-pc-windows-gnu toolchain and try to build a crate which calls gcc in its build.rs, the build breaks. For example when trying to build the gmp-mpfr-sys crate under Msys2 32-bit, the build breaks saying that gcc doesn't work.

I managed to reduce the failure to just calling gcc with .rustup/toolchains/stable-i686-pc-windows-gnu/bin in the PATH.

Steps

  1. Install stable-i686-pc-windows-gnu toolchain in rustup.

  2. Install MSYS2 32-bit gcc. This can be done using:

    • Install MSYS2 using the installer at https://www.msys2.org/

    • Launch the MSYS2 MinGW x86 application which is the 32-bit terminal

    • Install gcc

        pacman -S pacman-mirrors
        pacman -S mingw-w64-x86_64-gcc
      
  3. Launch the MSYS2 MinGW x86 application and prepend the rustup toolchain directory to the PATH, something like

     PATH="/c/Users/User/.rustup/toolchains/stable-i686-pc-windows-gnu/bin:$PATH"
    

    with the correct drive for c and username for User.

  4. Create the file a.c containing one single line

     int main () { return 0; }
    
  5. Try to compile the file using gcc a.c.

Possible Solution(s)

When I rename the file libgcc_s_dw2-1.dll inside .rustup/toolchains/stable-i686-pc-windows-gnu, gcc a.c succeeds.

Notes

No response

Rustup version

rustup 1.25.1 (bb60b1e89 2022-07-12)

Installed toolchains

stable-i686-pc-windows-gnu
@tspiteri tspiteri added the bug label Jul 20, 2022
@tspiteri
Copy link
Author

For what it's worth, the configuration build logs from attempting to build GMP inside gmp-mpfr-sys show the following PATH components:

PATH: /c/Users/User/projects/gmp-mpfr-sys/target/debug/deps
PATH: /c/Users/User/projects/gmp-mpfr-sys/target/debug
PATH: /c/Users/User/.rustup/toolchains/stable-i686-pc-windows-gnu/lib/rustlib/i686-pc-windows-gnu/lib
PATH: /c/Users/User/.rustup/toolchains/stable-i686-pc-windows-gnu/bin
PATH: /mingw32/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /usr/bin
PATH: /c/Windows/System32
PATH: /c/Windows
PATH: /c/Windows/System32/Wbem
PATH: /c/Windows/System32/WindowsPowerShell/v1.0
PATH: /usr/bin/site_perl
PATH: /usr/bin/vendor_perl
PATH: /usr/bin/core_perl
PATH: /c/Users/User/.cargo/bin

The first four PATH components are added by cargo +stable-i686-pc-windows-gnu ... itself.

@tspiteri
Copy link
Author

I also tried older i686-gnu toolchains, for example 1.38.0-i686-pc-windows-gnu, and they also fail, which is why I believe the culprit is rustup, not the toolchains. Maybe the paths were appended in 1.24.3 and are now prepended in 1.25? (I cannot really test, as I do not know a way to downgrade rustup to 1.24.3.)

@ChrisDenton
Copy link
Member

This seems like it may be caused by the same things as #3036?

@tspiteri
Copy link
Author

Ah well, I downgraded to 1.24.3 and I'm getting the same problem.

My suspicion is now that an MSYS2 update has become incompatible with the libgcc_s_dw2-1.dll included with the rust toolchains. And it's failing with old toolchains too, so toolchains that used to work don't work anymore with an up-to-date MSYS2.

@tspiteri
Copy link
Author

I've downgraded mingw-w64-i686-{gcc,gcc-libs,libgccjit} to version 11.2.0 and my problem went away. So it seems that the issue is some incompatibility between MSYS2 mingw-w64-i686-gcc >=11.3 and rustc.

@ChrisDenton
Copy link
Member

Huh, in that case maybe this issue should be moved over to rustc?

@tspiteri
Copy link
Author

I opened an issue in rustc instead; closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants