makefile - Android NDK - Including prebuilt static libraries gives undefined reference errors -
i trying build shared library using prebuilt static library. reason, building fails giving undefined reference
errors. if add local_allow_undefined_symbols := true
, building succeeds shared library few kilobytes while static library 3 megabytes... seems went wrong in linking static library. have no idea be. using c++ code.
android.mk:
local_path := $(call my-dir) include $(clear_vars) local_module := kes local_export_c_includes := $(local_path)/include local_src_files := libkes.a include $(prebuilt_static_library) include $(clear_vars) local_module := portakes local_src_files := portakes.cpp local_static_libaries := kes include $(build_shared_library)
application.mk:
app_abi := app_stl := stlport_static
jni directory structure:
output:
./obj/local/arm64-v8a/objs/portakes/portakes.o: in function `java_com_kurzweil_portakes_kesfile_createpolefile': c:\users\niels.mylle\documents\kurzweil mobile android\portakes/jni/portakes.cpp:18: undefined reference `cpolefile::cpolefile(char const*, bool, bool, cencrypter*)' ./obj/local/arm64-v8a/objs/portakes/portakes.o: in function `java_com_kurzweil_portakes_kesfile_createksection': c:\users\niels.mylle\documents\kurzweil mobile android\portakes/jni/portakes.cpp:33: undefined reference `cksection::cksection(char const*, cpolefile*, cpoleleaf*)' ./obj/local/arm64-v8a/objs/portakes/portakes.o: in function `java_com_kurzweil_portakes_polefile_destroy': c:\users\niels.mylle\documents\kurzweil mobile android\portakes/jni/portakes.cpp:48: undefined reference `cpolefile::~cpolefile()' ./obj/local/arm64-v8a/objs/portakes/portakes.o: in function `java_com_kurzweil_portakes_polefile_exists': c:\users\niels.mylle\documents\kurzweil mobile android\portakes/jni/portakes.cpp:100: undefined reference `cpolefile::exists(char const*)' collect2.exe: error: ld returned 1 exit status make.exe: *** [obj/local/arm64-v8a/libportakes.so] error 1
maybe it's part of problem, @ least reference wrong:
local_src_files := libkes.a
you're building ndk compatible architectures, referencing same static prebuilt each of them, cannot work.
you should have different .a each architecture you're targeting, ie ./armeabi/libkes.a
, ./x86/libkes.a
, ./armeabi-v7a/libkes.a
, etc. in case you'll able reference .a using target_arch_abi
variable, so:
local_src_files := $(target_arch_abi)/libkes.a
Comments
Post a Comment