Software Archive
Read-only legacy content
17061 Discussions

Integrating ICC compiled Static library into native part of the Android App.

Vineeth_U_Intel
Employee
244 Views

Hi,

I have an android app. The app is basic in its functioning . 

I decided to add native code to this app. So I put a square function ( C code ) inside jni folder and compiled it . This shared library I used in the android app  and it works ok. 

I was given a statically ICC  compiled library that does something similar and asked to use it also .

Then  with Intel INDE installed already I decided to use the ICC for compiling the ndk part . So I followed the following link.

https://software.intel.com/en-us/articles/intergrading-the-intelr-c-compiler-for-android-with-mutiple-android-ndks ;

Though I should be using the Android Studio...I worked with eclipse and NDK builder to compile first just  the shared library without making reference to the static libraries api ..to check if my original program does  work with ICC. It worked ok

Then I made a reference to the api in   the static library that I had been given and compiled the whole program again with ICC this time prelinking the static library along and using the NDK Builder  to generate my shared library that I  will refer in the android app.  This ran into run time error 

I took the tombstone trace and see that the function referred in the prelinked static library is missing 

I noticed that the icc when I ran ndk-build V=1 at the very end removed this function reference  and I believe the crash is due to this . I can share the code if you want to have a look at the way I am trying this out

<code>

C:/Android/ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/i686-linux-android-strip.exe --strip-unneeded  ./libs/x86/libjni_example.so

</code>

 

 

 

0 Kudos
1 Reply
Vineeth_U_Intel
Employee
244 Views

 

After compiling with this Android.mk file in the jni foilder , should'nt I get  the shared library which includes the prelinked static library ?

include $(CLEAR_VARS)
#NDK_PROJECT_PATH = C:\Users\kuvineet\workspace\alarm\alarm\ 
LOCAL_MODULE            := X_prebuilt
LOCAL_SRC_FILES         := ./path_for_X/libX.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/gnss
include $(PREBUILT_STATIC_LIBRARY)


include $(CLEAR_VARS)

LOCAL_MODULE := Y

LOCAL_C_INCLUDES := $(LOCAL_PATH) \
                    $(LOCAL_PATH)/path_for_X                   
LOCAL_SRC_FILES := y.cpp 
LOCAL_STATIC_LIBRARIES := X_prebuilt
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)

 

I got the library libY.so  of size less than the library size of libX.a  .What is wrong with this method of  creating a shared library to include a pre-linked static library ?

 

 

0 Kudos
Reply