Closed maxwellherron5 closed 2 years ago
Hey @maxwellherron5 , thanks for filing. In the meantime, I think you should be able to compile if you checkout this older commit of the C++ library (mentioned in the readme): https://github.com/hzeller/rpi-rgb-led-matrix/commit/55fa32fc2e02afb254ac834aea93589d5b891a11. Can you confirm that works for now?
This would be fixed by #1
@TDHolmes I get this same error on that older commit if I build it using the current version of this crate, but it is able to build successfully when I use version 0.1.5
. However, when I run the sample code provided to display some basic colors, the led matrix does not render any color. I also verified that the rpi-rgb-led library is still working on my pi by running their demos, and they worked just fine. The sample code I mentioned was this block -
use rpi_led_matrix::{LedMatrix, LedColor};
let matrix = LedMatrix::new(None, None).unwrap();
let mut canvas = matrix.offscreen_canvas();
for red in 0..255 {
for green in 0..255 {
for blue in 0..255 {
canvas.fill(&LedColor { red, green, blue });
canvas = matrix.swap(canvas);
}
}
}
I recall some older dot releases not working properly.. Could you try the changes in #24 ? I tried some of our examples and they worked as expected for me
I tried building from that branch and I'm unable to build with the following error, which seems like it may be an issue with my pi not having the correct build tools -
error: failed to run custom build command for `rpi-led-matrix-sys v0.1.0 (/home/maxwell/rust-rpi-rgb-led-matrix/rpi-led-matrix-sys)`
Caused by:
process didn't exit successfully: `/home/maxwell/rust-rpi-rgb-led-matrix/target/debug/build/rpi-led-matrix-sys-01bb5a77cd2219a3/build-script-build` (exit status: 101)
--- stdout
building from /home/maxwell/rust-rpi-rgb-led-matrix/target/debug/build/rpi-led-matrix-sys-c0d5b22e403eb960/out/cpp-library
cargo:rerun-if-changed=/home/maxwell/rust-rpi-rgb-led-matrix/rpi-led-matrix-sys/cpp-library
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', rpi-led-matrix-sys/build.rs:39:53
Ah, i need to make this error less opaque. Run ‘git submodule init && git submodule update’. I now have the C++ library as a git submodule in the ‘-sys’ crate
On Mon, Nov 22, 2021 at 3:34 PM maxwellherron5 @.***> wrote:
I tried building from that branch and I'm unable to build with the following error, which seems like it may be an issue with my pi not having the correct build tools -
error: failed to run custom build command for
rpi-led-matrix-sys v0.1.0 (/home/maxwell/rust-rpi-rgb-led-matrix/rpi-led-matrix-sys)
Caused by: process didn't exit successfully:
/home/maxwell/rust-rpi-rgb-led-matrix/target/debug/build/rpi-led-matrix-sys-01bb5a77cd2219a3/build-script-build
(exit status: 101) --- stdout building from /home/maxwell/rust-rpi-rgb-led-matrix/target/debug/build/rpi-led-matrix-sys-c0d5b22e403eb960/out/cpp-library cargo:rerun-if-changed=/home/maxwell/rust-rpi-rgb-led-matrix/rpi-led-matrix-sys/cpp-library--- stderr thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', rpi-led-matrix-sys/build.rs:39:53— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rust-rpi-led-matrix/rust-rpi-rgb-led-matrix/issues/23#issuecomment-976007617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5YNWXYPPDV2UMZ446RCSLUNLHPPANCNFSM5H5ZIXHA .
Gotcha, I was able to build after running that. However, when I try to run any of the examples, I still get the following error -
error: linking with `cc` failed: exit status: 1
Okay now I think the issue is your newer library is taking precedent over the locally compiled one. I'll have to take a look at link order
With my latest commit I rename the .a to a different name, so the locally compiled lib will definitely be used.
@maxwellherron5 let me know if the branch fixes your issue. I'll be merging it soon either way I think. It should fix this though.
Let me know if the latest crates don't fix this @maxwellherron5 . If its still broken we can reopen
Using the newest crate version, along with the rgb-matrix-sys crate, I am getting this error when I try to build -
error: failed to run custom build command for `rpi-led-matrix-sys v0.1.2`
Caused by:
process didn't exit successfully: `/home/maxwell/led-messenger/target/debug/build/rpi-led-matrix-sys-feb2f3bcf4d71b45/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-flags=-l dylib=stdc++
--- stderr
fatal: not a git repository (or any of the parent directories): .git
thread 'main' panicked at 'failed to checkout the C++ library git submodule', /home/maxwell/.cargo/registry/src/github.com-1285ae84e5963aae/rpi-led-matrix-sys-0.1.2/build.rs:39:9
stack backtrace:
0: std::panicking::begin_panic
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:543:12
1: build_script_build::main
at ./build.rs:39:9
2: core::ops::function::FnOnce::call_once
at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
ah, when you build the crate non-locally, the git submodule
stuff is stripped away. My build script didn't account for this. Fixed in 0.1.3
Thanks! I can get it to build now, and it does display, but it does not display as expected. When I run the demo provided, it just flashes two columns of white light, with the warning message -
FYI: not running as root which means we can't properly control timing unless this is a real-time kernel. Expect color degradation. Consider running as root with sudo.
Can't set realtime thread priority=99: Operation not permitted.
You are probably not running as root ?
This will seriously mess with color stability and flicker
of the matrix. Please run as `root` (e.g. by invoking this
program with `sudo`), or setting the capability on this
binary by calling
sudo setcap 'cap_sys_nice=eip' /home/maxwell/led-messenger/target/debug/led-messenger
Does this look familiar, or is this something I need to adjust with the base library?
Awesome! Yes, that is expected. try sudo /home/maxwell/led-messenger/target/debug/led-messenger
.
And then if you still have visual artifacts, try building with --release
I think I may just be cursed haha. After re-building it with --release and running it with sudo, it no longer gets the error message but it still flickers and has the same two white bars as it did before. I tried running some of the tests that you built out, like draw_circle
and draw_line
, and those are somehow still getting the error message I previously had, despite rebuilding with release and running with sudo.
lol, I know the feeling. Have you tried going through the debug steps in the README of the C++ library? https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/README.md#misc-options particularly pwm-lsb-nanoseconds
looks like could be adjusted to eliminate vertical line ghosting.
Using the examples in rpi-led-matrix
you can pass in all of the arguments supported by the C++ library. I think the general pattern is just drop the led-
prefix
Good call, I'll try that out. Do you mind providing an example script call with arguments that you've used?
Also, another potential issue, it looks like I'm unable to use to the args module -
error[E0432]: unresolved import `rpi_led_matrix::args`
--> src/main.rs:14:61
|
14 | use rpi_led_matrix::{LedMatrix, LedMatrixOptions, LedColor, args};
| ^^^^ no `args` in the root
To get the args module you need to enable the args feature. Lemme boot up my pi and grab some of the invocations I was using
After cloning this repo, build:
cd rust-rpi-rgb-led-matrix/rpi-led-matrix
cargo build --example c-api-basic --features="args embeddedgraphics"
run:
sudo ../target/debug/examples/c-api-basic --gpio-mapping adafruit-hat-pwm --rows 16 --slowdown-gpio 3
Incredible, that ran no problem! Naturally, I have one last issue on my end. I've added args to the features section in my Cargo.toml, but it still doesn't recognize it and says it is not in the root. Here is my Cargo.toml file for reference
[package]
name = "led-messenger"
version = "0.1.0"
edition = "2021"
build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
cc = "1.0"
[dependencies]
rpi-led-matrix = "0.3.1"
rpi-led-matrix-sys = "0.1.3"
clap = { version = "2.33", optional = true }
embedded-graphics = { version = "0.6.2", optional = true }
tokio = { version = "0.2", features = ["macros"] }
serenity = { default-features = false, features = ["client", "gateway", "model",
"rustls_backend"], version = "0.9.0-rc.2"}
[features]
args = ["clap"]
embeddedgraphics = ["embedded-graphics"]
default = ["embeddedgraphics"]
args is a feature on rpi-led-matrix so you need to depend on it like this:
rpi-led-matrix = {version = "0.3.1", features = [“args”, “embeddedgraphics”]}
Also don’t depend on rpi-led-matrix-sys, that should only be used by rpi-led-matrix to talk to the C++ library
On Wed, Dec 8, 2021 at 8:10 AM maxwellherron5 @.***> wrote:
Incredible, that ran no problem! Naturally, I have one last issue on my end. I've added args to the features section in my Cargo.toml, but it still doesn't recognize it and says it is not in the root. Here is my Cargo.toml file for reference
[package] name = "led-messenger" version = "0.1.0" edition = "2021" build = "build.rs"
See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies] cc = "1.0"
[dependencies] rpi-led-matrix = "0.3.1" rpi-led-matrix-sys = "0.1.3" clap = { version = "2.33", optional = true } embedded-graphics = { version = "0.6.2", optional = true } tokio = { version = "0.2", features = ["macros"] } serenity = { default-features = false, features = ["client", "gateway", "model", "rustls_backend"], version = "0.9.0-rc.2"}
[features] args = ["clap"] embeddedgraphics = ["embedded-graphics"] default = ["embeddedgraphics"]
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/rust-rpi-led-matrix/rust-rpi-rgb-led-matrix/issues/23#issuecomment-988952932, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5YNWQHPDMJZJ6CC2WY24LUP57N3ANCNFSM5H5ZIXHA .
I have finally got it working! Seriously cannot thank you enough for all the help!
Excellent! Glad to hear it. Happy to help
cargo build
results in the errors below.linking with 'cc' failed: exit status: 1
= note: /usr/bin/ld: /<my-project-path>/target/debug/deps/librpi_led_matrix-af7dfcec87c6fc3a.rlib(rpi_led_matrix-af7dfcec87c6fc3a.rpi_led_matrix.758d7a78-cgu.12.rcgu.o): in function 'rpi_led_matrix::matrix::LedMatrix::new': /<my-user-path>/.cargo/registry/src/github.com-1285ae84e5963aae/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 = help: some 'extern' functions couldn't be found; some native libraries may need to be installed or have their path specified
Interface needs to be updated to handle changes to the c++ lib code.