I'm trying to use functions that are stored in a 3rd party .a or .so
file.
Not using the JNI, I wish to call these functions within the Native
code.
I've added them to my Android.mk file, but it always returns:
undefined reference to 'FunctionName'.
How do I make the code aware of the functions that are stored in the
library?
is it simply by linkage or am I missing Something?
my Android.mk looks like this:
------------------------------------------------------------------------------------------------------------------------------------
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# the purpose of this sample is to demonstrate how one can
# generate two distinct shared libraries and have them both
# uploaded in
LOCAL_PATH:= $(call my-dir)
# first lib, which will be built statically
#
include $(CLEAR_VARS)
LOCAL_MODULE := libtwolib-first
LOCAL_LDLIBS += $(LOCAL_PATH)/libs/mylib.a mylib
LOCAL_SRC_FILES := first.c
include $(BUILD_STATIC_LIBRARY)
# second lib, which will depend on and include the first one
#
include $(CLEAR_VARS)
LOCAL_MODULE := libtwolib-second
LOCAL_SRC_FILES := second.c
LOCAL_STATIC_LIBRARIES := libtwolib-first
include $(BUILD_SHARED_LIBRARY)
------------------------------------------------------------------------------------------------------------------------------------
Thanks is advance,
Nathan
I'm assuming that the precompiled static libraries are useless, since
they don't conform to the ABI. But then, how do I compile these
libraries from source? It seems to require a fairly deep understanding
of the NDK toolchain. Unfortunately, I don't know 'make' well enough
to figure out how NDK is building these binaries.
I'd rather not bundle the 3rd party lib source code in with my Android
project files. How difficult would it be to convert the 3rd party's
Makefile to use the NDK build tools?
I'm also in need of linking to a 3rd party library.
I'm assuming that the precompiled static libraries are useless, since
they don't conform to the ABI. But then, how do I compile these
libraries from source? It seems to require a fairly deep understanding
of the NDK toolchain. Unfortunately, I don't know 'make' well enough
to figure out how NDK is building these binaries.
I'd rather not bundle the 3rd party lib source code in with my Android
project files. How difficult would it be to convert the 3rd party's
Makefile to use the NDK build tools?
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
I managed to get it set up. Using Application.mk's APP_BUILD_SCRIPT
variable allowed me to organize everything the way I want.
I have one small issue I had left. Right now, I have to specify every
single .c in the Android.mk's LOCAL_SRC_FILES variable. I used some
vim macros to format everything for me, and it compiles, and it runs,
but obviously, this is far from ideal. How can I set more easily set
LOCAL_SRC_FILES to the list of all .c files in a directory?
Search for example for: "all-subdir-c-files".
On 26 mrt, 16:13, Michael Maloney <tactic...@gmail.com> wrote:
> On Mar 25, 1:23 pm, David Turner <di...@android.com> wrote:
>
>
>
>
>
> > On Thu, Mar 25, 2010 at 10:26 AM, Michael Maloney <tactic...@gmail.com>wrote:
>
> > > I'm also in need of linking to a 3rd party library.
>
> > > I'm assuming that the precompiled static libraries are useless, since
> > > they don't conform to the ABI. But then, how do I compile these
> > > libraries from source? It seems to require a fairly deep understanding
> > > of the NDK toolchain. Unfortunately, I don't know 'make' well enough
> > > to figure out how NDK is building these binaries.
>
> > > Read the documentation, write a small Android.mk file, it's not that hard
>
> > and the NDK build scripts will handle the really hard details for you.
>
> > > I'd rather not bundle the 3rd party lib source code in with my Android
> > > project files. How difficult would it be to convert the 3rd party's
> > > Makefile to use the NDK build tools?
>
> > > Depends on the original Makefile, someone will have to do the work and see.
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "android-ndk" group.
> > > To post to this group, send email to andro...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.