This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error in Compiling 64-bit Neon code using Android NDK r10c

Hello, 

          I am trying to compile a 64-bit Neon code using android ndk-r10c in eclipse. I am getting an error message:

Android NDK: NEON support is only possible for armeabi-v7a ABI  its variant armeabi-v7a-hard and x86 ABI  

Android NDK: Please add checks against TARGET_ARCH_ABI in jni/Android.mk".

This is my Android.mk file

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_ARM_MODE := arm

LOCAL_ARM_NEON := true

LOCAL_MODULE := helloneon

LOCAL_SRC_FILES := helloneon.c

ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI), arm64-v8a))

    LOCAL_CFLAGS := -DHAVE_NEON=1

ifeq ($(TARGET_ARCH_ABI),x86)

    LOCAL_CFLAGS += -mssse3

endif

    LOCAL_SRC_FILES += helloneon-intrinsics.c.neon

endif

LOCAL_STATIC_LIBRARIES := cpufeatures

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cpufeatures)

Can anyone help me in resolving this?

Thanks and Regards

Parvathy

  • This isn't so much an error as it is the NDK giving you a very stern warning and aborting. It is actually giving you the solution in the warning though. The stock Android.mk file included in android-ndk-r10c/samples/hello-neon/jni does not have these two lines:


    LOCAL_ARM_MODE := arm

    LOCAL_ARM_NEON := true

    The second item "LOCAL_ARM_NEON := true" is causing your warning because you are using it outside of your ABI check. You should have your ABIs defined in "Application.mk", something like this:


    APP_ABI := armeabi armeabi-v7a arm64-v8a x86


    Then when you do the "ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI), armeabi-v7a x86))" check, it is safe to set LOCAL_ARM_NEON to true


    Try moving those two lines you've added inside the ABI check and it should compile but they are redundant since you are already defining the abi's and adding the NEON cflag...


    ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI), arm64-v8a))

        LOCAL_CFLAGS := -DHAVE_NEON=1

        LOCAL_ARM_MODE := arm

        LOCAL_ARM_NEON := true

    In practice it is safe to force your module to build a version with NEON and one without so long as you're doing runtime detection as described in: android-ndk-r10c/docs/Programmers_Guide/html/md_3__key__topics__c_p_u__support__c_p_u-_a_r_m-_n_e_o_n.html

  • try this:

    ifeq ($(TARGET_ARCH_ABI),x86)

        LOCAL_CFLAGS    += -mssse3

        LOCAL_CPPFLAGS  += -mssse3

        LOCAL_CXXFLAGS  += -mssse3

    endif

    ifeq ($(TARGET_ARCH_ABI),arm64-v8a)

        LOCAL_CFLAGS    += -DHAVE_NEON64_or_Some_Other_flag =1

        LOCAL_CPPFLAGS  += -DHAVE_NEON64_or_Some_Other_flag=1

        LOCAL_CXXFLAGS  += -DHAVE_NEON64_or_Some_Other_flag=1

    endif

    ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)

        LOCAL_ARM_NEON  := true

        LOCAL_CFLAGS    += -mfpu=neon

        LOCAL_CPPFLAGS  += -mfpu=neon

        LOCAL_CXXFLAGS  += -mfpu=neon

    endif

    ifeq ($(TARGET_ARCH_ABI),armeabi)

        #some fetchers for this arch

    endif