delete all libreadline from your system, /usr/lib, /usr/local/lib etc
download sources for readline from someplace
configure with (my version for readline.8.2 Dec. 2024):
./configure --with-shared-termcap-library --enable-static -q --prefix=/usr
--enable-static not necessary. --prefix - your choice. --with-shared-termcap-library - imperative, the undefined symbols are in libtermcap and NOT in libncurses.