hico
hico

Reputation: 1880

NDK Android - Can't build ARMv5 and V7 at the same time

I'm facing a weird problem. I'm building a shared library for my Android application.

I can't build both armv5 and armv7 at the same time. If I do so, I get a lot of errors on my source files at the second run (when the ndk build the armV7 lib) like:

FinderPatternInfo.o: previous definition here
multiple definition of ...

My Application.mk

APP_ABI             := armeabi armeabi-v7a
APP_PLATFORM        := android-8
APP_STL             := stlport_static
APP_CPPFLAGS        += -fexceptions

It works perfectly if I only set APP_ABI := armeabi or APP_ABI := armeabi-v7a..

Any idea ? Thank you for your help,

EDIT: Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE            := MyModule

MY_LOCAL_INCLUDED_FILES += $(wildcard $(LOCAL_PATH)/*.h)
MY_LOCAL_INCLUDED_FILES += $(wildcard $(LOCAL_PATH)/*.hpp)
MY_LOCAL_INCLUDED_FILES += $(wildcard $(LOCAL_PATH)/bigint/*.h)
... (many includes)

LOCAL_C_INCLUDES        :=  $(subst jni/, , $(MY_LOCAL_INCLUDED_FILES))

MY_LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/*.c)
MY_LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/*.cpp)
MY_LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/bigint/*.c)
.... (many cpp files)

LOCAL_SRC_FILES     :=  $(subst jni/, , $(MY_LOCAL_SRC_FILES))

LOCAL_CFLAGS        := -DNO_ICONV

include $(BUILD_SHARED_LIBRARY)

Upvotes: 3

Views: 1074

Answers (1)

SomeCallMeTim
SomeCallMeTim

Reputation: 4792

The Android make system parses your Android.mk once for each target, so your MY_LOCAL_SRC_FILES gets a full set of all of your .c and .cpp files twice when there are two targets, but only one of each when there's a single target.

If your first MY_LOCAL_SRC_FILES assignment used := instead of +=, I think it would fix the problem.

Upvotes: 3

Related Questions