Skip to content

Using Rust on windows install guide will lead you to a bad bad place. #18617

Closed
@blairn

Description

@blairn

https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows is very incomplete... or rather, it will direct people into a minefield (eventually).

The problem is, you don't have all the libraries that would normally come with a mingw install. So the moment you want to link into... say... gdi32 then unless you are a c++ programmer, and know what is about to happen, things will go badly for you.

This is because you will need a copy of libgdi32.a, and there is MANY wrong ways of getting this file.

You COULD install mingw to get it... in which case, if you pick the wrong version (which - there are many to choose from) you will stop being able to compile anything, as it will use the new mingw install over the one inside the Rust installed directory.

Even then, say you realize what has gone wrong.. which is not easy given errors like...
C:\projects\myproj\target\myproj.o: file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status

and remove the install of mingw (or at least move it). You still need to grab the libgdi32.a file from it and put it into the \users%user%.rust directory so rust will find it. I'm not sure that is documented anywhere.

even then, chances are... you will get a
ld: skipping incompatible C:\Users\myuser.rust\libgdi32.a when searching for -lgdi32

and still fail to build.

My guess is you need an exact version match of mingw to get the normally used windows libraries to link to.

Can we either

  1. put them in our install?
  2. put in an installer so we can grab them
  3. Put in the documentation how to grab the mingw libraries you will be linking to if you are building on windows because you are needing to build an app there.
    or 4) find a way to remove ourselves from having to use mingw for everything on windows.

All of the document you can find around these problems on the net are all c++ things, and given we have a built in mingw, they are all wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions