Gcc build with Address Sanitizer

I have a binary that is leaking memory, so want to build it with Address Sanitizer to see if it helps track down the source.

I can see an option to build the ASAN library if I build for GCC libc rather than MUSL, so I'm currently doing a distclean up build with GCC selected.

Do I then just build the one package with ASAN in its own compile and link options? Or is something else needed?

I also thought abut building a statically linked binary with GCC to then run on the otherwise MUSL OS. That seemed to fail due to lack of static libraries to link against. Did I miss somehting and might it be a better approach?

Have any or many people built for GCC, or am I entering into unknown territory which will become a battle of its own rather than letting me focus on the original problem?

Couldn't you simply install the Standard C++ library on the device too?

https://openwrt.org/packages/pkgdata/libstdcpp6

That's a good idea. Unfortunatley I'm having trouble on the build side with dynamic linking anyway, where the lasan and lisan libraries don't seem to get built when added to Base System. So I can't link the binary to then deploy.