Roy Willow
Roy Willow

Reputation: 21

Failed to link openal soft with necessitas

I'm trying to rebuild my Qt app for android, so I choose necessitas. But when I tried linking with openal soft for android(which is staticly build), errors raised:

/media/Files/QtCode/AndroidPlayer/libs/armeabi/libopenal.a(android.o): In function `JNI_OnLoad':
/media/Files/openal-android/android/jni/../../Alc/backends/android.c:51: multiple definition of `JNI_OnLoad'
qtmain_android.o:qtmain_android.cpp:(.text.JNI_OnLoad+0x0): first defined here
collect2: ld returned 1 exit status

I haven't learned android or java programming, so I don't know how to link a shared library without .a file (openal soft shared library only offers .so file).

Upvotes: 1

Views: 1187

Answers (1)

Mārtiņš Možeiko
Mārtiņš Možeiko

Reputation: 12927

That means JNI_OnLoad function is defined in multiple places. Once in android.c file from OpenAL Soft, and once in qtmain_android.cpp from Qt.

JNI_OnLoad is special function that Android calls for each shared library when it gets load. Obviously you cann't have two of those.

I suggest you putting OpenAL and Qt into seperate shared libraries. That way Android will call both JNI_OnLoad functions correctly.

Upvotes: 0

Related Questions