What is the correct way to fix an assertion in loadlocale.c?
I have recently updated Ubuntu to 18.04. After this, issuing the command ld constantly failed with the following assertion:
loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.I have googled this problem and it looks like this is a well known issue. All of the solutions that I have read suggested fixing this using the following command:
export LC_ALL=CSee, for example, this one. However, doing so breaks fonts of the commentaries on my native language in VIM for example.
So, this solution is not suitable for me-. Are there any other ways to fix this issue?
3 Answers
As easy as:
export LC_ALL=Cand then run your command. LC_ALL works as a fallback if something is not set (like LC_TIME in your case)
1I had this problem on Ubuntu 14 trusty, I solved it as follows.
First, edit /etc/locale.gen and add the locales you want.
Make sure the utf8 in the locale name is lowercase, not e.g. UTF-8.
So mine are:
en_US.utf8
ru_RU.utf8Now run, as root:
rm -f /usr/lib/locale/locale-archive
locale-gen --no-archive
locale-gen --no-archive en_US.utf8
locale-gen --no-archive ru_RU.utf8the --no-archive flag is important.
Now make sure in your startup files like ~/.bash_profile and ~/.bashrc etc. you set LANG and related variables to the lowercase utf8 form, see the directories in /usr/lib/locale for the correct form.
I added this to my .bashrc and it fixed the issue for both Ubuntu 18 and 20 when I was having that same message with an old 32 bit gdb for an Arm cross compiler
export LANG=C
1