Issue
I have an application that includes a library originally compiled for version 3 of the Android NDK. The application got set aside for a while, and now I'm trying to resurrect it on the latest (Windows 64 bit r8e) version of the NDK. I've fixed most of the little quirks, but I am having problems compiling for armeabi. Specifically I get a "bad instruction 'lock'" error. From some searching around, I've gathered that this assembly isn't valid for arm - and in fact it compiles fine if I set APP_ABI to x86 - but what I don't understand is why it's generating what appears to be x86 code if I've selected arm to be built, especially since under r3 arm code can be generated from the same .cpp files. Thanks.
Application.mk
APP_STL := stlport_static
APP_MODULES := DM
APP_CPPFLAGS := -w -g
APP_ABI := armeabi
include $(call all-subdir-makefiles)
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# STLPORT_BASE := $(NDK_WRAPPERS_BASE)/stlport
LOCAL_CFLAGS += -D__NEW__ \
-DANDROID \
-DOS_ANDROID
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib \
-ldl \
-lGLESv1_CM \
-lEGL \
-llog
LOCAL_MODULE := DM
LOCAL_SRC_FILES := \
sample/test/Test.cpp
Output
ndk-build.cmd V=1
"Compile++ thumb : DM <= Test.cpp
D:/Projects/testProj/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/sample/test/Test.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -ID:/Projects/testProj/android-ndk-r8e/sources/cxx-stl/stlport/stlport -ID:/Projects/testProj/android-ndk-r8e/sources/cxx-stl//gabi++/include -DANDROID -D__NEW__ -DANDROID -DOS_ANDROID -Wa,--noexecstack -frtti -w -g -ID:/Projects/testProj/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c jni/sample/test/Test.cpp -o ./obj/local/armeabi/objs/sample/test/Test.o
C:\Temp\ccIqfvxp.s: Assembler messages:
C:\Temp\ccIqfvxp.s:474: Error: bad instruction `lock'
C:\Temp\ccIqfvxp.s:474: Error: immediate expression requires a # prefix -- `add
r3,[r0,#4]'
C:\Temp\ccIqfvxp.s:531: Error: bad instruction `lock'
C:\Temp\ccIqfvxp.s:531: Error: immediate expression requires a # prefix -- `add
r3,[r4,#4]'
make: *** [obj/local/armeabi/objs/sample/test/Test.o] Error 1
Solution
As it turns out, someone had snuck some x86 assembly code in that I wasn't aware of. I was able to #ifdef this out, and now it's working fine for arm.
Answered By - Matt McMinn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.