Rust Bindings help

Hi, I recently found the rust bindings github page and was interested in using the bindings. However I’ve encountered some errors and after searching the internet I have not been able to find any resources on how to get started. I get the following error, it is caused when I try to run one of the examples

error: linking with link.exe failed: exit code: 1181

and

= note: LINK : fatal error LNK1181: cannot open input file ‘rgbmatrix.lib’

Installing VSC Build tools has not seemed to fix the error, any help would be greatly appreciated, thanks.

Mmmh, I know nothing about building on windows, but on unix that would be the -L flag to gcc, telling it where to find libraries, .a or .so files to link against.

1 Like

Thanks! I decided to run it from the PI, things were running a lot smoother. Unfortunately, I ran into another error

/home/pi/.cargo/registry/src/github.com/rpi-led-matrix-0.2.2/src/matrix.rs:34: undefined reference to `led_matrix_create_from_options_and_rt_options’
collect2: error: ld returned 1 exit status

Doesn’t seem to be binding?

The build.rs/gcc points to the directory in which the libraries are contained.

Fixed the problem! Was incorrectly linking to the library. Thanks again.

1 Like

Hey there!
I am having the same Problem compiling in Rust as you, @drd.
Could you maybe elaborate what you did to make it work?

Thank you very much!

Alright, I solved the Problem.
What I did was copy the contents from the lib folder in the rpi-rgb-led-matrix to the target/debug/deps folder of my Rust project!

1 Like

Nice, you can also point to the folder from the rust build.rs file using “cargo:rustc-link-search”

So the build.rs file would look like this for example.

extern crate gcc;
fn main () {
println!(r"cargo:rustc-link-search=/PATH/TO/RGBMATRIXLIB/);
println!(“cargo:rustc-flags=-l dylib=stdc++”);
}

I found this useful for doing multiple rust projects.

1 Like

Is there a emulator for Hub75 using Rust?