Re: [PATCH v3 01/11] rust: bindings: Support some inline static functions
From: Andreas Hindborg
Date: Tue Nov 12 2024 - 04:59:14 EST
"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. │
I am doing out of tree build - maybe that is the culprit?
Best regards,
Andreas Hindborg