Android9.0在libEGL中添加接口

Android9.0 增加了好些安全机制,因为公司的一些需求,需要在 libEGL中添加接口。添加完成后,全编,报错。报错信息如下:

[  0% 12/14531] //frameworks/native/opengl/libs:libEGL header-abi-diff libEGL.so.abidiff

FAILED: out/soong/.intermediates/frameworks/native/opengl/libs/libEGL/android_arm64_armv8-a_cortex-a53_core_shared/libEGL.so.abidiff 

(prebuilts/clang-tools/linux-x86/bin/header-abi-diff -allow-unreferenced-changes -allow-unreferenced-elf-symbol-changes -lib libEGL -arch arm64 -o out/soong/.intermediates/frameworks/native/opengl/libs/libEGL/android_arm64_armv8-a_cortex-a53_core_shared/libEGL.so.abidiff -new out/soong/.intermediates/frameworks/native/opengl/libs/libEGL/android_arm64_armv8-a_cortex-a53_core_shared/libEGL.so.lsdump -old out/soong/.intermediates/frameworks/native/opengl/libs/libEGL/android_arm64_armv8-a_cortex-a53_core_shared/libEGL.so_ref.lsdump)|| (echo ‘ —- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l libEGL —-‘ && exit 1)

******************************************************

error: VNDK library: libEGL’s ABI has EXTENDING CHANGES Please check compatiblity report at : out/soong/.intermediates/frameworks/native/opengl/libs/libEGL/android_arm64_armv8-a_cortex-a53_core_shared/libEGL.so.abidiff

执行 development/vndk/tools/header-checker/utils/create_reference_dumps.py -l libEGL

一直报如下错误:

File “development/vndk/tools/header-checker/utils/create_reference_dumps.py”, line 225, in <module>

    main()

  File “development/vndk/tools/header-checker/utils/create_reference_dumps.py”, line 211, in main

    targets = [Target(True, product), Target(False, product)]

  File “development/vndk/tools/header-checker/utils/create_reference_dumps.py”, line 30, in __init__

    self.arch = build_vars[1]

IndexError: list index out of range

对 python 不熟悉,一直找不到解决方法。

在代码中搜索,发现 development/vndk/tools/header-checker/header-abi-diff/src 中的 header_abi_diff.cpp 报出的错误。

于是,直接修改代码,让里面的 main 直接返回 abi_util::CompatibilityStatusIR::Compatible;  然后重新编译这个文件,覆盖到代码中的检查库。全编译。通过!!!

现在将具体的步骤发出来:

1. source build/envsetup.sh 执行编译环境

2. lunch 选择版本

3. 进入 development/vndk/tools/header-checker/header-abi-diff/src 修改 header_abi_diff.cpp 

4. 返回到 development/vndk/tools/header-checker 执行 mm 编译

5. 编译完成信息:

[ 98% 1257/1275] host Prebuilt: header-abi-diff (out/host/linux-x86/obj/EXECUTABLES/header-abi-diff_intermediates/header-abi-diff)

[ 98% 1259/1275] Install: out/host/linux-x86/bin/header-abi-diff

6. 复制 out/host/linux-x86/bin/header-abi-diff 到 prebuilts/clang-tools/linux-x86/bin 中覆盖

7. 在 prebuilts/clang-tools/linux-x86/bin  中执行 sudo chmod 777 header-abi-diff 。我第一次没执行 这个命令,导致无法生效。

好了。可以快乐的修改 libEGL 了。

「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!