git: symbol lookup error: git: undefined symbol: pcre2_maketables_free_8

Git is not working for me after updating to Kubuntu 21.10. When I try to execute any git commands I get the following error: git: symbol lookup error: git: undefined symbol: pcre2_maketables_free_8.

I've tried reinstalling git and all libraries related to PCRE2.

My current git version: git/impish,now 1:2.32.0-1ubuntu1 amd64 [installed]

Any idea what could cause this and how to fix it?

Edit: Running ldd $(which git) yields the following:

linux-vdso.so.1 (0x00007fff21f00000)
libpcre2-8.so.0 => /usr/local/lib/libpcre2-8.so.0 (0x00007f27ccb5b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f27ccb3f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f27cc917000)
/lib64/ld-linux-x86-64.so.2 (0x00007f27ccf62000)

Also, running nm -Dg /usr/local/lib/libpcre2-8.so.0 | grep "pcre2_maketables_free_8" does not return anything


You have to remove local library and local Git, then reinstall Git with dependencies by

sudo rm -v $(which git)
sudo rm -v /usr/local/lib/libpcre2-8.so.0*

sudo apt-get install --reinstall git libc6 libpcre2-8-0 zlib1g

and then retry.