Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main branch does not compile for some versions of locally-installed flatc #197

Open
stephanemagnenat opened this issue Sep 14, 2023 · 3 comments

Comments

@stephanemagnenat
Copy link
Contributor

stephanemagnenat commented Sep 14, 2023

Fetching a fresh main branch:
git clone git@github.com:planus-org/planus.git

And compiling it:
cd planus && cargo build

Leads to the following errors:

   Compiling rust-test v0.4.0 (/home/steph/test/planus/test/rust)
error[E0405]: cannot find trait `SafeSliceAccess` in crate `flatbuffers`
  --> /home/steph/test/planus/target/debug/build/rust-test-c32ec9e90a91632a/out/planus_test/alignment_generated.rs:29:19
   |
29 | impl flatbuffers::SafeSliceAccess for NoAlign {}
   |                   ^^^^^^^^^^^^^^^ not found in `flatbuffers`

error[E0405]: cannot find trait `SafeSliceAccess` in crate `flatbuffers`
   --> /home/steph/test/planus/target/debug/build/rust-test-c32ec9e90a91632a/out/planus_test/alignment_generated.rs:129:19
    |
129 | impl flatbuffers::SafeSliceAccess for Align4 {}
    |                   ^^^^^^^^^^^^^^^ not found in `flatbuffers`

error[E0405]: cannot find trait `SafeSliceAccess` in crate `flatbuffers`
   --> /home/steph/test/planus/target/debug/build/rust-test-c32ec9e90a91632a/out/planus_test/alignment_generated.rs:229:19
    |
229 | impl flatbuffers::SafeSliceAccess for Align16 {}
    |                   ^^^^^^^^^^^^^^^ not found in `flatbuffers`

error[E0405]: cannot find trait `SafeSliceAccess` in crate `flatbuffers`
   --> /home/steph/test/planus/target/debug/build/rust-test-c32ec9e90a91632a/out/planus_test/alignment_generated.rs:332:19
    |
332 | impl flatbuffers::SafeSliceAccess for AlignmentStruct {}
    |                   ^^^^^^^^^^^^^^^ not found in `flatbuffers`

For more information about this error, try `rustc --explain E0405`.
error: could not compile `rust-test` (lib) due to 4 previous errors

I assume that this is due to some changes on the google flatbuffers library side.

@stephanemagnenat stephanemagnenat changed the title Master branch does not compile Main branch does not compile Sep 14, 2023
@TethysSvensson
Copy link
Collaborator

This happens because we use flatbuffers in our testing, to make sure that we are compatible. We will use the locally installed flatc, which might or might not be compatible with the flatbuffers crate we depend on.

Perhaps we should add some debugging to our test to make it more clear when this happens?

Can you tell me the output of flatc --version? On my machine this says flatc version 22.11.23, and cargo build does work as expected.

@stephanemagnenat
Copy link
Contributor Author

stephanemagnenat commented Sep 15, 2023

Thanks for the answer! I am indeed using an old version of flatc (2.0.6) for legacy reasons on our side. I'm happy to close the issue then.

Yet, maybe it would be helpful to add a check of flatc for compatibility? As far as I know, it is uncommon in the Rust world that successfully building a project depends on the version of a locally-installed third-party tool.

@stephanemagnenat stephanemagnenat changed the title Main branch does not compile Main branch does not compile for some version of locally-installed flatc Sep 15, 2023
@stephanemagnenat stephanemagnenat changed the title Main branch does not compile for some version of locally-installed flatc Main branch does not compile for some versions of locally-installed flatc Sep 15, 2023
@TethysSvensson
Copy link
Collaborator

I think you have a point, and perhaps we should fix that as well.

The reason why we haven't currently done it like that, is that we only use the third-party tool for testing, and writing the code to get it installed through build.rs is surprisingly difficult. We would at least require a locally installed cmake, and I am not sure I see the benefit to doing that.

For now what you can do is run cargo build -p planus-cli to avoid compiling the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants