Search code examples
clangandroid-source

How does AOSP build system produce .rsp files and how to get them?


According to How does AOSP 9.0 build system link the executable? and What does @ mean in this clang command in AOSP build log? , when linking a module, AOSP seems to produce a .rsp file that contains all the obj files that the module need,and pass the file name as a parameter to the link command, for example:

prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ /OpenSource/Build/Android/9.0.0_r30/soong/.intermediates/bionic/libc/crtbegin_so/android_x86_64_core/crtbegin_so.o @/OpenSource/Build/Android/9.0.0_r30/soong/.intermediates/frameworks/base/libs/hwui/libhwui/android_x86_64_core_shared/libhwui.so.rsp ......

But the .rsp files seems to be removed after build.

The question is, how are these file generated and how to get these files? This may require to learn and modify the build scripts which is out of reach for me.


Solution

  • There maybe the answer for you, read the ninja build manual , in that manual .rsp file mentioned.

    https://ninja-build.org/manual.html

    the following is info that I copy out.


    rspfile, rspfile_content if present (both), Ninja will use a response file for the given command, i.e. write the selected string (rspfile_content) to the given file (rspfile) before calling the command and delete the file after successful execution of the command.

    This is particularly useful on Windows OS, where the maximal length of a command line is limited and response files must be used instead.