*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. >> >> > -- 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>>
