Building Android: error: “_FORTIFY_SOURCE” redefined [-Werror]

If you are building an old version of android probably you’ll have this error

host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp :0:0: error: “_FORTIFY_SOURCE” redefined [-Werror]
:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors

To fix this, edit build/core/combo/HOST_linux-x86.mk and replace:

HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0

with

HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

And that’s it.

2 Thoughts on “Building Android: error: “_FORTIFY_SOURCE” redefined [-Werror]

  1. bidzo on 14 May, 2013 at 14:25 said:

    Thanks! It’s work for me.

  2. Pingback: Ti814xx AOSP build | Mitchell Fang's Coding

Post Navigation