Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 11 compatibility problems #2

Open
BLuFeNiX opened this issue Jun 25, 2021 · 9 comments
Open

Android 11 compatibility problems #2

BLuFeNiX opened this issue Jun 25, 2021 · 9 comments

Comments

@BLuFeNiX
Copy link

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?

@iromise
Copy link
Owner

iromise commented Jun 28, 2021

@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.

@BLuFeNiX
Copy link
Author

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

@smehod
Copy link

smehod commented Aug 23, 2021

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 .

@BLuFeNiX
Copy link
Author

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

@smehod
Copy link

smehod commented Aug 23, 2021

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!

@iromise
Copy link
Owner

iromise commented Aug 23, 2021

@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.

@smehod
Copy link

smehod commented Aug 30, 2021

@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 !

@wrlu
Copy link

wrlu commented Feb 10, 2022

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

@iromise
Copy link
Owner

iromise commented Feb 12, 2022

@wrlu Oh, great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants