gpt4 book ai didi

android - 当 makefile 中的 "LOCAL_ARM_NEON := true"时,我的 android 手机无法运行

转载 作者:行者123 更新时间:2023-11-30 03:55:42 25 4
gpt4 key购买 nike

当我在 android.mk 中添加 LOCAL_ARM_NEON := true 时应用程序中止,即使没有任何 neon 指令。像“-mfpu=neon”这样的词也会导致中止。

我的手机是摩托罗拉android2.2
我在 Android NDK 中的配置不正确吗?还是我的手机臂不支持霓虹指令?我需要在我的手机上运行 neon 指令。

帮帮我!!!谢谢!!!

附言:应用程序.mk:

APP_STL := gnustl_static
APP_ABI := armeabi-v7a
APP_CPPFLAGS += -fexceptions
APP_MODULES := AudioEngine

安卓.mk:

CC = $(BASE_PATH)/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc 
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_ARM_NEON := true
LOCAL_MODULE := AudioEngine
LOCAL_SRC_FILES := AudioEngine.cpp Effecter.cpp SoundTouch.cpp TDStretch.cpp RateTransposer.cpp AAFilter.cpp BPMDetect.cpp \
FIFOSampleBuffer.cpp FIRFilter.cpp mmx_optimized.cpp PeakFinder.cpp sse_optimized.cpp cpu_detect_x86.cpp fft.s\
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

最佳答案

我使用我编写的第二个小型 .so 库来检查 CPU 是否完全支持 NEON。检查后,我决定在 java 中加载我的库的哪个版本,一个完全支持 NEON,一个完全不支持 NEON:这是从 NDK 文档中获取的代码:

JNIEXPORT JNICALL int Java_xypackagename_base_detectCPU_isNeon( JNIEnv* _env, jobject thiz )
{
uint64_t features;

if (android_getCpuFamily() != ANDROID_CPU_FAMILY_ARM)
{
__android_log_write( ANDROID_LOG_INFO, "detectCPU", "Processor is NOT an ARM processor" );
return 0;
}

__android_log_write( ANDROID_LOG_INFO, "detectCPU", "Processor is an ARM processor" );

features = android_getCpuFeatures();

__android_log_print( ANDROID_LOG_INFO, "detectCPU", "Processor features: %u", (unsigned int)features );

if ((features & ANDROID_CPU_ARM_FEATURE_ARMv7) == 0)
{
__android_log_write( ANDROID_LOG_INFO, "detectCPU", "Processor is NOT an ARM v7" );
return 0;
}

__android_log_write( ANDROID_LOG_INFO, "detectCPU", "Processor is an ARM v7" );

if ((features & ANDROID_CPU_ARM_FEATURE_NEON) == 0)
{
__android_log_write( ANDROID_LOG_INFO, "detectCPU", "Processor has NO NEON support" );
return 0;
}

__android_log_write( ANDROID_LOG_INFO, "detectCPU", "Processor has NEON support" );

return 1;
}

关于android - 当 makefile 中的 "LOCAL_ARM_NEON := true"时,我的 android 手机无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13398286/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com