Not able to build a shared library with static libraries
I am not able to build shared library with static libraries.
I downloaded some code from the web and i am trying to make it as a lib for my android project, but i am not able to create the shared libraries for the same.Please find my Android.mk file below
LOCAL_PATH := $(call my-dir)
MY_PATH := $(LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -DFIXED_POINT -DEXPORT=""
LOCAL_EXPORT_LDLIBS := -llog
LOCAL_MODULE := dspmath
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/code $(LOCAL_PATH)/dsp_fx \
$(LOCAL_PATH)/dspmath $(LOCAL_PATH)/ttylib
LOCAL_SRC_FILES := \
dspmath/ehwutl.c dspmath/mathadv.c dspmath/mathevrc.c \
dspmath/globdefs.c dspmath/mathdp31.c
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -DFIXED_POINT -DEXPORT=""
LOCAL_MODULE := dsp_fx
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/code $(LOCAL_PATH)/dsp_fx \
$(LOCAL_PATH)/dspmath $(LOCAL_PATH)/ttylib
LOCAL_SRC_FILES := \
dsp_fx/basic_op.c dsp_fx/lib_wmp_fx.c dsp_fx/math_adv40.c dsp_fx/math_ext40.c \
dsp_fx/basic_op40.c dsp_fx/math_adv.c dsp_fx/math_ext32.c
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -DFIXED_POINT -DEXPORT=""
LOCAL_MODULE := ttylib
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/code $(LOCAL_PATH)/dsp_fx \
$(LOCAL_PATH)/dspmath $(LOCAL_PATH)/ttylib
LOCAL_SRC_FILES := \
ttylib/bdo2dit.c ttylib/tty_char.c ttylib/tty_gen.c ttylib/ttystate.c \
ttylib/dit2a.c ttylib/tty_dbg.c ttylib/tty_glob.c \
ttylib/tone_gen.c ttylib/tty_dec.c ttylib/tty_hdr.c \
ttylib/tty_bit.c ttylib/tty_enc.c ttylib/tty_rate.c
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -DFIXED_POINT -DEXPORT=""
LOCAL_EXPORT_LDLIBS := -llog
LOCAL_MODULE := code
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/code $(LOCAL_PATH)/dsp_fx \
$(LOCAL_PATH)/dspmath $(LOCAL_PATH)/ttylib
LOCAL_SRC_FILES := \
code/a2lsp.c code/convh.c code/fcbgq.c code/inv_sqrt.c code/putacbc.c \
code/acb_ex.c code/cshift.c code/fer.c code/lpcana.c code/r_fft.c \
code/acelp_pf.c code/d3_10pf.c code/filter.c code/lsp2a.c code/rda.c \
code/apf.c code/d8_35pf.c code/fndppf.c code/lspmaq.c code/rom.c \
code/auto.c code/d_fer.c code/getext1k.c code/main.c code/synfltr.c \
code/bitpack.c code/d_globs.c code/getgain.c code/maxeloc.c code/w2res.c \
code/bitupack.c code/d_no_fer.c code/getopt.c code/mdfyorig.c code/weight.c \
code/bl_intrp.c code/d_rate_1.c code/getres.c code/mod.c code/zeroinpt.c \
code/bqiir.c code/decode.c code/globs.c code/ns127.c \
code/c3_10pf.c code/durbin.c code/impulser.c code/pit_shrp.c \
code/c8_35pf.c code/e_globs.c code/interpol.c code/pktoav.c \
code/comacb.c code/encode.c code/intr_cos.c code/pre_enc.c
include $(BUILD_SHARED_LIBRARY)
LOCAL_PATH := $(MY_PATH)
i开发者_如何学Gonclude $(CLEAR_VARS)
LOCAL_CFLAGS := -DFIXED_POINT -DEXPORT=""
LOCAL_MODULE := evrc
LOCAL_SHARED_LIBRARIES := dspmath code dsp_fx ttylib
include $(BUILD_SHARED_LIBRARY)
After executing the above make file , i am getting the output in the diff folder like this
1) The above make file is in the $(PROJECT)/jni folder 2) Outpur files are getting generated int he $(PROJECT)/obj/local/armeabi-rwxr-xr-x+ 1 TPRM73 Domain Users 468K Aug 1 17:40 libcode.a
-rwxr-xr-x+ 1 TPRM73 Domain Users 80K Aug 1 17:40 libdsp_fx.a
-rwxr-xr-x+ 1 TPRM73 Domain Users 73K Aug 1 17:40 libdspmath.a
-rwxr-xr-x+ 1 TPRM73 Domain Users 3.6K Aug 1 17:41 libevrc.so
-rwxr-xr-x+ 1 TPRM73 Domain Users 101K Aug 1 17:41 libttylib.a
drwxr-xr-x+ 1 TPRM73 Domain Users 0 Aug 1 17:40 objs
If u observe the size of libevrc.so, it is 3.6K which is less than the static libraries. Please help me inresolving the above issue. Please let me know if u want more information.
Thanks & Regards,
SSuman185We have to use LOCAL_WHOLE_STATIC_LIBRARIES
instead of LOCAL_STATIC_LIBRARIES
, to avoid the removal of unused functions so that the whole static library will be loaded in the shared library.
This is the basic answer I got from Google. Anyone please add more information if they know.
[Dhanavel] : You are right!!
I also faced similar kind of problem. After replacing LOCAL_STATIC_LIBRARIES to LOCAL_WHOLE_STATIC_LIBRARIES linking happened and final .so got generated.
精彩评论