备份一下手工书写Android JNI工程时mk的模板,以及uses VFP register arguments, output does not问题
来源:互联网 发布:hp打印机输入端口名 编辑:程序博客网 时间:2024/05/29 03:39
Android JNI开发,手工建立MK模板:
Application.mk
APP_ABI := armeabi-v7aAPP_STL := gnustl_staticAPP_CPPFLAGS := -frtti -fexceptions -std=c++11APP_PLATFORM := android-15
Android.mk
LOCAL_PATH := $(call my-dir)#print message#$(warning "the value of LOCAL_PATH is $(LOCAL_PATH)")include $(CLEAR_VARS)LOCAL_MODULE := native-libLOCAL_C_INCLUDES = $(LOCAL_PATH)/3rdparty/includeLOCAL_SRC_FILES := native-lib.cpp #\#3rdparty/src/aaidsys.c \#3rdparty/src/queue.c \#3rdparty/src/video.c \#3rdparty/src/ysqfd.c \#3rdparty/src/yuvproc.c#LOCAL_CFLAGS := -mfloat-abi=hard -D_NDK_MATH_NO_SOFTFP=1LOCAL_CPPFLAGS := -s -mfloat-abi=softfp -mfpu=neon -D_NDK_MATH_NO_SOFTFP=1####include the 3rdparty(method1)#####LOCAL_LDLIBS += -llog -L$(LOCAL_PATH)/3rdparty/lib/ -lysqfd32####include the 3rdparty(method2)#####LOCAL_SHARED_LIBRARIES := ysqfd32include $(BUILD_SHARED_LIBRARY)####the 3rdparty####include $(CLEAR_VARS)#$(warning "the value of LOCAL_PATH is $(LOCAL_PATH)") LOCAL_MODULE := ysqfd32LOCAL_SRC_FILES := 3rdparty/lib/libysqfd32.soinclude $(PREBUILT_SHARED_LIBRARY)
本来想用一下,于仕琪博士的人脸检测库,无奈怎么也链接不上库~~~~
D:/Android/android-sdk-windows/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: ../../../../src/main/jniLibs/armeabi-v7a/libysqfd32.so uses VFP register arguments, output does not
网搜所有的答案,都不能解决问题,只好求助NDK社区(https://github.com/android-ndk/ndk/),得到答复:
https://github.com/android-ndk/ndk/issues/552#event-1308445210
Like I said in the other bug, you don't. Android does not use the hard float calling convention. You do not need -mfloat-abi=hard to use floating point instructions. It only affects the calling convention.
就是根本不支持啊,开始的时候我也纳闷,怎么就没有一个宏能够改变默认的浮点数使用方式?
虽然得到google人员的肯定回复,但还是有个疑问:NDK编译工具下的hard是干什么用的?
toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\armv7-a\hard\*
这些库难道不是为了支持hard float?
还是另找出路:arm-linux-gnueabihf 貌似可以解决我的问题,待实践~~~~
找到原因了,Hard VFP是不支持NDK交叉编译工具的,只能使用板载系统工具本地编译,不过这样arm-linux-gnueabihf又有什么用呢???
其实是支持交叉编译的,使用 arm-linux-gnueabihf 编译后的程序里面有
Tag_ABI_VFP_args: VFP registers
普通的交叉编译工具是没有这个的!!!
How to Detect if an ARM ELF Binary is Hard-float (ARMHF) or Soft-float (ARMEL)
https://www.cnx-software.com/2013/04/22/how-to-detect-if-an-arm-elf-binary-is-hard-float-armhf-or-soft-float-armel/
以下是一个小程序:
@echo offset PATH=F:\gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_win32\bin;D:\Android\android-sdk-windows\platform-tools;%PATH%echo "mfloat compiling......"arm-linux-gnueabihf-gcc.exe -v -static mfloat.c -o demorem arm-linux-gnueabihf-gcc.exe -v -ffast-math mfloat.c -o demopauserem arm-linux-gnueabihf-readelf.exe -a demopauserem arm-linux-gnueabihf-readelf.exe -a libysqfd32.sopauseadb push demo /data/local/tmp/adb shell chmod 777 /data/local/tmp/demoadb shell ls -l /data/local/tmp/adb shell /data/local/tmp/demopause
mfloat.c
#include <stdio.h>int main(void){double a,b,c;a = 23.543;b = 323.234;c = b/a;printf("the 13/2 = %f\n", c);printf("hello world !\n");return 0;}
- 备份一下手工书写Android JNI工程时mk的模板,以及uses VFP register arguments, output does not问题
- Android bdk-build error:libxxx.so/.a use VFP register arguments, output does not解决办法
- error: xxx.elf uses VFP register arguments
- android-opencv 版本下JNI Android.mk文件的书写
- does not declare uses-library android.test.runner
- does not declare uses-library android.test.runner
- Android NDK 中mk文件的书写
- does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-l
- does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-l
- does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-l
- android jni编译时Android.mk文件的规范说明
- android工程的mk写法。
- 复制Android Studio 工程到其它电脑后遇到The SDK directory 'XXXX‘ does not exist.问题的解决方法
- ICONS_SCALABLE_DC.MK does not exist
- Android JNI JNINativeMethod register
- android studio上的jni编译流程以及Android.mk文件的处理。
- android studio上的jni编译流程以及Android.mk文件的处理
- Android Application.mk和Android.mk 同在应用程序里的jni目录时交叉编译步骤
- UEditor上传图片到项目外部目录-java
- 文本编辑器-Vim
- NOIP2013 Day2
- recycleView的多布局
- 表单验证
- 备份一下手工书写Android JNI工程时mk的模板,以及uses VFP register arguments, output does not问题
- Java5 并发学习
- MySQL DATE_FORMAT() 函数
- python3 类的继承
- NodeMCU针脚说明
- php 安装swoole扩展
- 自己在家做烧饼
- Projects Review
- 【NOIP模拟】 (10.24) T3 math