I am able to get the shared library by editing the Android.mk as you have
suggested but when I am tryign to open the it is using System.Load(lib name)
,
I am getting this error :

D/dalvikvm( 4757): Trying to load lib /data/data/mypackageName/lib/*
libtestEngine**.so* 0x43ec1f78
I/dalvikvm( 4757): Unable to dlopen(/data/datamypackageName/lib/*
libtestEngine**.so*): Cannot load library: link_image[1995]: failed to link
*libtestEngine.so*


libtestEngine is the final shared library containing the other shared
libraries.I havent used any cross tool, but modified the Android.mk and
added Application.mk--> APP_ABI := armeabi-v7a*
*but still the resulting library is not getting loaded and throwing the
above eerror..*

*Any idea on this..!
Rgds,
Saurabh



On Thu, Jun 30, 2011 at 11:36 PM, s.rawat <[email protected]> wrote:

>
> "..pain is temporary.....quitting lasts forever......"
>
>
>
> Forwarded conversation
>
> Subject: Linking different object files created from crosstool with the
> current shared library created from ndk-build
>  ------------------------
>
> From: *s.rawat* <[email protected]>
> Date: Thu, Jun 30, 2011 at 4:45 PM
>  To: [email protected]
> Cc: [email protected], [email protected]
>
>
> *NOTE: Changed the subject from
> OLD :Cross compiling the android application using the jni call to invoke a
> c method failing
> NEW : Linking different object files created from crosstool with the
> current shared library created from ndk-build*
>
> No, No success in this [?][?][?][?], I am not sure if I had written the
> correct make file(Android.mk) ,
> I have boiled down the problem to this :
>
> (1)I havce three files file1.c file2.c file3.c , out of this I am making a
> shared file .so using the ndk-build utility , I tried with file1.c and
> started adding the file2 and 3.
> With file1.c I get the shared library happily, as it doesnt have any
> archtecture specific code, which i can load and call the c functionalities
> of file1.c  using JNI calls
> here is the Android.mk for that :
>
> LOCAL_PATH := $(call my-dir)
>
> include $(CLEAR_VARS)
>
> #LOCAL_LDLIBS    := -llog
>
> LOCAL_MODULE    := testEngine
> LOCAL_SRC_FILES := file1.c
> # No special compiler flags.
> LOCAL_CFLAGS += MY_FLAGS
> LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
> include $(BUILD_SHARED_LIBRARY)
>
> But I need the fucntionalities of other two files as well but these two
> files 1 and 2 contains the archtecture specifi code which are not gwtting
> compiled by ndk, so what I did I seperately created the object files for
> them file1.o and file2.o
> using these commands :
> my-tool-chain-gcc -fPIC -g -c -Wall file1.c and
> my-tool-chain-gcc -fPIC -g -c -Wall file2.c
>
> but now I dont know how to create a final shared library with these two .o
> files and the file1.c code.
> Do you have any idea.??
> I am trying this for two days continously but havent got any satisfcatory
> solution for this(in plain terms - No solution for this ), once get I am
> sure will post this with full description
> PLz help !!!.
>
>
>
>
> Rgds,
> -J
>
>
>
>
>
>
>
> "..pain is temporary.....quitting lasts forever......"
>
>
>
> On Thu, Jun 30, 2011 at 10:43 AM, s.rawat <[email protected]>wrote:
>
>> HI Thanks for the reply..
>> here is my Android.mk :
>>
>>
>> *LOCAL_PATH := $(call my-dir)
>>
>> include $(CLEAR_VARS)
>>
>> #LOCAL_LDLIBS    := -llog
>>
>> LOCAL_MODULE    := testEngine
>> LOCAL_SRC_FILES := engine.c cpu.c IO.c memory.c
>> # No special compiler flags.
>> LOCAL_CFLAGS += -fno-builtin-printf -static -O3 -DCORE_FREQ=800
>> -DBAREMETAL -DPMU_CCNT_V7
>> LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
>> include $(BUILD_SHARED_LIBRARY)
>>
>> So you mean to say instead of putting engine.c IO.c memory.c i should
>> mention the objct file for each and the LOCAL_MODULE equal to the final
>> library like this :
>>
>> **
>> LOCAL_MODULE    := testEngine
>> LOCAL_SRC_FILES := engine.o cpu.o IO.o memory.o
>>
>> I will try and post the results ...!!
>>
>> Thanks again for the reply !!
>> Rgds,
>> -J
>> **
>> *
>>
>> "..pain is temporary.....quitting lasts forever......"
>>
>>
>>
>>
>> 2011/6/29 Enrique Ocaña González <[email protected]>
>>
>>> On Martes, 28 de Junio de 2011 23:27:31 Jessica escribió:
>>>
>>> > and placed it under the same folder where ndk-build was creating
>>> > the .so file that is libs/armeabi> but when i am i trying to load the
>>> > libary i am getting this error by
>>> >
>>> > doing the logcat
>>> >
>>> > D/dalvikvm(17719): Trying to load lib /data/data/<package name>/lib/
>>> > libTestengine.so 0x43e45c48
>>> >
>>> > I/dalvikvm(17719): Unable to dlopen(<package name>/lib/
>>> > libTestengine.so): Cannot load library: link_image[1995]: failed to
>>> > link libTestengine.so
>>>
>>> Are you sure that the library is being included in the APK? (unzip -l
>>> bin/*.apk)
>>>
>>> If you use Eclipse, clean your project, rebuild it and look into the APK
>>> again. If it's still not there, maybe you need to explicitly create some
>>> rules
>>> to include the library as an external precompiled library:
>>>
>>> jni/Application.mk ------
>>>
>>> ...
>>> APP_MODULES := testengine
>>> ...
>>>
>>> jni/Android.mk ----------
>>>
>>> ...
>>> include $(CLEAR_VARS)
>>> LOCAL_MODULE := testengine
>>> LOCAL_SRC_FILES := relative/path/to/libTestengine.so
>>> LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/relative/path/to/include/dir
>>> include $(PREBUILT_SHARED_LIBRARY)
>>> ...
>>>
>>> With these declarations, ndk-build will copy the library from its
>>> original
>>> place to libs and obj and the Eclipse build scripts will include it in
>>> the
>>> APK.
>>>
>>> --
>>> Enrique Ocaña
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "android-ndk" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-ndk?hl=en.
>>>
>>>
>>
>
> ----------
> From: *David Turner* <[email protected]>
> Date: Thu, Jun 30, 2011 at 7:24 PM
>
> To: [email protected]
> Cc: [email protected], [email protected]
>
>
> Archive your object files into a library (e.g. libfoo.a)
>
> Then declare a prebuilt static library in your Android.mk, as in
>
> ....
> include $(CLEAR_VARS)
> LOCAL_MODULE := libfoo_prebuilt
> LOCAL_SRC_FILES := /path/to/libfoo.a
> include $(PREBUILT_STATIC_LIBRARY)
> ...
>
>
> Then later reference it in the LOCAL_STATIC_LIBRARIES line of your main
> module
>
> ....
> LOCAL_STATIC_LIBRARIES := libfoo_prebuilt
> include $(BUILD_SHARED_LIBRARY)
>
>
> Read docs/PREBUILT.html for more details.
>
> Of course, the link is likely to fail if you use a cross-toolchain that
> doesn't support Android properly.
>
>
>  --
>>
>
>  --
>
> ----------
> From: *s.rawat* <[email protected]>
>  Date: Thu, Jun 30, 2011 at 11:33 PM
>
> To: [email protected]
> Cc: [email protected], [email protected]
>
>
> HI David ,
> Thanks for the reply
> >
> - Does this means object files being created from the cross compiler may or
> may not get linked with the shared library created with the
> ndk-build(ndk5rc) always.What kind of *proper *support is needed from the
> tool chain?
> The reason why I am using the cross tool is that certain code (assembly
> routines) needs to be necessarily compiled by the tool chain but since file1
> functionality above is arch independent , we are partially using android
> ndk-build(for shared library) and partially via tool chain (file2 and 3)but
> both the shared libarary(from ndk) and the object files created from the
> tool chain needs to be linked together to make one single .so file which can
> be loaded and called via jni calls.UNfortunately this is not happening.(dont
> know how to link them, until you proposed the above way, will check on this)
> Rgds,
> -*-*Saurabh
>
>>
>>
>> -*-*Saurabh
>>>
>>>> *-Saurabh
>>>> *
>>>>
>>>
>>>
>>
>
> ----------
> From: *s.rawat* <[email protected]>
> Date: Thu, Jun 30, 2011 at 11:33 PM
> To: "saurabh.rawat" <[email protected]>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en.

<<361.gif>>

Reply via email to