Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding commands for target Android Makefile

I am trying to compile one of the modules in my Android ndk project with g++ although the sources are all in C. My eyes are irritated by the make system warnings:

`C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:348: warning: overriding commands for target 'obj/local/armeabi/objs/xxx/yyy.o'`  
`C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:345: warning: ignoring old commands for target 'obj/local/armeabi/objs/xxx/yyy.o'`

And these warning pairs will be printed as much as there will be the source files and therefore the objects.

I've tried to declare LOCAL_SRC_FILES with all the different flavors.

`LOCAL_SRC_FILES :=  
$(LOCAL_PATH)/Directory/source.c   
$(notdir $(wildcard $(LOCAL_PATH)/*.c))  
$(notdir $(wildcard $(LOCAL_PATH)/Directory/*.c))  
$(addprefix DirectoryPrefix/,$(notdir $(wildcard $(LOCAL_PATH)/Directory/*.c)))`

And still the warning persists.
Make document says:
warning: overriding commands for target xxx'' warning: ignoring old commands for target xxx'' GNU make allows commands to be specified only once per target (except for double-colon rules). If you give commands for a target which already has been defined to have commands, this warning is issued and the second set of commands will overwrite the first set.

But I cannot understand how this is related at all. After dealing with it seems like making a g++ compile theses C files makes this warning appear.
Therefore specifying this statement:
LOCAL_CPP_EXTENSION := .c
Which makes C files build with g++ is causing it. Because when compiling with gcc no warnings are printed.

like image 828
arapEST Avatar asked Oct 04 '22 03:10

arapEST


1 Answers

Make sure that you have included clear vars:

include $(CLEAR_VARS)

And if building any other libraries that you include the correct build macro like

include $(BUILD_SHARED_LIBRARY)

I had run into this a day or two ago and it was while adding a new library I had forgotten to include one or the other (I think the CLEAR_VARS makes most sense.) So it was re-appending some values from the main library to the child library or vice versa.

like image 150
Doug-W Avatar answered Oct 13 '22 12:10

Doug-W