Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Resolving VNDK ABI Extending Changes Error in Android 9 P

Tech 1

Problem Description

When attempting to add new interfaces to files within the system/core/liblog directory of Android source code, compatibility issues arise during compilation. The build process fails with the following error:

QSSI: not enabled for msm8953_64 target as vendor/qcom/proprietary/release/QSSI/QSSI_enforced_targets_list.txt was not found.
ninja: no work to do.
ninja: no work to do.
No need to regenerate ninja file
No need to regenerate ninja file
[ 50% 1/2] glob .
[ 16% 1/6] //system/core/liblog:liblog header-abi-diff liblog.so.abidiff
FAILED: out/soong/.intermediates/system/core/liblog/liblog/android_arm64_armv8-a_core_shared/liblog.so.abidiff 
(prebuilts/clang-tools/linux-x86/bin/header-abi-diff -allow-unreferenced-changes -allow-unreferenced-elf-symbol-changes -lib liblog -arch arm64 -o out/soong/.intermediates/system/core/liblog/liblog/android_arm64_armv8-a_core_shared/liblog.so.abidiff -new out/soong/.intermediates/system/core/liblog/liblog/android_arm64_armv8-a_core_shared/liblog.so.lsdump -old out/soong/.intermediates/system/core/liblog/liblog/android_arm64_armv8-a_core_shared/liblog.so_ref.lsdump)|| (echo ' ---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog ----' && exit 1)
******************************************************
error: VNDK library: liblog's ABI has EXTENDING CHANGES Please check compatiblity report at : out/soong/.intermediates/system/core/liblog/liblog/android_arm64_armv8-a_core_shared/liblog.so.abidiff
******************************************************
 ---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l liblog ----
ninja: build stopped: subcommand failed.

This issue occurs due to VNDK restrictions introduced in Android P, not an issue with your source code modifications.

Understanding VNDK

VNDK (Vendor Native Development Kit) consists of libraries specifically designed for vendor implementations of their HALs. Since Android 8.0, Google introduced the Treble architecture to decouple vendor and system partitions. The goal is to achieve:

  • Framework processes do not load vendor shared libraries
  • Vendor processes only load vendor shared libraries (and some framework shared libraries)
  • Communication between framework and vendor processes through HIDL and hwbinder

Key characteristics:

  • Platform and vendor builds are isolated from each other
  • Platform libraries correspond to system.img
  • Vendor libraries correspond to vendor.img
  • In most cases, vendor libraries cannot use system core components
  • Vendor libraries cannot dlopen private system libraries
  • Partners cannot add new libraries to VNDK for their products; they can only contribute to AOSP

Solution Approach

The error originates from header_abi_diff.cpp located in development/vndk/tools/header-checker/header-abi-diff/src. The problematic code section shows:

184   if (should_emit_warning_message) {
185     llvm::errs() << "******************************************************\n"
186                  << error_or_warning_str
187                  << "VNDK library: "
188                  << lib_name
189                  << "'s ABI has "
190                  << status_str
191                  << unreferenced_change_str
192                  << " Please check compatiblity report at : "
193                  << compatibility_report << "\n"
194                  << "******************************************************\n";
195   } 

The solution involevs modifying this code to bypass the ABI checking mechanism.

Step-by-step Implementation

  1. Modify the header-abi-diff source code in development/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp:
--- a/development/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp
+++ b/development/vndk/tools/header-checker/header-abi-diff/src/header_abi_diff.cpp
@@ -182,21 +182,21 @@ int main(int argc, const char **argv) {
  bool should_emit_warning_message = ShouldEmitWarningMessage(status);

  if (should_emit_warning_message) {
-    llvm::errs() << "******************************************************\n"
-                 << error_or_warning_str
-                 << "VNDK library: "
-                 << lib_name
-                 << "'s ABI has "
-                 << status_str
-                 << unreferenced_change_str
-                 << " Please check compatiblity report at : "
-                 << compatibility_report << "\n"
-                 << "******************************************************\n";
+//    llvm::errs() << "******************************************************\n"
+//                 << error_or_warning_str
+//                 << "VNDK library: "
+//                 << lib_name
+//                 << "'s ABI has "
+//                 << status_str
+//                 << unreferenced_change_str
+//                 << " Please check compatiblity report at : "
+//                 << compatibility_report << "\n"
+//                 << "******************************************************\n";
  }

-  if (!advice_only && should_emit_warning_message) {
-    return status;
-  }
  1. Rebuild the header-checker tool using the following command:
mmm development/vndk/tools/header-checker/ -j32
616+0 records in
616+0 records out
630784 bytes (631 kB, 616 KiB) copied, 0.0032836 s, 192 MB/s
[ 66% 2/3] glob .
[100% 5/5] Install: out/host/linux-x86/bin/header-abi-diff
  1. Replace the compiled binary in the prebuilt tools directory:
cp out/host/linux-x86/bin/header-abi-diff prebuilts/clang-tools/linux-x86/bin/header-abi-diff
  1. Rebuild the target library after sourcing the environment again. For example, if working with liblog:
make -j32 liblog

// Build result
vendor/qcom/build/tasks/generate_extra_images.mk:558: warning: overriding commands for target `kernelclean'
device/qcom/common/generate_extra_images.mk:558: warning: ignoring old commands for target `kernelclean'
[100% 76/76] build out/host/linux-x86/obj32/SHARED_LIBRARIES/liblog_intermediates/liblog.so.toc

After completing these steps, you can proceed with modifications to VNDK-related components without encountering the ABI extending changes error.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.