Solution
This error happens because
newlocale() is throwing the error "
_locale_ is not a string pointer referring to a valid locale". In other word,
locale() is not installed in the system. The
newlocale() function creates a new locale object, or modifies an existing object, returning a reference to the new or modified object as the function result. If
newlocale() is not installed, your program might throw this error.
In Ubuntu, run the following command as root to reinstall
locale(), this should resolve the Segfault error:
sudo apt install glibc-langpack-en
In Fedora, run the following command as root to reinstall
locale(), this should resolve the Segfault error:
dnf install glibc-langpack-en