KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator
Crash on startup: CommandLine Error: Option 'spirv-ext' registered more than once!
- Dominant language
- LLVM
- Stars
- 625
- Forks
- 279
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
Building spirv-llvm-translator 20.1.3 inside the LLVM 20.1.6 tree results in a `llvm-spirv` binary that crashes on startup:
```
$ ./build/bin/llvm-spirv --help
: CommandLine Error: Option 'spirv-ext' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./build/bin/llvm-spirv --help
#0 0x00007f388932f906 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/llvm/lib/Support/Unix/Signals.inc:799:13
#1 0x00007f388932e5da llvm::sys::RunSignalHandlers() /home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/llvm/lib/Support/Signals.cpp:106:18
#2 0x00007f388932f1f4 SignalHandler(int) /home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/llvm/lib/Support/Unix/Signals.inc:415:1
#3 0x00007f3884a480b0 (/lib64/libc.so.6+0x400b0)
#4 0x00007f3884a9d49c (/lib64/libc.so.6+0x9549c)
#5 0x00007f3884a47f82 raise (/lib64/libc.so.6+0x3ff82)
#6 0x00007f3884a30ef5 abort (/lib64/libc.so.6+0x28ef5)
#7 0x00007f3889253bfd llvm::report_fatal_error(llvm::Twine const&, bool) /home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/llvm/lib/Support/ErrorHandling.cpp:0:5
#8 0x00007f3889253a36 (/home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/build/lib64/libLLVM.so.20.1+0x4253a36)
#9 0x00007f388921d95b (/home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/build/lib64/libLLVM.so.20.1+0x421d95b)
#10 0x00007f388921f6ce llvm::cl::Option::addArgument() /home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/llvm/lib/Support/CommandLine.cpp:433:20
#11 0x000055695f18f7cc main /home/bero/abf/llvm/BUILD/llvm-20.1.6-build/llvm-project-llvmorg-20.1.6/llvm/projects/SPIRV-LLVM-Translator/tools/llvm-spirv/llvm-spirv.cpp:734:3
#12 0x00007f3884a32ae8 (/lib64/libc.so.6+0x2aae8)
#13 0x00007f3884a32ba5 __libc_start_main (/lib64/libc.so.6+0x2aba5)
#14 0x000055695f184331 _start (./build/bin/llvm-spirv+0x120331)
```
This probably depends on specific LLVM build options - I've seen a similar crash before, that turned out to be caused by CommandLine options being processed in the binary once and in a linked library another time.
Possibly relevant build options:
```
-DBUILD_SHARED_LIBS:BOOL=OFF
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON
-DCLANG_LINK_CLANG_DYLIB:BOOL=ON
-DSPIRV_TOOLS_BUILD_STATIC:BOOL=OFF
```
Contributor guide
Research direction
Reproduce the crash while building spirv-llvm-translator 20.1.3 in the LLVM 20.1.6 tree with the listed CMake options. Start at llvm-spirv.cpp:734 and LLVM's CommandLine.cpp:433, then determine why `spirv-ext` is registered twice. Done means `llvm-spirv --help` starts without the duplicate-option error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100