visual c++ - Google Project Tango NDK undefined reference on functions -
i getting compile error:
undefined reference 'tangoservice_getconfig' (moreteapotsnativeactivity.cpp) ld returned 1 exit status (collect2.exe)
i working tango sdk tangosdk_ikariotikos_c.zip in visual studio 2015 using visualgdb. have replicated error in android studio isn't ide specific.
i have started ndk sample project test native activity deploys correctly , reduce complexity whilst troubleshooting. have used visualgdb moreteapotsnativeactivity do. app compiles , runs on our asus zenfone ar. once include tango_client_api.h , add following code, compile error:
tangocoordinateframepair* tango_framepair; tango_framepair = new tangocoordinateframepair(); tango_framepair->base = tango_coordinate_frame_start_of_service; tango_framepair->target = tango_coordinate_frame_device; tangoerrortype retval; // connect tango service. tangoconfig tango_config; tango_config = tangoservice_getconfig(tango_config_default);
the tango header file has extern "c" wrapper c functions , .o shows them demangled can't see why failing.
if comment out...
//tango_config = tangoservice_getconfig(tango_config_default);
...it compiles , enums show locals in debug seems problem functions: see image of locals here
i may missing glaringly obvious because android new me. perhaps can test tangosdk library same code block , spot issue. frustrating cannot link library. may missing simple me not obvious.
any appreciated.
i contacted sysprogs support gave me link: prebuilt_shared_library syntax
i hadn't realised library wasn't being copied though intellisense reading header. needed include reference in make file (android.mk) copy library (i copied tango include , lib folders project jni folder):
include $(clear_vars) local_module := tango_client_api local_src_files := ../jni/lib/$(target_arch_abi)/libtango_client_api.so include $(prebuilt_shared_library)
i did same additional block support library:
include $(clear_vars) local_module := tango_support_api local_src_files := ../jni/lib/$(target_arch_abi)/libtango_support_api.so include $(prebuilt_shared_library)
the main module needs this:
local_shared_libraries := tango_client_api
the whole file looks this:
local_path := $(call my-dir) include $(clear_vars) local_module := tango_client_api local_src_files := ../jni/lib/$(target_arch_abi)/libtango_client_api.so include $(prebuilt_shared_library) include $(clear_vars) local_module := tango_support_api local_src_files := ../jni/lib/$(target_arch_abi)/libtango_support_api.so include $(prebuilt_shared_library) include $(clear_vars) local_module := moreteapotsnativeactivity #visualgdbandroid: autoupdatesourcesinnextline local_src_files := gdbserver_launcher.c moreteapotsnativeactivity.cpp moreteapotsrenderer.cpp local_c_includes := jni/include local_ldlibs := -llog -landroid -legl -lglesv2 local_static_libraries := cpufeatures android_native_app_glue ndk_helper local_shared_libraries := tango_client_api include $(build_shared_library) $(call import-module,android/ndk_helper) $(call import-module,android/native_app_glue) $(call import-module,android/cpufeatures)
i didn't work straight away when following ndk examples sysprogs gave me feedback on mistake include.
i tried include:
local_module_filename := tango_client_api
i left off lib , .so seemed convention. .so not necessary taking lib off changing file name caused link error. said, line unnecessary in first place removed it. removed error relating this. have yet see if library works @ runtime because error:
java.lang.unsatisfiedlinkerror: unable load native library "/data/app/com.sample.moreteapots-2/lib/arm64/libmoreteapotsnativeactivity.so": dlopen failed: library "libbinder.so" not found
but seems relate problem android 7.0 platform 24 , higher
the system prevents apps dynamically linking against non-ndk libraries
from /android/android-sdk/docs/about/versions/nougat/android-7.0-changes.html
wiki
Comments
Post a Comment