-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Isolate llvm's C++ symbols in distibution binaries? #63920
Comments
To reproduce this, just clone https://github.com/facebookexperimental/MIRAI and try to cargo build on a Linux system (after installing Z3, which you can do using "brew install z3"). If it builds (which it did not, last time I checked), try to run it with cargo test. |
We currently ship a compiler with two dynamic libraries that contain C++ code in them. One is LLVM itself, built by LLVM's own build system. I believe the C++ standard library is linked statically into this LLVM dynamic library. The other is I unfortunately do not know how to instruct LLVM's build system to hide symbols and only expose the ones we want in rustc. I'm not sure it's easily possible either since the C++ APIs that we're using in our shims are probably not super well defined. |
Removing the symbols from rustc_driver will help; then we only need to solve llvm. I wonder if using
I don't know how this applies to transitive dependencies. Maybe statically linking a PIC version libLLVM.a into librustc_codegen_llvm would help in that case? (Or is that already true?) |
@hermanventer BTW, I did a checkout and compile on a current Fedora system using the distro-packaged version of Z3, and it build and ran cleanly without problems. |
Oh right! AFAIK we should now be able to use |
I'll take a look. |
The LLVM backend is now linked into librustc_driver.so, so there is nowhere to pass |
MIRAI is an abstract interpreter for MIR. It uses the Z3 theorem prover as part of its implementation. Z3 uses C++, and is often used precompiled.
MIRAI also links against rustc. This means that Z3's C++ library conflicts with the libstdc++ linked into rustc (well, libLLVM I think). At best this generates GB of linker errors, at worst something that seems to build but behaves erratically at runtime.
Is there some way to hide all llvm's C++ symbols so that it just becomes an internal implementation details, and a second libstdc++ can coexist in the same address space? Alternatively could it be distributed with a shared libstdc++ so that llvm and Z3 are using a common library?
I can solve this by building everything from source against the same libstdc++, but its a large burden to build rustc from source just to use MIRAI.
cc @hermanventer @alexcrichton
The text was updated successfully, but these errors were encountered: