RK Ubuntu16.04 LC_ALL=C 、Python ascii 编码

 

一.LC_ALL=C

1.1.编译报的日志  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.

[  2% 56/2683] target Java: ext (out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[  2% 59/2683] Lex: aidl <= system/tools/aidl/aidl_language_l.ll
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 (core dumped)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

1.2.解决方法 build\envsetup.sh

添加  

export LC_ALL=C

LC_ALL=C 是为了去除所有本地化的设置,让命令能正确执行  

二.UnicodeEncodeError: 'ascii'

2.1.Python编译  默认的编码是ascii  将python的默认编码置为utf8的编码格式

FAILED: /bin/bash -c "(rm -f out/target/product/rk3288/installed-files.txt ) && (build/tools/fileslist.py out/target/product/rk3288/system > out/target/product/rk3288/installed-files.json ) && (build/tools/fileslist_util.py -c out/target/product/rk3288/installed-files.json > out/target/product/rk3288/installed-files.txt )"
Traceback (most recent call last):
  File "build/tools/fileslist_util.py", line 68, in <module>
    main(sys.argv)
  File "build/tools/fileslist_util.py", line 62, in main
    PrintCanonicalList(args[0])
  File "build/tools/fileslist_util.py", line 30, in PrintCanonicalList
    print "{0:12d}  {1}".format(line["Size"], line["Name"])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 26-31: ordinal not in range(128)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

2.2.解决方法

      build/tools/fileslist_util.py  开头加上

 # limitations under the License.
 #
 
+import sys  
+reload(sys)  
+sys.setdefaultencoding('utf8')   
+       
 import getopt, json, sys

  

  

 

    

  

posted @ 2021-10-08 17:06  CrushGirl  阅读(427)  评论(0编辑  收藏  举报