Open zestysoft opened 3 weeks ago
Could you try to replace the Gauge<f64, AtomicU64>>
to Gauge<f32, AtomicU32>>
prometheus-client
0.22.2 added support for that, maybe than the u64 are not compiled?
Otherwise I guess you would need to also patch that out of prometheus-client
or make it feature enabled.
Even after replacing 64 with 32 everywhere in the main.rs file, the same problem persists compiling the prometheus-client. This however looks hopeful! https://github.com/prometheus/client_rust/pull/206
yes this sounds promising
Hi ! I’m writing this PR and have more coming for a more complete 32 bits support as I’m in the same embedded situation. Just prometheus/client_rust#206 by itself will not help you, you’ll also need at least prometheus/client_rust#203.
I’m maintaining my master branch with a merged version that includes all my in-flight PRs, hopefully it should give you what you need. In particular, it contains some commits for things not currently present in any PRs, like f32
support.
You can try temporarily adding this to your Cargo.toml:
[patch.crates-io]
prometheus-client = { git = "https://github.com/navaati/prometheus_client_rust.git", branch = "master" }
Then cargo update to pin the git hash in your lock file and go on github and check the exact diff between that git hash and upstream master, that way you don’t have to trust me. I’ll make sure to leave that commit available in the repo until everything is upstream.
You can track the current status of things in https://github.com/prometheus/client_rust/issues/207 to know what works or not in upstream master.
Test feedbacks are welcome :).
That helped resolve a number of issues, however, I'm still not able to create that rust binary:
cross build --target=armv5te-unknown-linux-gnueabi --release
Compiling proc-macro2 v1.0.86
Compiling libc v0.2.155
Compiling autocfg v1.3.0
Compiling parking_lot_core v0.9.10
Compiling serde v1.0.204
Compiling smallvec v1.13.2
Compiling memchr v2.7.4
Compiling itoa v1.0.11
Compiling prometheus-client v0.22.2 (https://github.com/navaati/prometheus_client_rust.git?branch=master#c74c2c3c)
Compiling log v0.4.22
Compiling ryu v1.0.18
Compiling csv-core v0.1.11
Compiling lock_api v0.4.12
Compiling chunked_transfer v1.5.0
Compiling tiny_http v0.12.0
Compiling quote v1.0.36
Compiling syn v2.0.71
Compiling syn v1.0.109
Compiling parking_lot v0.12.3
Compiling csv v1.3.0
Compiling gumdrop_derive v0.8.1
Compiling prometheus-client-derive-encode v0.4.2 (https://github.com/navaati/prometheus_client_rust.git?branch=master#c74c2c3c)
Compiling gumdrop v0.8.1
Compiling tigo-exporter v0.3.0 (/project)
error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
--> src/main.rs:5:5
|
5 | use std::sync::atomic::AtomicU64;
| ^^^^^^^^^^^^^^^^^^^---------
| | |
| | help: a similar name exists in the module: `AtomicU32`
| no `AtomicU64` in `sync::atomic`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `tigo-exporter` (bin "tigo-exporter") due to 1 previous error
Just for fun, I gave this rust source file to ChatGPT and asked it to convert it to Go. With one additional follow up question, it was able to produce the code in .go and gave instructions to successfully create a working binary: https://github.com/zestysoft/tigo-exporter
Heya, trying to cross compile this to work with my 32-bit (armv5) Tigo CCS running v2.8.5 of the firmware, but it looks like the prometheus-client might be 64-bit only. Just wondering if there is any workaround for this?