Re: [libgpiod][bug] building rust bindings requires clang headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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. If you do not want to install, you will need to set
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

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.

Maybe we should put that example back to the README.md (or into the top-
level README?)

- Erik




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux