fans icon indicating copy to clipboard operation
fans copied to clipboard

Android 11 compatibility problems

Open BLuFeNiX opened this issue 3 years ago • 9 comments

Hi,

I am trying to use this tool with a recent AOSP release (android-11.0.0_r37), and I'm having trouble getting the BinderIface plugin to compile. LLVM has changed, so I have made the following adjustments to CMakeLists.txt

--- a/interface-model-extractor/pre-process/BinderIface/CMakeLists.txt
+++ b/interface-model-extractor/pre-process/BinderIface/CMakeLists.txt
@@ -9,10 +9,10 @@ if( NOT MSVC ) # MSVC mangles symbols differently, and
   endif()
 endif()
 
-add_llvm_loadable_module(BinderIface BinderIface.cpp PLUGIN_TOOL clang)
+add_llvm_library(BinderIface MODULE BinderIface.cpp PLUGIN_TOOL clang)
 SET(CMAKE_INSTALL_RPATH "")
 if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
-  target_link_libraries(BinderIface PRIVATE
+  target_link_libraries(BinderIface
     clangAST
     clangBasic
     clangFrontend

Additionally, I had to clone LLVM using these instructions: https://android.googlesource.com/toolchain/llvm_android/+/master/README.md#instructions-to-rebuild-a-particular-toolchain-release This means LLVM source code is coming from a different repo, and the build system is different. I believe we must do this because the repo withing the FANS docs is outdated, and does not contain the current version used by AOSP 11.

After making these changes, I can build clang, but I cannot get any plugins to build. Can you please provide updated instructions?

BLuFeNiX avatar Jun 25 '21 20:06 BLuFeNiX

@BLuFeNiX, I am sorry to reply so late.

Yeah, I haven't tested FANS on Android 11, but I think this issue is not related with Android 11 directly but with the clang/llvm version. As I don't have much time to keep FANS updated with the latest clang/version version in Android, I suggest that you could learn how to build a plugin in a latest version. Besides, you might need to modify the code in BinderIface.

iromise avatar Jun 28 '21 08:06 iromise

@iromise Thank you for the reply. I guess I'll just have to dig a bit deeper!

BLuFeNiX avatar Jun 29 '21 14:06 BLuFeNiX

Hi ,
I am trying to compile it with a recent aosp release(android-11.0.0_r40), Using this command make showcommands 2>&1 >cmd.txt , it succeeds. But inside cmd.txt, there is no contents like this "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -c -Iframeworks/ ........ frameworks/base/libs/services/src/os/DropBoxManager.cpp". Instead, it just records the command "//frameworks/base/libs/services:libservices clang++ src/os/DropBoxManager.cpp" . All the *.cpp files resemble like this. So I cannot record the real comile comands .

smehod avatar Aug 23 '21 07:08 smehod

Hi , I am trying to compile it with a recent aosp release(android-11.0.0_r40), Using this command make showcommands 2>&1 >cmd.txt , it succeeds. But inside cmd.txt, there is no contents like this "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -c -Iframeworks/ ........ frameworks/base/libs/services/src/os/DropBoxManager.cpp". Instead, it just records the command "//frameworks/base/libs/services:libservices clang++ src/os/DropBoxManager.cpp" . All the *.cpp files resemble like this. So I cannot record the real comile comands .

showcommands is no longer supported. See here for details: https://stackoverflow.com/a/60602048

BLuFeNiX avatar Aug 23 '21 07:08 BLuFeNiX

Hi , I am trying to compile it with a recent aosp release(android-11.0.0_r40), Using this command make showcommands 2>&1 >cmd.txt , it succeeds. But inside cmd.txt, there is no contents like this "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -c -Iframeworks/ ........ frameworks/base/libs/services/src/os/DropBoxManager.cpp". Instead, it just records the command "//frameworks/base/libs/services:libservices clang++ src/os/DropBoxManager.cpp" . All the *.cpp files resemble like this. So I cannot record the real comile comands .

showcommands is no longer supported. See here for details: https://stackoverflow.com/a/60602048

Thank you for your reply!

smehod avatar Aug 23 '21 08:08 smehod

@BLuFeNiX Thanks for your reply. @smehod As showcommands is no longer supported, you can try to use bear or something else to record the compile commands. Then you need to adjust corresponding scripts which are related with compile commands so as to generate the interface model.

iromise avatar Aug 23 '21 13:08 iromise

@BLuFeNiX Thanks for your reply. @smehod As showcommands is no longer supported, you can try to use bear or something else to record the compile commands. Then you need to adjust corresponding scripts which are related with compile commands so as to generate the interface model.

Thanks !

smehod avatar Aug 30 '21 03:08 smehod

Hi , I am trying to compile it with a recent aosp release(android-11.0.0_r40), Using this command make showcommands 2>&1 >cmd.txt , it succeeds. But inside cmd.txt, there is no contents like this "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ -c -Iframeworks/ ........ frameworks/base/libs/services/src/os/DropBoxManager.cpp". Instead, it just records the command "//frameworks/base/libs/services:libservices clang++ src/os/DropBoxManager.cpp" . All the *.cpp files resemble like this. So I cannot record the real comile comands .

On AOSP 10+, the verbose log is always written to a compressed file in the output dir, we can dump compile commands from this file: gzip -cd out/verbose.log.gz > cmd.txt

wrlu avatar Feb 10 '22 09:02 wrlu

@wrlu Oh, great! Thanks!

iromise avatar Feb 12 '22 06:02 iromise