hhvm
hhvm copied to clipboard
Use single Rust staticlib for FFI
Currently, each Rust FFI library is built and linked into the HHVM binaries as separate static libraries. This is explicitly unsupported by the cxx crate, which recommends either using rustc as the final linker or using a single Rust staticlib for the Rust components, and has been the cause of linking errors for the last couple of years (see T146965521).
The former does not seem to be feasible for HHVM OSS, so go with the latter approach and combine Rust FFI libraries into a single staticlib, then link that into HHVM. This will likely need corresponding changes in the internal buck2 build.
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. (Because this pull request was imported automatically, there will not be any future comments.)
Gentle ping for @dtolnay—I'm curious whether you think this approach might be feasible. I find it a bit curious that the present arrangement worked for as long as it did (until 4b12ed4cbd26cf5a0835c4fdb454bf41aac1dbf8 / 90d3e33675e6a22c9898ca0437a7d26ea415c653) despite multiple staticlibs being linked even before that. Although in fairness the docs do say that "[multiple staticlibs] are likely to conflict" rather than "will conflict", so perhaps it was just the straw that broke the camel's back.
Thanks for your quick response! This is exactly the kind of valuable context I was looking for.
I'm fine with either a continuation of the preexisting CMake-based approach (#9564 takes care of most build issues) or a community-driven Buck2 build.