llvm-project
llvm-project copied to clipboard
"CommandLine Error: Option 'filter' registered more than once!" crash on startup in applications using libclang
Bugzilla Link | 47117 |
Version | 11.0 |
OS | Linux |
CC | @zmodem,@zygoloid,@sylvestre |
Extended Description
Several applications that use (dynamically linked) libclang crash on startup with libclang 11-rc1, including doxygen and the Qt6 version of lupdate.
$ ./bin/doxygen : CommandLine Error: Option 'filter' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options Aborted (core dumped)
Doxygen isn't doing anything funny like mixing shared and static libraries. The crash seems to happen in a global constructor in libclang, before even doxygen's main() is called.
#0 0x00007ffff3dd386f in raise () from /lib64/libc.so.6 #1 0x00007ffff3db9538 in abort () from /lib64/libc.so.6 #2 0x00007fffedc4cb39 in llvm::report_fatal_error(llvm::Twine const&, bool) () from /usr/lib64/libLLVMSupport.so.11.0 #3 0x00007fffedc4c978 in llvm::report_fatal_error(char const*, bool) () from /usr/lib64/libLLVMSupport.so.11.0 #4 0x00007fffedc32904 in ?? () from /usr/lib64/libLLVMSupport.so.11.0 #5 0x00007fffedc24044 in ?? () from /usr/lib64/libLLVMSupport.so.11.0 #6 0x00007fffedc2207d in llvm::cl::Option::addArgument() () from /usr/lib64/libLLVMSupport.so.11.0 #7 0x00007ffff76ff910 in ?? () from /usr/lib64/libclang-cpp.so.11.0 #8 0x00007ffff7702da6 in ?? () from /usr/lib64/libclang-cpp.so.11.0 #9 0x00007ffff7fe1f0e in call_init () from /lib64/ld-linux-x86-64.so.2 #10 0x00007ffff7fe1fec in _dl_init () from /lib64/ld-linux-x86-64.so.2 #11 0x00007ffff7fd20ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2 #12 0x0000000000000001 in ?? () #13 0x00007fffffffd8db in ?? () #14 0x0000000000000000 in ?? ()
Sorry, didn't have a lot of time to look into this lately (the usual joys of starting in a new job).
The problem still happens with 11.0.1-rc1 with doxygen 1.8.19, but the problem is fixed with 11.0.1-rc1 and lupdate from qt6-6.0.0-rc2 (so the qt guys must have changed something that fixes or works around it).
llvm cmake build options:
-DLLVM_ENABLE_PROJECTS="llvm;clang;clang-tools-extra;polly;compiler-rt;mlir;flang;libunwind;lldb;lld;openmp;libcxx;libcxxabi;pstl;parallel-libs;libclc" -DBUILD_SHARED_LIBS:BOOL=ON -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER:BOOL=ON -DENABLE_X86_RELAX_RELOCATIONS:BOOL=ON -DCLANG_DEFAULT_RTLIB=libgcc -DLLVM_ENABLE_FFI:BOOL=ON -DLLVM_ENABLE_SPHINX:BOOL=ON -DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF -DLLVM_TARGETS_TO_BUILD=all -DLLVM_ENABLE_CXX1Y:BOOL=ON -DLLVM_ENABLE_RTTI:BOOL=ON -DLLVM_ENABLE_PIC:BOOL=ON -DLLVM_INCLUDE_DOCS:BOOL=ON -DLLVM_ENABLE_EH:BOOL=ON -DLLVM_INSTALL_UTILS:BOOL=ON -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_BUILD_DOCS:BOOL=ON -DLLVM_BUILD_EXAMPLES:BOOL=OFF -DLLVM_BUILD_RUNTIME:BOOL=ON -DLLVM_TOOL_COMPILER_RT_BUILD:BOOL=ON -DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON -DCOMPILER_RT_BUILD_CRT:BOOL=ON -DENABLE_LINKER_BUILD_ID:BOOL=ON -DOCAMLFIND=NOTFOUND -DLLVM_LIBDIR_SUFFIX=64 -DCLANG_LIBDIR_SUFFIX=64 -DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON -DPOLLY_ENABLE_GPGPU_CODEGEN:BOOL=ON -DWITH_POLLY:BOOL=ON -DLINK_POLLY_INTO_TOOLS:BOOL=ON -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_CXX1Y:BOOL=ON -DLIBCXXABI_ENABLE_SHARED:BOOL=ON -DLIBCXXABI_ENABLE_STATIC:BOOL=ON -DLIBCXX_ENABLE_SHARED:BOOL=ON -DLIBCXX_ENABLE_STATIC:BOOL=ON -DLIBCXXABI_LIBCXX_INCLUDES=$(pwd)/../libcxx/include -DLIBCXX_CXX_ABI_INCLUDE_PATHS=$(pwd)/../libcxxabi/include -DLIBCXXABI_LIBDIR_SUFFIX=64 -DLIBCXX_LIBDIR_SUFFIX=64 -DCLANG_DEFAULT_UNWINDLIB=libgcc
Will try to identify what changed in lupdate to unbreak this, that should give a hint...
Unblocking since there seems to be no progress here.
Bernhard: can you provide stand-alone repro instructions, i.e. how exactly libclang and doxygen were built, so we can bisect this?
Bernhard, ping?
I didn't try recently.
Last time I saw "CommandLine Error: Option 'filter' registered more than once!", i think it was because some libs were linked twice. (but it was a few years ago)
sylvestre, you saw something similar in Bug 45453. Was that fixed?
Are you also seeing problems similar to Bernhard?
Searching the mailing lists for "registered more than once" yields a number of hits sadly :-(
Bernhard: can you provide stand-alone repro instructions, i.e. how exactly libclang and doxygen were built, so we can bisect this?
I encountered consent issues using llvm12 with bpftrace 0.12.1, Have you solved this problem?
@haomi123: 11 and 12 are too old. Could you please try 15 or main
branch?
I'm experimenting with qdoc from qttools
(6.3.1), which is linked against libclang 15:
$ qdoc --help
: CommandLine Error: Option 'filter' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted
I don't know what to try to solve it.
In my case the issue was that the clang runtime had been built with the value of BUILD_SHARED_LIBS patched to True in in cmake/modules/AddClang.cmake
... After removing that cruft, it works as intended. Make sure you don't use both BUILD_SHARED_LIBS=ON
and LLVM_BUILD_LLVM_DYLIB=ON
at the same time (the build system will not allow you, but if you have crufty patches applied...)