How to see the actual gcc options when building Android from source?

13,191

Solution 1

The showcommands make target will display the gcc/g++ command line:

$ make showcommands

More info and other Android.mk build nuggets here: http://elinux.org/Android_Build_System

If you are building with mm:

$ mm showcommands

Solution 2

Probably too late for the asker, but for anyone else who comes along. From the ndk documentation @ https://docs.google.com/document/d/1jXxLV866aY9QXWS_9UwLSJjX1I6d1XfBhk1IeEyRgYE/edit?pli=1

ndk-build NDK_DEBUG=1 --> generate debuggable native code.

ndk-build V=1 --> launch build, displaying build commands.

ndk-build -B --> force a complete rebuild.

ndk-build -B V=1 --> force a complete rebuild and display build commands.

Solution 3

I found a very detailed documentation in this link: http://hashspeaks.wordpress.com/2010/01/27/android-mk-documentation/

so you should be able to add -v -Wall to LOCAL_CPPFLAGS

Share:
13,191

Related videos on Youtube

hopia
Author by

hopia

Embedded Software

Updated on June 02, 2020

Comments

  • hopia
    hopia almost 4 years

    I'm trying to debug my android source build environment (Android.mk files). By default the make system does not show the gcc command line during the build process. What is the best way to enable this?

  • hopia
    hopia about 13 years
    Thanks for the answer but I was looking for how to show the gcc command line for each file during the make. ie. "g++ -c main.c -DFLAG1 -DFLAG2 ..." By default it is not being shown by the make system.
  • Aleadam
    Aleadam about 13 years
    @hopia Sure, but I was just trying to give you a workaround in case you needed something urgent, since gcc -v gives you enough output to figure out how it is compiling it. Nevertheless, I'm glad you found it.
  • reflog
    reflog over 8 years
    great and detailed answer, much more to the point than the accepted one
  • Ian Ni-Lewis
    Ian Ni-Lewis over 8 years
    It's a great answer for application developers, not so much for system developers. The accepted answer is correct if you are trying to build AOSP.
  • npace
    npace over 8 years
    Link is currently dead.
  • Nir Duan
    Nir Duan over 6 years
    Link is back from the dead: web.archive.org/web/20110908044629/http://…
  • Donato Azevedo
    Donato Azevedo about 6 years
    Just fyi, if you are compiling using mm or mmm, it takes the same option mm showcommands

Related