How do I use MSYS2?


#1

The (archived) crate https://github.com/lgvz/rust-opus says:

On Windows, msys2 is required for building

But what does it mean to use msys2 with Rust?


#2

I was using msys2 on Windows for C/c++. But there exist a Package Manager to install rust too.

  1. Install Msys2 https://www.msys2.org/ and follow instructions on this site
  2. Search for Rust “pacman -Ss rust” => possible search result: mingw64/mingw-w64-x86_64-rust 1.15.1-1
  3. Install Rust with: pacman -S mingw-w64-x86_64-rust
  4. run cargo

But i saw the lib, i think regarding using makefiles you need msys2 Gnu tool infrastructure.

Edit: I recommend to install rust not from inside Msys2 but on the normal Rust windows way. The open Msys2 got to lib folders an run “make”.

If there are not dev-tools you can install it with:

pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
git subversion mercurial
mingw-w64-i686-cmake mingw-w64-x86_64-cmake

Detailed description: https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2

Inside the Opus build.rs you can see that this want to call buildchain

./configure && make && make install


#3

As an aside, opus (and the underlying opus-sys bindings crate) seems to be the most widely used Opus crate. Whether they share the same MSYS2 requirement, I’m not sure.


#4

rust-belt, a Piston arcade game shows how you can use MSYS2 on Windows with the SDL2 library. Might be useful to look at.


#5

That’s the crate I’m using, but they both use the same underlying -sys crate, which is (not) maintained in the archived repository that I linked to.


#6

Aah, I didn’t realize they were one and the same, my bad!


#7

Currently i tried to build it by myself as only write some blind tutorial :smiley:


#8

Yes, as i explain in my first post this toolchain works, i had successfully build this crate as rlib.
Thanks for me as rust newbie it was a great journey how i could realize a rust => c => python toolchain i can link inside python :).

EDIT: opusfile-sys panics in build.rs during the build of ogg-sys. Maybe you like to fix this.

Seems to be an not implemented “feature” ^^

#[cfg(windows)]
fn build(out_dir: &Path, dep_opus: &Path) {
panic!(“Heyyy, you have access to windows machine! Fix this and request a pull!”)
}

#[cfg(windows)]
fn inform_cargo(_out_dir: &Path, _dep_opus: &Path) {
panic!(“Heyyy, you have access to windows machine! Fix this and request a pull!”)
}

Good Luck :slight_smile: