Link a .so to my library

Put problems with the Android NDK in this forum.

Link a .so to my library

Postby Ingersol » Wed Jul 21, 2010 5:55 pm

Hello.

I have external.so library. I can link and use it in my ndk library trough LOCAL_LDLIBS.
But it isnt static library so it should be copied to .apk for working together with my library.

I using android.mk and ndk-build build system so what i should write in android.mk for notice ndk-build i want this external.so be in apk ?
Ingersol
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Dec 06, 2008 2:49 pm

Top

Re: Link a .so to my library

Postby lord_ure » Thu Jul 22, 2010 8:13 am

Hi, you can specify to ndk-build to add shared library with the line LOCAL_SHARED_LIBRARIES := external.
But you should rename your lib to libexternal.so because jni always look for a library like libNAME.so. And after you add your library to <project>/bin/ndl/YourPackage/. and in the libs/armeabi of your eclipse project.

I hope it answers to your problem.

+++ 8)
Sorry for my english, I'm french ........ :(
lord_ure
Developer
Developer
 
Posts: 46
Joined: Fri Apr 16, 2010 4:29 pm
Location: Nancy, FRANCE

Re: Link a .so to my library

Postby Ingersol » Thu Jul 22, 2010 10:54 am

Thanx, but it doesnt work. LOCAL_SHARED_LIBRARIES should be used only for already defined libraries in same android.mk
Ingersol
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Dec 06, 2008 2:49 pm

Re: Link a .so to my library

Postby lord_ure » Thu Jul 22, 2010 11:05 am

No you can use it without creating the library in the Android.mk, here is an old file I wrote :

Code: Select all
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := testso
LOCAL_SRC_FILES := testSO.c \

LOCAL_SHARED_LIBRARIES := meltingpot \
                    sgdlux

LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -ldl

include $(BUILD_SHARED_LIBRA


my libs meltingpot,sgdlux, are in the <project>/jni path, with the name : libmeltingpot.so and libsgdlux.so and my lisgdlux.so was not create by the ndk-build at all. And it works.

by 8)
Sorry for my english, I'm french ........ :(
lord_ure
Developer
Developer
 
Posts: 46
Joined: Fri Apr 16, 2010 4:29 pm
Location: Nancy, FRANCE

Re: Link a .so to my library

Postby Ingersol » Thu Jul 22, 2010 11:19 am

Interesting info about placing library, but at least for me
any LOCAL_SHARED_LIBRARIES generate make[1]: *** No rule to make target
(cygwin) and seems its very common problem for everyone
Ingersol
Junior Developer
Junior Developer
 
Posts: 10
Joined: Sat Dec 06, 2008 2:49 pm

Re: Link a .so to my library

Postby lord_ure » Thu Jul 22, 2010 12:34 pm

No rule to make target often means that ndk-build has not found the file, check your lib path to be sure they are stored in the good repository.
Sorry for my english, I'm french ........ :(
lord_ure
Developer
Developer
 
Posts: 46
Joined: Fri Apr 16, 2010 4:29 pm
Location: Nancy, FRANCE

Top

Re: Link a .so to my library

Postby lucymatt10 » Mon Feb 13, 2012 2:45 pm

Interesting info about placing library, but at least for me
any LOCAL_SHARED_LIBRARIES generate make[1]: *** No rule to make target
(cygwin) and seems its very common problem for everyone


Indeed it is, but you guys gave handy enough argument that anyone can sort it out.
lucymatt10
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Jan 03, 2012 1:49 pm

Top

Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 1 guest