I am trying to compile Lame sound library with Android NDK for x86_64 architecture. I am getting the below link error for undefined references to bcopy
and index
:
jni/libmp3lame/encoder.c:471: error: undefined reference to 'bcopy'
jni/libmp3lame/encoder.c:476: error: undefined reference to 'bcopy'
jni/libmp3lame/id3tag.c:1125: error: undefined reference to 'index'
jni/libmp3lame/newmdct.c:1036: error: undefined reference to 'bcopy'
jni/libmp3lame/util.c:685: error: undefined reference to 'bcopy'
The code successfully compiles for x86 and arm architectures.
So I digged through NDK's libs a bit and noticed that bcopy
and index
are both exported in libc.so
for x86 and arm platforms but not for x86_64 (see below objdump
outputs).
$> objdump -d android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/libc.so | grep bcopy -A 6
0000b000 <bcopy>:
b000: e52db004 push {fp} ; (str fp, [sp, #-4]!)
b004: e28db000 add fp, sp, #0
b008: e28bd000 add sp, fp, #0
b00c: e8bd0800 ldmfd sp!, {fp}
b010: e12fff1e bx lr
$> objdump -d android-ndk-r10d/platforms/android-21/arch-x86/usr/lib/libc.so | grep -A 6 bcopy
00009fb0 <bcopy>:
9fb0: 55 push %ebp
9fb1: 89 e5 mov %esp,%ebp
9fb3: 5d pop %ebp
9fb4: c3 ret
$> objdump -d android-ndk-r10d/platforms/android-21/arch-x86_64/usr/lib/libc.so | grep -A 6 bcopy
<<NOTHING FOUND>>
Any thoughts? Below are my Android.mk and Application.mk files.
Application.mk:
APP_ABI:=x86_64
APP_PLATFORM := android-21
Android.mk:
LOCAL_PATH := $(call my-dir)
APP_PLATFORM := android-21
include $(CLEAR_VARS)
LOCAL_MODULE := libmp3lame
LOCAL_SRC_FILES := \
...<list-of-.c-files>...
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)