In tree-sitter, grammars are compiled from C and C++ to shared libraries. These libraries are then dynamically loaded by the tree-sitter CLI, which is a rust program. The tree-sitter CLI is usually responsible for compiling the grammar, although it does so without -fsanitize
flags. I manually compiled my grammar with -fsanitize=address
(eventually want to add undefined
) to help with debugging some C++ code I wrote as part of the external scanner. However, when I try to load it with the tree-sitter CLI rust program I get:
Error opening dynamic library "~/.cache/tree-sitter/lib/tlaplus.so"
Caused by: ~/.cache/tree-sitter/lib/tlaplus.so: undefined symbol: __asan_report_store4
So rust isn't loading ASAN. I tred rebuilding the tree-sitter CLI with the nightly rust toolchain and:
RUSTFLAGS="-Z sanitizer=address" cargo build --target x86_64-unknown-linux-gnu --release
But this still gives the same undefined symbol error. Is there any way to load a C++ library compiled with ASAN from rust, or should I just write my own C++ front end to the grammar?