Coder Social home page Coder Social logo

msvc-wine-rust's Introduction

Download MSVC build tools and the Windows SDK for Rust development on GNU/Linux

This script downloads and extracts the needed components of the Visual Studio 2017 build tools and the Windows SDK, so that Rust toolchains can target the platform.

Note that these are the very latest build tools and the latest SDK. If you are okay with the older 2015 build tools, you should download the enterprise WDK instead, it contains all the needed files.

Requirements:

  • 7z executable
  • GNU/Linux with GNU Bash installed. May also work on Mac or other BSD's, but I haven't tried.
  • Wine 2.21 or later. You really need 2.21: Wine 2.20 or older won't work. Compilation is explained below.
  • msitools

The bleeding edge Wine is required to run the linker. Msitools is required to extract the SDK MSIs.

Compilation of any C/C++ dependencies is not supported.

Compiling Wine 2.21

If your distribution has already Wine 2.21 or any later version, you can skip this step and install Wine 2.21 via your distribution instead. However, if you are on no rolling-release distribution, Wine 2.21 may not have reached you yet. I'm explaining below how to compile it, so that you don't have to figure it out yourself.

First, obtain the dev-dependencies of wine (assuming Ubuntu here, but other Debian like distros may work as well).

sudo apt build-dep wine64-development

Then, obtain the wine source code:

git clone git://source.winehq.org/git/wine.git
cd wine
git checkout wine-2.21

Now create a build directory, and execute the build:

mkdir /path/to/wine-2.21-build
cd /path/to/wine-2.21-build
/path/to/wine/source/configure --prefix=/path/to/wine-2.21-build --enable-win64
make -j 8

Now, if things went well, you should have a binary wine inside that build directory. That's the executable you need to point the WINE_EXEC environment variable at when running the linker.

Setup

First, execute get.sh, and accept the licensing terms. If you have accepted, get.sh will download files to the dl/ folder and extract them into the extracted/ folder.

Then put the following into your ~/.cargo/config:

[target.x86_64-pc-windows-msvc]
linker = "/path/to/msvc-wine-rust/linker-scripts/linkx64.sh"

[target.i686-pc-windows-msvc]
linker = "/path/to/msvc-wine-rust/linker-scripts/linkx32.sh"

Then go to your favourite Rust project and compile it e.g. with:

cargo build --release --target x86_64-pc-windows-msvc

As the wine executable might not be in your $PATH, you can also override it manually:

WINE_EXEC=/path/to/wine cargo build --release --target x86_64-pc-windows-msvc

Same applies for get.sh as well -- if the Wine installation with 32 bit and .Net support is not in your $PATH, you can invoke WINE_EXEC=/path/to/wine/with/dotnet ./get.sh.

License

Licensed under Apache 2 or MIT (at your option). For details, see the LICENSE file.

License of your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

msvc-wine-rust's People

Contributors

est31 avatar roblabla avatar

Forkers

a8e4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.