C++ application aborts when exception is thrown when linked to libnvcuvid or libnvidia-encode

The simple program below terminates with SIGABRT as soon as an exception is thrown if it is linked with the default NVIDIA drivers from /usr/lib/wsl/lib in WSL (Ubuntu 20.04). The source was compiled with g++ 9.4.0.

Exception are enabled as I am not compiling with -fno-exceptions flag. Has anyone else encountered this? If I install nvidia-driver package and set my LD_LIBRARY_PATH to load the non-WSL drivers everything works perfectly - the exception is thrown and handled. However, Nvidia’s recommends against installing drivers in WSL and we should be using the ones injected from the Windows host.

#include <exception>
#include <iostream>

int main() {

    try {
        if (1) {
            throw std::runtime_error("I just threw an exception");
    catch (const std::exception& e) {
        std::cerr << e.what() << std::endl;
        return 1;
    return 0;

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7372859 in __GI_abort () at abort.c:79
#2  0x00007ffff7e7a5cb in ?? () from /usr/lib/wsl/lib/libnvcuvid.so.1
#3  0x00007ffff7e7a82e in ?? () from /usr/lib/wsl/lib/libnvcuvid.so.1
#4  0x00007ffff7e76d03 in ?? () from /usr/lib/wsl/lib/libnvcuvid.so.1
#5  0x00007ffff7e76f36 in ?? () from /usr/lib/wsl/lib/libnvcuvid.so.1
#6  0x00007ffff7e76ecf in __cxa_throw () from /usr/lib/wsl/lib/libnvcuvid.so.1
#7  0x00005555555552cf in main () at /workdir/test.cpp:8

linux-vdso.so.1 (0x00007ffd08b35000)
libnvcuvid.so.1 => /usr/lib/wsl/lib/libnvcuvid.so.1 (0x00007f2a559e1000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2a557ff000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2a5560d000)
libdxcore.so => /usr/lib/wsl/lib/libdxcore.so (0x00007f2a55532000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2a5550f000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2a553c0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2a553b8000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2a553ae000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2a5628c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2a55393000)