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

Sanity-check that the C header version and rerun_c library version is the same #3868

Closed
Tracked by #2919
emilk opened this issue Oct 16, 2023 · 1 comment · Fixed by #4330
Closed
Tracked by #2919

Sanity-check that the C header version and rerun_c library version is the same #3868

emilk opened this issue Oct 16, 2023 · 1 comment · Fixed by #4330
Assignees
Labels
🌊 C++ API C/C++ API specific
Milestone

Comments

@emilk
Copy link
Member

emilk commented Oct 16, 2023

It is very annoying for users if they get mismatched headers and library files. It can lead to very hard-to-debug problems.

To protect against that we can hard-code the version into both rerun.h (#define RERUN_VERSION …) and into a library-defined function (rr_version()). The C++ library can then check that RERUN_VERSION == rr_version before it does anything else.

@emilk emilk mentioned this issue Oct 16, 2023
33 tasks
@emilk emilk changed the title Sanity-check that the header version and library version is the same Sanity-check that the C++ header version and library version is the same Oct 16, 2023
@emilk emilk added the 🌊 C++ API C/C++ API specific label Oct 16, 2023
@emilk emilk added this to the 0.11 C++ polish milestone Oct 16, 2023
@emilk emilk changed the title Sanity-check that the C++ header version and library version is the same Sanity-check that the C header version and rerun_c library version is the same Oct 24, 2023
@Wumpf Wumpf assigned Wumpf and unassigned Wumpf Nov 2, 2023
@Wumpf
Copy link
Member

Wumpf commented Nov 24, 2023

CMake needs to parse version from this header as well. Search for ticket number in cmake script to find where

@Wumpf Wumpf self-assigned this Nov 24, 2023
Wumpf added a commit that referenced this issue Nov 27, 2023
…y version (#4330)

### What

* Fixes #3868
* Fixes left over to set generic package version from #4326  
* Yes there's two levels of regex'ing existing files now, but I'm happy
with it because it avoids etching the version into more places: The repo
cmake setup first figures out the rerun version by taking a look at
Cargo.toml and puts that into rerun.h which we commit. Then when doing
an install (in repo or outside!) we check rerun.h's version and put that
into the CMake Install shenanigans


Tests erro'red correctly when I still had a longer string, looked like
this:
```
-------------------------------------------------------------------------------
Scenario: RecordingStream can connect
      Given: a new RecordingStream
-------------------------------------------------------------------------------
/Users/andreas/dev/rerun-io/rerun/rerun_cpp/tests/recording_stream.cpp:433
...............................................................................

/Users/andreas/dev/rerun-io/rerun/rerun_cpp/tests/recording_stream.cpp:433: FAILED:
due to unexpected exception with message:
  Rerun_c SDK version and SDK header/source versions don't match match. Make
  sure to link against the correct version of the rerun_c library.
  Rerun_c version:
  re_sdk 0.11.0-alpha.1+dev [rustc 1.72.1 (d5c2e9c34 2023-09-13), LLVM 16.0.5]
  aarch64-apple-darwin
  SDK header/source version:
  0.11.0-alpha.1+dev
```


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4330) (if
applicable)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4330)
- [Docs
preview](https://rerun.io/preview/72b1b7eedaa4934a8a34d1ab498c9b7752dd8125/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/72b1b7eedaa4934a8a34d1ab498c9b7752dd8125/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants