I have a question. To include any external library whether a static
library (*.a) or shared library (*.so) and link to the current native
shared library I have to inlcude the below code in my Andriod.mk
include $(CLEAR_VARS)
LOCAL_PREBUILT_LIBS:= libexternal1.a
include $(BUILD_MULTI_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE:=mynativeexample
LOCAL_SRC_FILES:=myexample.c
LOCAL_STATIC_LIBRARIES:=libexternal1
include $(BUILD_SHARED_LIBRARY)
The library libexternal1.a is compiled and build outside android. and
resides in the directory same as the path of my Andriod.mk
The path is \android-ndk-1.6_r1\apps\MyApplication\project\jni\.
And I am getting an error : No rule to make target 'out/apps/
MyApplication//libexternal1.a' needed to make 'out/apps/
MyApplication//
mynativeexample.so'
If I copy the libexternal1.a to 'out/apps/MyApplication//' it gives me
error
'out/apps/MyApplication//libexternal1.a' : file not recognized: File
format not recognized
As per few android-ndk threads I went thru it is improper to copy the
libexternal1.a to the out directory as the library should be
automatically created in the 'out' directory.
Something is missing in my Android.mk or something related to path of
my external static library.
The same error occurs when I use a shared library instead of static
library.
Can anyone please help me why is this happening and how to solve
this.?
Thanks.
Regards,
Purvi
> > Purvi- Hide quoted text -
>
> - Show quoted text -
So is it that I have to use arm-eabi-gcc compiler to compile a C
source code and build a static or shared library out of it and use it
in my Android.mk. Or can I include the C source code (not the native
code) in my Android.mk as a module?
Thanks.
Regards,
Purvi
> > - Show quoted text -- Hide quoted text -
--
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.
Is there a different way to deal with this?
> Try adding the path to your prebuilt static library to your LOCAL_LDLIBS
> instead.
I retied modifying my Android.mk for LOCAL_LDLIBS. The problem still
persists.
Can anyone please help me out with this?
Thanks.
Regards,
Purvi
Ok. Earlier I did try with LOCAL_LDLIBS:= -lexternall to add my
precompiled library. The externall.a is compiled using gcc and the
path to this library is \android-ndk-1.6_r1\build\platforms
\android-4\arch-arm\usr\lib. I came across that LOCAL_LDLIBS is only
used to access the libraries provided by Android NDK not any other
external precompiled library. So When I place my externall.a at the
above path it gives me error : externall.a : file not recognized:File
format not recognized.
Is there a different way to deal with this?
I retied modifying my Android.mk for LOCAL_LDLIBS. The problem still
> Try adding the path to your prebuilt static library to your LOCAL_LDLIBS
> instead.
persists.
Can anyone please help me out with this?
Thanks.
Regards,
Purvi
I used gcc to generate the library. As a suggestion given to me by a
group member, the reason for the file not recognized error is that it
is not compatible with the toolchain. So I tried to use the arm-eabi-
gcc to compile the static libraries but the library was not created.
Can you please tell me how can I compile it to be compatible?
Thanks.
Regards,
Purvi
On Jan 7, 12:30 pm, David Turner <di...@android.com> wrote:
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
ok. I get the idea how to include the external library.
I used gcc to generate the library. As a suggestion given to me by a
group member, the reason for the file not recognized error is that it
is not compatible with the toolchain. So I tried to use the arm-eabi-
gcc to compile the static libraries but the library was not created.
Can you please tell me how can I compile it to be compatible?
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
> There really is too much detail to give if you don't know the difference
> between a compiler and cross-compiler.
I was able to make out the diff between compiling and cross
compiling.
Can you please tell me how can we crosscompile any assembly source
code.
> I instead recommend you to write an Android.mk file to build your sources
> instead and use the NDK to handle
> all of the nasty details instead.
Actually yes I tried this option at the very first time, but the C
source code have some assembly code as well.
So when I include the assembly source in Android.mk it is giving me
error Bad instructions on each line of my assembly code.
The same is true when I tried to cross compile the assembly code with
arm-none-eabi-gcc.
Thanks.
Regards,
Purvi
Yes, that is exactly what I am doing in my Android.mk. I placed all my
c source and assembly source in LOCAL_SRC_FILES in the order of their
dependencies. it is giving me error Bad instructions on each line of
my assembly code. If you can please help to understand the reason for
it and any solution to this error.
> If you have inlined assembler within a C source code, it probably is
> compiler-specific and something tells me it's not
> compatible with gcc anyway.
>
There is no inline assembly code in my C code.
Thank you for the guidance. It is really helpful.
Regards,
Purvi