-
Notifications
You must be signed in to change notification settings - Fork 352
Namespace Abseil to prevent symbol collisions across dependencies #1844
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
base: main
Are you sure you want to change the base?
Conversation
IIRC crates.io will not accept publishing this due to it modifying its own source. Can you double check with |
Yes, that's right - it complains about uncommitted changes:
and as it says, with
The failed CI step is not during publishing though, but at the
Was this just a transient network glitch? |
looks like a transient network issue yes. wrt publishing, I don't think we can accept using --allow-dirty, just to ensure the integrity of what we are publishing. |
What would be a viable strategy then? Forking Abseil and pointing the submodule to a commit with that change? |
can you update the other things you use that rely on abseil? |
That's much harder as there are multiple and deeper down the dependency graph. Also the crashes that got us investigating happened during Deno initialization. I believe using that inline namespace option is definitely a benefit for rusty_v8 since others will likely bump into the same issue at some point too. And being explicitly a Rust wrapper for v8, I'd say it makes more sense to have that wrapping being done well in here. |
Just committed another suggestion to avoid either breaking |
That file needs to be present for building from source right? |
Yes, and it's coming in through the abseil submodule so it's there when building from source. Just won't be included in the crates.io publish. |
Yes I'm saying, building the crates.io release from source is currently a supported feature. |
Ah right, building crates.io package from source. Sorry, didn't think about that. Well there is another option: having the build script, or maybe rather the CI script, commit the changed file just before running Would that be a viable option for you folks? Happy to look into committing the needed change here. Would that be the ci/publish workflow? |
So it looks like you are currently running it with --allow-dirty: rusty_v8/.github/workflows/ci.yml Line 323 in 1bc1660
|
Ok, after format and clippy fixes CI tests pass except for debug x86_64 darwin which looks like it was cancelled after 180 minutes while still running. Are you fine with my added task in the publish workflow which should make the cargo publish work even when you take out the --allow-dirty in the future? |
@devsnek, I believe my last changes address your concern. Is there anything more I can do to help get this merged? |
Problem
In projects that integrate
rusty_v8
(as we do through Deno) with other Rust crates that have C/C++ dependencies, conflicts can arise when multiple dependencies use Abseil but at different versions. Since Cargo doesn't track or version C/C++ dependencies, this leads to symbol collisions during linking, or worse: dependencies being linked to the one selected version of Abseil, which is wrong and not ABI compatible for at least one of call-sites, resulting in runtime crashes. These issues are inconsistent and depend on factors like the OS and linker behavior. This is a broader challenge in the Rust ecosystem when mixing Rust and C/C++ libs, but it's particularly acute for large projects pulling in diverse dependencies (e.g., AI inference libraries that also rely on Abseil as in our case).Solution
This PR activates Abseil's inline namespace option, wrapping it in a custom namespace within
rusty_v8
. This changes the symbol names, effectively isolatingrusty_v8
's Abseil usage and preventing collisions with other versions of Abseil from external dependencies.Testing and Validation
We've implemented this change in our fork of
rusty_v8
(see the comparison here: main...coasys:rusty_v8:v0.137.1-abseil-namespaced) and confirmed it resolves the crashes in our production builds on macOS and Linux. Our fork includes additional modifications to support our custom build systems, but this PR isolates only the namespacing change for cleaner upstream integration.Why Upstream?
rusty_v8
provides prebuilt binaries, which we'd prefer to use directly from crates.io instead of maintaining a fork. Buildingrusty_v8
from source is challenging, especially on Windows where we've struggled to get consistent results. Merging this would allow us (and potentially others facing similar issues) to drop our fork and rely on official releases.If there are any concerns or suggestions for improvements, happy to iterate!