On Manjaro as of Nov 2025, the default gcc version is 15.2.1 and it does not work well with old ruby versions. To install ruby 2.1.9, I needed to do two things:
Install gcc-5 with yay -S gcc5
Run install command with setting environment variable CC=/usr/bin/gcc-5 rbenv install 2.1.9