I am trying to compile Taglib
for Android. I have downloaded the latest version for
Taglib
from here . After compiling it for arm-linux
build I have successfully imported it in my application, but when I try to call any function from tag_c.h
I am getting following error:
SharedLibrary : taglibwav.so
/home/test/workspacenew/Androidtaglibexample/obj/local/armeabi/
objs/squared/taglibwav.o: In function
`Java_com_android_androidtag_WavFileDetails_taglibwav':
/home/test/workspacenew/Androidtaglibexample/jni/taglibwav.c:30:
undefined reference to `taglib_set_strings_unicode'
collect2: ld returned 1 exit status
make: *** [/home/test/workspacenew/Androidtaglibexample/obj/
local/armeabi/taglibwav.so] Error 1
Application configuration information is:
Taglib ./configure :-
./configure CC="/home/hcl/taglib/taglib/toolchain/bin/arm-linux-androideabi-gcc"\
--host="arm-linux" \
--build="arm" \
--enable-static="no" \
--enable-shared="yes" \
--prefix="/home/test/workspacenew/Androidtaglibexample/jni/testtaglib/"\
Android.mk :-
LOCAL_PATH := $(call my-dir)
#declare the prebuilt library
include $(CLEAR_VARS)
LOCAL_MODULE := taglibtest
LOCAL_SRC_FILES := testtaglib/lib/libtag.a
LOCAL_EXPORT_C_INCLUDES := testtaglib/include/taglib/
LOCAL_PRELINK_MODULE := true
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
include $(call all-subdir-makefiles)
LOCAL_MODULE := taglibwav
LOCAL_SRC_FILES := taglibwav.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/testtaglib/include/taglib/
LOCAL_SHARED_LIBRARY := taglibtest
LOCAL_LDLIBS := -llog -ljnigraphics -lz -lm -L$(SYSROOT)/usr/lib -llog
include $(BUILD_SHARED_LIBRARY)
APP_ABI :=armeabi
APP_STL:=stlport_static
#include <jni.h>
#include <tag_c.h>
#include <android/log.h>
#ifndef FALSE
#define FALSE 0
#endif
.......
.......
JNIEXPORT void JNICALL Java_com_android_androidtag_WavFileDetails_taglibwav
(JNIEnv * ev, jclass jc){
int i;
int seconds;
int minutes;
TagLib_File *file; //<< accessed form tag_c.h : OK
TagLib_Tag *tag; //<< accessed form tag_c.h : OK
const TagLib_AudioProperties *properties; //<<accessed form tag_c.h : OK
taglib_set_strings_unicode(FALSE);//<<accessed form tag_c.h : GETTING ERROR
}
....
....
Android NDK Version :- Android-Ndk-r7c
Please, guide me in the right direction to fix what I'm doing wrong
I think you might need -ltag_c
in there somewhere
TagLib_File *file; //<< accessed form tag_c.h : OK
TagLib_Tag *tag; //<< accessed form tag_c.h : OK
const TagLib_AudioProperties *properties; //<<accessed form tag_c.h : OK
taglib_set_strings_unicode(FALSE);//<<accessed form tag_c.h : GETTING ERROR
The reason you can't access taglib_set_strings_unicode
is because of how TAGLIB_C_EXPORT
is defined in tag_c.h.
#if defined(_WIN32) || defined(_WIN64)
#ifdef MAKE_TAGLIB_C_LIB
#define TAGLIB_C_EXPORT __declspec(dllexport)
#else
#define TAGLIB_C_EXPORT __declspec(dllimport)
#endif
#elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#define TAGLIB_C_EXPORT __attribute__ ((visibility("default")))
#else
#define TAGLIB_C_EXPORT
#endif
...
typedef struct { int dummy; } TagLib_File;
typedef struct { int dummy; } TagLib_Tag;
typedef struct { int dummy; } TagLib_AudioProperties;
...
TAGLIB_C_EXPORT void taglib_set_strings_unicode(BOOL unicode);
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With