Re: [PATCH v3 01/11] rust: bindings: Support some inline static functions
From: Alistair Francis
Date: Tue Nov 12 2024 - 18:18:58 EST
On Tue, Nov 12, 2024 at 7:58 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
> "Alistair Francis" <alistair23@xxxxxxxxx> writes:
>
> > On Mon, Nov 11, 2024 at 10:07 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
> >>
> >> "Alistair Francis" <alistair@xxxxxxxxxxxxx> writes:
> >>
> >> <cut>
> >>
> >> > diff --git a/rust/exports.c b/rust/exports.c
> >> > index 587f0e776aba..288958d2ebea 100644
> >> > --- a/rust/exports.c
> >> > +++ b/rust/exports.c
> >> > @@ -18,6 +18,7 @@
> >> > #include "exports_core_generated.h"
> >> > #include "exports_helpers_generated.h"
> >> > #include "exports_bindings_generated.h"
> >> > +#include "exports_bindings_static_generated.h"
> >>
> >> Generating `exports_bindings_static_generated.h` depends on `exports.o`,
> >> which depends on `exports.c`. Does this not create chicken-egg kind of
> >> problem?
> >
> > It is a bit confusing as there are a few levels of autogeneration, but
> > Make happily handles it.
> >
> > `exports.c` depends on `exports_bindings_static_generated.h`
> >
> > But `exports_bindings_static_generated.h` depends on `extern.o`
> > (extern not exports).
> >
> > `extern.o` then depends on `extern.c`
> >
> > `extern.c` then depends on `bindings_generated_static.rs`, which is
> > generated by bindgen.
> >
> > So there isn't a chick-egg problem and this happily builds from a clean tree.
>
> Right, I think I mixed up exports/extern.
>
> Anyway, it does not build for me. I applied it on top of `rust-next` and
> I get:
>
> ..
> │ CC rust/extern.o │
> │/home/aeh/src/linux-rust/helpers/rust/extern.c:1:10: fatal error: '/home/aeh/src/linux-rust/helpers/bindings/bindings_helper.h' file not found │
> │ 1 | #include "/home/aeh/src/linux-rust/helpers/bindings/bindings_helper.h" │
> │ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │
> │1 error generated. │
Thanks for testing this
The #include in `extern.c` is auto-generated by bindgen based on your
current directory. So for an out of tree build I guess it's just
wrong. I'll fixup the sed operation to ensure we correct the path to
be a relative path instead.
Alistair
>
>
> I am doing out of tree build - maybe that is the culprit?
>
>
> Best regards,
> Andreas Hindborg
>
>