Thursday, August 1, 2019

linker - Android NDK eabi - how to make ndk know to use hard fp?

I've prebuilt library (libxxx.so) with "-mfloat-abi=hard" parameter. Now i'd like to compile my native code with this lib and build shared lib (.so) with ndk.


Application.mk:



APP_ABI := armeabi-v7a



Android.mk:



LOCAL_PATH := $(call my-dir)


include $(CLEAR_VARS)


LOCAL_MODULE := xxx


LOCAL_SRC_FILES := libxxx.so


include $(PREBUILT_SHARED_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE := xxx_wrapper


LOCAL_SRC_FILES := xxx_wrapper.cpp xxx_wrapper.h


LOCAL_SHARED_LIBRARIES := xxx


LOCAL_C_INCLUDES := /softdev/host/include/


LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog


LOCAL_ARM_NEON := true


LOCAL_CXXFLAGS += -mfpu=vfp -mfloat-abi=hard


LOCAL_CFLAGS += -mfpu=vfp -mfloat-abi=hard


include $(BUILD_SHARED_LIBRARY)



on ndk-build i'm getting an error:



/softdev/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
error:
/Users/asmirnov/Documents/dev/src/project/obj/local/armeabi-v7a/objs-debug/xxx_wrapper/xxx_wrapper.o
uses VFP register arguments, output does not
/softdev/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
error:
/Users/asmirnov/Documents/dev/src/project/obj/local/armeabi-v7a/libxxx.so
uses VFP register arguments, output does not collect2: ld returned 1
exit status



How can i fix it? Both .o files are hard-float according to output and i can't figure out what "output" means? I've added '-mfpu=vfp -mfloat-abi=hard' to my module description.


UPDATE: i've executed ndk-build V=1 and found no "-mfpu=vfp -mfloat-abi=hard" arguments in command-line, so i i've tried to do it manually (but still no result):



mba-anton:build asmirnov$ /softdev/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/arm-linux-androideabi-g++

-Wl,-soname,libxxx_wrapper.so -shared --sysroot=/softdev/android-ndk-r8e/platforms/android-8/arch-arm /Users/asmirnov/Documents/dev/src/xxx_jni/obj/local/armeabi-v7a/objs-debug/xxx_wrapper/xxx_wrapper.o
/Users/asmirnov/Documents/dev/src/xxx_jni/obj/local/armeabi-v7a/libstdc++.a
-lgcc /Users/asmirnov/Documents/dev/src/xxx_jni/obj/local/armeabi-v7a/libxxx.so
-no-canonical-prefixes -march=armv7-a -mfpu=vfp -mfloat-abi=hard -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L/softdev/android-ndk-r8e/platforms/android-8/arch-arm/usr/lib -L/usr/lib -llog -lstdc++ -lc -lm -o /Users/asmirnov/Documents/dev/src/xxx_jni/obj/local/armeabi-v7a/libxxx_wrapper.so
/softdev/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
error:
/Users/asmirnov/Documents/dev/src/xxx_jni/obj/local/armeabi-v7a/objs-debug/xxx_wrapper/xxx_wrapper.o
uses VFP register arguments, output does not
/softdev/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
error:
/Users/asmirnov/Documents/dev/src/xxx_jni/obj/local/armeabi-v7a/libxxx.so
uses VFP register arguments, output does not
collect2: ld returned 1 exit status


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...