何当共剪西窗烛
唯有踏浪执子归 人不怜我我自怜

OmniROM:“Flex checkpolicy”出错

编译OmniROM 8.1时,在这个地方出错:

[ 21% 2441/11398] //external/selinux/checkpolicy:checkpolicy lex policy_scan.l [linux]
FAILED: /home/anclark/Wonderland/aosp3/omni8/out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/linux_x86_64/gen/lex/external/selinux/checkpolicy/policy_scan.c 
prebuilts/misc/linux-x86/flex/flex-2.5.39 -o/home/anclark/Wonderland/aosp3/omni8/out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/linux_x86_64/gen/lex/external/selinux/checkpolicy/policy_scan.c external/selinux/checkpolicy/policy_scan.l
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)

其中涉及到了Flex这款语法解释器生成器(lexical analyser generator),它的作用是将以*.l为扩展名的源文件编译成解释器的C语言代码。checkpolicy这个用于检测SELinux策略(SELinux policy)的工具,正是使用flex来解析策略文件的语法的。

Android Ninja编译系统的好处是,会将出错的命令记录在屏幕上。拷贝上述出错的命令,重新执行:

prebuilts/misc/linux-x86/flex/flex-2.5.39 -o/home/anclark/Wonderland/aosp3/omni8/out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/linux_x86_64/gen/lex/external/selinux/checkpolicy/policy_scan.c external/selinux/checkpolicy/policy_scan.l

发现问题依旧。

于是,笔者试着更换一个Flex版本,以apt安装的版本2.6.4sudo apt install flex)尝试编译:

flex -o/home/anclark/Wonderland/aosp3/omni8/out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/linux_x86_64/gen/lex/external/selinux/checkpolicy/policy_scan.c external/selinux/checkpolicy/policy_scan.l

结果成功!

看来,问题就出在OmniROM源码附带的Flex2.5.39版本里。

暂时使用符号链接,将OmniROM自带的Flex更换为apt的最新版:

ln -s /usr/bin/flex prebuilts/misc/linux-x86/flex/flex-2.5.39
赞(0) 打赏
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《OmniROM:“Flex checkpolicy”出错》
文章链接:https://www.bigxd.com/2018/10/426.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

微信扫一扫打赏