I meet this problem when I compile the Android 7.1.2 source code after I updated my debian. I do not know that is the real problem .
It seems problem from the flex. However, how can i solve it?
FAILED: /bin/bash -c “prebuilts/misc/linux-x86/flex/flex-2.5.39
system/tools/aidl/aidl_language_l.ll” flex-2.5.39: loadlocale.c:130:
_nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME))’ failed
Same issue for me on Ubuntu 18.04. LC_TIME was set to en_GB.UTF-8.
Fixed it for me
I built AOSP (Android O/P) downloaded from Google on a newly setup 18.04 and it built fine. Did not have to change the locale.
Locale was set to en_GB.UTF-8.
Then I had to build Android N, an IMX distro, on the same machine and the build failed with the above error. After changing the locale variable the build worked fine.