-
Notifications
You must be signed in to change notification settings - Fork 94
Windows Installation
Tad Hardesty edited this page Apr 25, 2016
·
2 revisions
Following is a comprehensive guide to compiling discord-rs on Windows using MSYS2. If you find any errors or need help, please visit the Discord channel linked in the README.
- Visit https://msys2.github.io and download the appropriate binary based on your host system.
-
i686
for 32-bit Windows. -
x86_64
for 64-bit Windows, even if you intend to compile 32-bit software.
-
- Run the installer, following the instructions on that page for installing updates.
- Choose a relatively short path with no spaces (say,
C:\msys64
orD:\tools\msys2
) - If asked to restart MSYS, close the shell window and re-open it from the start menu. Any of the three choices will work for now.
- Choose a relatively short path with no spaces (say,
- Here's a brief explanation of the three different shortcuts in the start menu:
- MSYS2 Shell is used for developing software that will always run inside MSYS2.
- MinGW-w64 Win32 Shell is used for developing 32-bit Windows software.
- MinGW-w64 Win64 Shell is used for developing 64-bit Windows software. This will be your usual choice.
- It's time to install Rust. To allow for greatest flexibility, rustup.rs will be used. This is the latest iteration on the previous multirust.rs and multirust.sh tools. 2. Navigate to https://win.rustup.rs/ to download the rustup installer. 3. Run the installer. After reading the information, press Enter to accept the default options and begin installation. 4. The installer will advise you to restart your current shell - close it now, but do not reopen it yet.
- Create a shortcut to start MSYS2 with an important setting.
- Navigate to your MSYS2 installation and find mingw64_shell.bat.
- Right-click it and select "Create shortcut".
- Open the shortcut's properties and add the argument
-use-full-path
to the end of the Target. - If desired, change the shortcut's icon to one of the icons available in the MSYS2 installation.
- Move the shortcut to your Desktop and/or Start Menu.
- Run the shortcut you just created to open the MINGW64 shell.
- Configure Rust to compile 64-bit by default.
- Run
rustup default stable-x86_64-pc-windows-gnu
(or replacestable
withbeta
ornightly
if desired) - Running
rustc -Vv
should list your chosen Rust version, as well ashost: x86_64-pc-windows-gnu
- If
host: i686-pc-windows-gnu
is displayed instead, you have done something wrong.
- Run
- Install all of discord-rs's required system packages:
pacman -S mingw-w64-x86_64-pkg-config mingw-w64-x86_64-libsodium mingw-w64-x86_64-gcc mingw-w64-x86_64-openssl mingw-w64-x86_64-opus
- Use
cd
to navigate to a directory of your choosing to keep Rust projects in.- The root directory,
/
, maps to the root of your MSYS2 install. - The default working directory is
/home/Username
, displayed as~
. - To get to a directory on drive C, write
cd /c/path/to/directory
.
- The root directory,
- Compile a discord-rs examples to make sure everything is working.
- Install git by running
pacman -S git
. - Clone discord-rs by running
git clone https://github.com/SpaceManiac/discord-rs
. - Move into the directory:
cd discord-rs
. - Use Cargo to build an example:
cargo build --example dj
. Be patient while it compiles. - If it compiled successfully, you are good to go.
- Install git by running
- You can now create a project that depends on discord-rs with ease.
- To use the latest git version (which is often newer than the latest crates.io release), write in Cargo.toml:
discord = { git = "https://github.com/SpaceManiac/discord-rs" }
- To use the latest git version (which is often newer than the latest crates.io release), write in Cargo.toml: