koutheir/lm-sensors

Improve New User Experience and On Ramp

Closed this issue ยท 3 comments

Hey attempted using this crate today in a fairly bare bones docker image (based off Ubuntu), as my intended use case was to deploy the resulting application on some servers via docker. Ran into a few speed bumps that I think could be improved.

  1. The base lm-sensors crate itself doesn't indicate that it depends on any system library being installed. Only after I tried using the crate did I get errors for

sensors-sys: Failed to find 'sensors/sensors.h': Kind(NotFound)',

The suggested improvement here, would be to indicate that this crate depends on sensors-sys, which in turn depends on libsensorsdev being installed on the host, and provide at least some basic installation instructions. The sensors-sys crate is clear about this dependency, but casually googling brings me to lm-sensors first (sensors-sys also doesn't provide obvious instructions for getting its needed dependencies).

  1. After installing some googling for what was the right package I apt installed libsensors4-dev. Then attempted to compile again. Which failed with:
/usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found
  thread 'main' panicked at 'sensors-sys: Failed to generate Rust bindings for 'sensors/sensors.h' and other headers: ClangDiagnostic("/usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found\n")',

Doing my best googling on this brought me to here: georust/proj-sys#7
The solution in there of apt install clang did resolve, with the negative consquence of having to add ~450MB to my docker image to get it to build.

I understand that I'm personally not super familiar with Linux package dependencies in Rust and what is considered "normal" for documenting, but do think both of these hurdles could be improved by adding some documentation to the crate(s), and potentially adding specific error messages out of the build.rs execution with recommended steps for resolution.

I'd be happy to attempt some PRs to this affect, but not super confident I would get the information correct.

I'm grateful for your efforts and sharing of your issues and solutions, making life easier for other people.

The suggested improvement here, would be to indicate that this crate depends on sensors-sys, which in turn depends on libsensorsdev being installed on the host, and provide at least some basic installation instructions.

The sensors-sys crate documentation now has a section that provides installation instructions.

and potentially adding specific error messages out of the build.rs execution with recommended steps for resolution.

The commit ca6e170 adds a hint that would be hopefully useful.

These fixes are published in sensors-sys version 0.2.8 and lm-sensors version 0.1.7.

Please let me know if these changes fix the issues you encountered, and feel free to suggest anything that makes this crate more accessible.

Fantastic response! Thank you! Those documentation updates are perfect!

Also FYI, I'm having a great experience using the crate after those initial hurdles. Thank you for building and maintaining this!