deltaphc / raylib-rs

Rust bindings for raylib
Other
775 stars 136 forks source link

cargo build fails with 'rustc --explain E0554' #51

Closed zertyz closed 4 years ago

zertyz commented 4 years ago

Thanks for sharing your work. I'm new to rust, so maybe I'm doing something wrong... I just cloned this repo and executed cargo build and it fails as in the title... What am I doing wrong? I would like to run the examples to test it both in my linux pc and on raspberry pi...

crazyStewie commented 4 years ago

To run the examples, you can go to the samples folder with cd samples, and execute the example you want using cargo run --bin EXAMPLE. For example, if you want to execute the raymarch example, run cargo run --bin raymarch

zertyz commented 4 years ago

Great. Now I could compile. Maybe that should be on the README?

On raspberry pi, raylib can also run using the Broadcom Drivers. How to make the binaries not depend on X?

INFO: Initializing raylib 2.5 WARNING: [GLFW3 Error] Code: 65544 Decription: X11: The DISPLAY environment variable is missing WARNING: Failed to initialize GLFW INFO: [static/logo.png] Image loaded successfully (16x16) WARNING: [GLFW3 Error] Code: 65537 Decription: The GLFW library is not initialized INFO: Target time per frame: 16.667 milliseconds Segmentation fault (core dumped)

zertyz commented 4 years ago

I guess I figured it out?

There were these lines missing on raylib-sys/build.rs:252: } else if target.contains("armv6l-unknown-linux") { Platform::RPI

... also there should be one for armv8... rPi3

Now I'm rebuilding everything to test.

I didn't figured it out yet how override the default build options... for instance, even o rPi 1, 2 & 3 one might want to use raylib inside X. Is this done via some sort of build flag?

Thanks for your attention.

Dacode45 commented 4 years ago

Hey, haven't tested the library with rpi yet. I would try to follow the official raylib wiki to see how it's done.

zertyz commented 4 years ago

Yes. I have successfully built & run the C/C++ version in standalone mode before for rPis 1, 2 & 3. Its a meter of passing the define flag PLATFORM=RPI at build time. I don't known rust enough yet to see where this should be done.

BTW my mentioned attempt on the messages above didn't work.

Dacode45 commented 4 years ago

It's probably this line in raylib-sys/build.rs

https://github.com/deltaphc/raylib-rs/blob/731b0c4700bdce7b2552a70a9abdcdef4de35aa8/raylib-sys/build.rs#L59

zertyz commented 4 years ago

It ended up not working. The samples must also be compiled with this flag. I'll learn rust a little more so I can eventually contribute with a P.R. Thanks for you attention.