third party library load fail : Unable to dlopen and Can't load library

241 views
Skip to first unread message

kalikali

unread,
Nov 14, 2009, 8:36:16 PM11/14/09
to android-ndk
Hi all,

This problem has stock me for a log time, hope some one can give me a
hint

I try to use a thirdparty library, and the third party just provide
the source codes with C++, I already build out the static library
(*.a) and then i put then in NDK process to build out shared library.

I put the following static library in the \android-ndk-1.6_r1\out\apps
\adobe2

libtetraphilia.a
libstdc++.a
libssl.a
libpxfstatic.a
libpng.a
libjpeg.a
libcryptutils.a
libcrypto.a
libc.a
libdl.a
libzlib.a

and write the Android.mk as
===================================================
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := adobelibtest
LOCAL_SRC_FILES := adobelibtest.cpp

LOCAL_STATIC_LIBRARIES := libpxfstatic libcryptutils libtetraphilia
libjpeg libpng libzlib libssl libcrypto libstdc++ libc libdl

include $(BUILD_SHARED_LIBRARY)
and finally the so is build out (libadobelibtest.so)
====================================================
following is my java codes

====================================================
package com.example.adobe;

import android.app.Activity;
import android.util.Log;
import android.widget.TextView;
import android.os.Bundle;

public class adobelibtest extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

TextView tv = new TextView(this);

Log.e("Cary", "before");
System.loadLibrary("adobelibtest");
Log.e("Cary", "after");

int z = test();

tv.setText( "The test result is " + z );
setContentView(tv);
}

public native int test();
}
===================================================
But the error happen on after Log.e("Cary", "before");

Unable to dlopen(/data/data/com.example.adobe/lib/libadobelibtest.so):
Cannot load library: reloc_library[1288]: 541 unknown reloc type 19@
0x811bd884 (35910)

I know the NDK support mini version of C++, and the third party source
codes C++ seem like use more than that ( ex : vector, map,
limits.....) , so i need to put the extra static libs list above in
folder \android-ndk-1.6_r1\out\apps\adobe2 to build out shared
library, I am not sure if it's a right solution, but that what i can
do. Or has anybody can tell me how to use a third party C++ solution
in android?

Thanks lot.
Michael

tfortier

unread,
Nov 16, 2009, 9:32:50 AM11/16/09
to android-ndk
I had a similar problem and it had to do with Android Bionic linker
which is a compact version of traditional linux linkers.

In order to find out do a 'ldd' in linux for all of the libraries and
see if you are missing any dependencies.

Also see here:
http://groups.google.com/group/android-ndk/browse_thread/thread/35660b639cdd74cc/8354e19a9fb08b91?lnk=gst&q=uknown+reloc+type#8354e19a9fb08b91
Reply all
Reply to author
Forward
0 new messages