On Mon, Jun 12, 2023 at 07:26:35AM +0200, Erik Schilling wrote: > > On a relate note, how do you run clippy now? > > > > When I tried `cargo clippy` I got an error about pkg-config not finding > > libgpiod. Fixed that by pointing PKG_CONFIG_PATH at my local libgpiod > > build. > > > > But now I get: > > > > --- stderr > > wrapper.h:1:10: fatal error: 'gpiod.h' file not found > > thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("wrapper.h:1:10: fatal error: 'gpiod.h' file not found\n")', libgpiod-sys/build.rs:44:10 > > > > > > so I guess bindgen/clang needs to be pointed at the include directory, > > but not sure how to do that without emulating whatever `make` is doing. > > > > Same goes for `cargo build`, come think of it - now you have to build > > using `make`. > > > > How are you supposed to tell if your code is sub-par without clippy to > > tell you? Or, more generally, how does the development process for the > > rust bindings work now? > > Setting PKG_CONFIG_PATH will only work if you point it at the install > folder of libgpiod. Correct - that is exactly what I did. > If you do not want to install, you will need to set Yeah, I don't install on my dev machine - I deploy to separate machines for testing. For dev I just want to be able to use the same workflow I would use for a general rust project, so cargo XXX, and purely in the code tree. At least that is what I was doing previously. > something like this (taken from the Makefile): > > SYSTEM_DEPS_LIBGPIOD_NO_PKG_CONFIG=1 \ > SYSTEM_DEPS_LIBGPIOD_SEARCH_NATIVE="${PWD}/../../../lib/.libs/" \ > SYSTEM_DEPS_LIBGPIOD_LIB=gpiod \ > SYSTEM_DEPS_LIBGPIOD_INCLUDE="${PWD}/../../../include/" \ > cargo clippy > Something like that? That works for me when called from the rust/xxx sub-directories - I assume that is the correct level for the relative paths to work. > See https://lore.kernel.org/r/20230522-crates-io-v2-2-d8de75e7f584@xxxxxxxxxx/ > on why it had to become a little bit ugly for rust bindings hackers. > I understand why you might be changing things to be able to package the crates, but in an ideal world that wouldn't impact normal workflow. Or it would be simple to switch. > Maybe we should put that example back to the README.md (or into the top- > level README?) > Sounds like a plan to me. I would go with the rust specific README. Or add a file that can be sourced to setup the build environment to get cargo working from the command line. Cheers, Kent.