-
Notifications
You must be signed in to change notification settings - Fork 273
Exposure of Rust API as a crates.io
crate
#7491
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
Comments
Hello, I have been thinking about how best to structure the upcoming crate for the Rust API of CBMC. Some BackgroundThe build process of the Rust API we expose depends on knowing where the libraries it needs to link to (which are the various modules of CBMC in statically linked library format, e.g. Unfortunately, because of the structure of our build system, the names of the static libraries that we produce directly reflect the various modules (subdirectories) of CBMC, so we end up with some that have pretty generic names like Potential SolutionsI am outlining here a number of potential solutions to the issue described above, in the interest of API integrators, like the team working on Kani. First Solution (Default): Rebuild CBMC and link Rust API against lib artefactsThis would be more or less emulating the state of the building of CBMC/Rust API as they are handled upstream (i.e. by us). What this means for usage and integration of the Rust API is that a build of CBMC (without the Rust API on) should be performed before any build of a consumer (say Kani). The consumer's build process will then need to pass in the prerequisite local libraries path (something like This solution would offer the following benefits:
But it would also suffer from the following drawbacks:
Alternative Solution: Bundle CBMC's module in a static library to be passed during linkingA potential alternative might be to bundle all of the static libraries into just one (for example a single artefact called This solution has certain benefits:
But it also affords a certain amount of drawbacks:
Alternative 2: Rename static libraries into prefixed namesThis would simply be a step during the build which would attach a CBMC-specific prefix to all of the static libraries. This would allow us to install them to user's computers without necessarily polluting their local linking paths with libraries that might produce linking errors for their apps. This would mean that instead of This would come with the following benefits:
But it would also have a certain number of defects:
ConclusionI'm presenting the above in hope that these provide some insight to integrators of the API so that the alternatives can be evaluated and ordered from most appealing to least appealing. |
We discussed, and "Alternative Solution: Bundle CBMC's module in a static library to be passed during linking" was the preference of the team. One question: what is the difficulty in versioning this library (e.g. why not just have Few questions:
|
Hi @danielsn, I did some digging into and I can provide answers to at least the first two questions: In my experiments on my local machine (MacOS) it seems that I can get a If we go about this way, the static library is going to be part of the release artefacts and is going to be installed by a package manager before any engagement with the Rust API of CBMC. For question 3 - I don't have easily accessible examples. I will research those a bit more and get back to you. |
@feliperodri This is the issue I was talking about in our meeting. Let me know if there are any questions about the status update so far. |
The crate is now live at https://crates.io/crates/libcprover_rust I did manage to create a new project and download and link from the crate. I would encourage people to start playing with it, and let us know if there are any issues with it or any feature requests pop up. This was marked version Tomorrow we will be releasing CBMC 5.80.0, so the version of the API will be brought in sync with CBMC's version and kept in sync from that point onwards for every release. |
(This item is to track feature development across the new Rust API for CBMC)
The Rust API for CBMC is now at the point where it can be built as part of the CBMC build, and its code has been integrated in the CBMC source tree (#7410 has been the work that covered this).
The next bit is to expose the crate in a way that integrates better with other Rust programs, i.e. exposing it as a crate to
crates.io
.The text was updated successfully, but these errors were encountered: