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
cl::opt + LLVM_BUILD_LLVM_DYLIB is completely broken #23326
Comments
Yep. |
This breaks the use case of LLVM_BUILD_LLVM_DYLIB=ON for lld/lldb-server at least, both fails to start with an assert due to duplicate options. |
Yep... The underlying problem here is that command line options use global initializers to register themselves in the system. If you link all the LLVM libraries together you get every option. The long-term fix for this is actually something I was working on a year ago. We need to stop using static initializers to register options, and instead we need to have explicit initialization. In the short-term there are two options. (1) Rename options so that there are no conflicts, (2) Exclude libraries with option conflicts from the LLVM combined library. Option 2 would mean statically linking some LLVM content where it is needed, but should work today by using the LLVM_DYLIB_COMPONENTS CMake option. |
Going to call this resolved as it deals with configure and Justin says that cmake doesn't have this problem :) |
Well, cmake with BUILD_SHARED_LIBS doesn't have the problem, but you really shouldn't use that option - it has its own problems. The cmake feature that actually does something like --enable-shared did, LLVM_BUILD_LLVM_DYLIB, does exhibit this problem. |
Aha. Cool. |
We encountered this bug on macOS (I haven't been able to reproduce on One option I'm looking at is hacking our clang and lldb builds LLVM_DYLIB_COMPONENTS seems to be the official way but this seems I wonder if there are other options available; as I'm also not too |
This turned out to be somewhat self-induced: the installer was not |
mentioned in issue llvm/llvm-bugzilla-archive#30587 |
1 similar comment
mentioned in issue llvm/llvm-bugzilla-archive#30587 |
Extended Description
Today I fought with a buildbot all evening, because adding a -color
option to llvm-cov caused it to emit the following error, only on that
bot:
Eventually I figured out that the bot used configure and
--enable-shared, for some reason, and reproduced the failure locally. It
turns out the configure build with shared creates a monolithic llvm lib
and links all the tools to that, and this causes every tool to have
every cl::opt option from every library in LLVM. This is pretty
broken.
The cmake build with BUILD_SHARED_LIBS doesn't have this problem, since
it builds multiple library and only links the ones the tool asks for.
I've worked around this by renaming my option for now, but that's really
terrible and it makes me sad.
The text was updated successfully, but these errors were encountered: