How to see the actual gcc options when building Android from source?
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
Related videos on Youtube
Comments
-
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 about 13 yearsThanks 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 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 over 8 yearsgreat and detailed answer, much more to the point than the accepted one
-
Ian Ni-Lewis over 8 yearsIt'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 over 8 yearsLink is currently dead.
-
Nir Duan over 6 yearsLink is back from the dead: web.archive.org/web/20110908044629/http://…
-
Donato Azevedo about 6 yearsJust fyi, if you are compiling using mm or mmm, it takes the same option
mm showcommands