24

I met this problem when I was compiling the Android 7.1.2 source code after I updated my debian. I do not know what 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 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp 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[0]))' failed . Aborted

linjiejun
  • 1,468
  • 15
  • 22
Peng
  • 241
  • 1
  • 2
  • 6
  • 1
    What is the value of `LC_TIME` in your shell? (`locale | grep TIME` will show you.) Will it work if you `export LC_ALL=C` first? – rici Mar 15 '18 at 17:39
  • By the way, this is not a flex issue as such. It's a problem encountered by glibc when `setlocale` is called (probably). – rici Mar 15 '18 at 17:40
  • 1
    @penf: great that you got it to work but the locale problem is a distro bug, assuming the locale is part of your distro, and should probably be reported (unless it already has been, of course). – rici Mar 16 '18 at 14:25
  • same in my ubuntu 22 – linjiejun May 27 '22 at 23:41

4 Answers4

53

Same issue for me on Ubuntu 18.04. LC_TIME was set to en_GB.UTF-8.

export LC_ALL=C

Fixed it for me

rosterloh
  • 800
  • 5
  • 5
  • 1
    i was also facing the same error and before make i run "export LC_ALL=C" in terminal and Issue is fixed. How to integrate this variable in android source code so that i can avoid to run before compilation . – vijay panwar Aug 01 '21 at 20:45
4

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.

droidian
  • 79
  • 10
2

I had this again recently building AOSP with Ubuntu 22.04. Setting the locale didn't work at all.

However i found this github thread which suggested to rebuild flex with

cd prebuilts/misc/linux-x86/flex
rm flex-2.5.39
tar zxf flex-2.5.39.tar.gz
cd flex-2.5.39
./configure
make
mv flex ../
cd ../
rm -rf flex-2.5.39
mv flex flex-2.5.39

which solved the error for me.

Flo
  • 448
  • 2
  • 6
  • Thank you so much @Flo . This fixed my issue as well on ubuntu22.04 host, ubuntu22.04 docker container to build AOSP. I just can't understand why bundled flex in prebuilts/misc/linux-x86/flex is causing this problem ... – Sertac TULLUK Jan 12 '23 at 07:26
1

i was also facing the same error and before make i run "export LC_ALL=C" in terminal and Issue is fixed. How to integrate this variable in android source code so that i can avoid to run before compilation .

vijay panwar
  • 59
  • 1
  • 6