[Solved] Trouble building sprocketnes


#1

Hi
To start with I’m absolute beginer.
I was trying to build a nintendo emulator from github and I got following error:

src/gfx.rs:7:12: 7:23 error: unresolved import `sdl2::InitBuilder`. There is no `InitBuilder` in `sdl2`
src/gfx.rs:7 use sdl2::{InitBuilder, Sdl};
                        ^~~~~~~~~~~
error: aborting due to previous error
Could not compile `sprocketnes`.

My setup is

dk@linux:~$ uname -a
Linux linux 3.2.0-89-generic-pae #127-Ubuntu SMP Tue Jul 28 09:52:21 UTC 2015 i686 i686 i386 GNU/Linux

dk@linux:~$ rustc -V
rustc 1.2.0 (082e47636 2015-08-03)

dk@linux:~$ ldconfig -vp |grep SDL
libSDL2-2.0.so.0 (libc6) => /usr/lib/i386-linux-gnu/libSDL2-2.0.so.0
libSDL_image-1.2.so.0 (libc6) => /usr/lib/i386-linux-gnu/libSDL_image-1.2.so.0
libSDL-1.2.so.0 (libc6) => /usr/lib/i386-linux-gnu/libSDL-1.2.so.0

Any help appreciated.


#2

Apparently, the SDL2 crate has released a breaking change, and since sprocketnes’ Cargo.toml says * for the version, it’s picking up the breaking change and, well, breaking.

I’ve sent a PR that fixes this:

You can apply the same small patch locally and it should build.


#3

@steveklabnik Thank you very much. It solved the problem.


#4

Well…compilation problem was solved but when I run it, it asks to pass an option

darek@linux:~/cwicz/RustDir/sprocketnes$ cargo run --release
 Running `target/release/nes`
usage: sprocketnes [options] <path-to-rom>

options:
-1 scale by 1x (default)
-2 scale by 2x
-3 scale by 3x

so now the question is how I pass the option. Tried few different ways but always got an error. The closest I could get was after

dk@linux:~/RustDir/sprocketnes/target/release$ ./nes 2

I got this

thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', ../src/libcore/result.rs:731

Am I’m doing something wrong (as I’m nearly sure I’m) or is this because another breaking change somewhere ?


#5

The argument is the ROM you want to play, IIRC. You have to get one of those first!


#6

Got it. Thanks again @steveklabnik.