android - Getting error ld.exe: error: cannot find -lgnustl_shared in ndk on compiling tbb source files -
i trying compile tbb source files threadingbuildingblocks.
i have tried available solutions on stackoverflow none of them works. error getting is:
lib -l/cygdrive/d/android/ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86 -lgnustl_shared -shared -wl,-soname=libtbb.so --sysroot=/cygdrive/d/android/ndk/platforms/android-9/arch-x86 -m32 -wl,--version-script,tbb.def d:/android/ndk/toolchains/x86-4.6/prebuilt/windows/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.exe: error: cannot find -ldl d:/android/ndk/toolchains/x86-4.6/prebuilt/windows/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lgnustl_shared d:/android/ndk/toolchains/x86-4.6/prebuilt/windows/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lstdc++ d:/android/ndk/toolchains/x86-4.6/prebuilt/windows/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lm d:/android/ndk/toolchains/x86-4.6/prebuilt/windows/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.exe: error: cannot find -lc d:/android/ndk/toolchains/x86-4.6/prebuilt/windows/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.exe: error: cannot find -ldl collect2: ld returned 1 exit status ../../build/makefile.tbb:127: recipe target `libtbb.so' failed make[1]: *** [libtbb.so] error 1 make[1]: leaving directory `/cygdrive/d/opencv4android/workspace_july_2013/tbblib/jni/build/linux_ia32_gcc_android_cc4.6_release' jni/makefile:40: recipe target `tbb' failed make: *** [tbb] error 2
here android.mk file:
local_path := $(call my-dir) include $(clear_vars) local_module := libstdc++ local_src_files := libstdc++.so include $(prebuild_static_library) include $(clear_vars) ifeq (armeabi-v7a,$(app_abi)) export sysroot:=$(ndk_root)/platforms/$(app_platform)/arch-arm else export sysroot:=$(ndk_root)/platforms/$(app_platform)/arch-$(app_abi) endif ifeq (windows,$(tbb_os)) export cpath_separator :=; else export cpath_separator :=: endif export cpath := $(ndk_root)/sources/cxx-stl/gnu-libstdc++/$(ndk_toolchain_version)/include$(cpath_separator)$(ndk_root)/sources/cxx-stl/gnu-libstdc++/$(ndk_toolchain_version)/libs/$(app_abi)/include export lib_gnu_stl_android := $(ndk_root)/sources/cxx-stl/gnu-libstdc++/$(ndk_toolchain_version)/libs/$(app_abi) export cplus_lib_path := $(sysroot)/usr/lib -l$(lib_gnu_stl_android) export android_ndk_root:=$(ndk_root) export target_os_version:=$(app_platform) export tbb_tool_prefix:=$(toolchain_prefix) local_cflags += -dtbb_use_gcc_builtins -std=c++11 local_c_includes := $(ndk_project_path)/jni/include local_c_includes += $(ndk_project_path)/jni/include/tbb local_c_includes += $(ndk_project_path)/jni/src/rml/include local_c_includes += $(ndk_project_path)/jni/include/serial/tbb cppflags +="-i$(ndk_root)/platforms/android-9/arch-x86/usr/include/" \ cflags="-nostdlib" \ ldflags="-wl,-rpath-link=$(ndk_root)/platforms/android-9/arch-x86/usr/lib/ -l$(ndk_root)/platforms/android-9/arch-x86/usr/lib/" \ libs="-lc" local_path := $(ndk_project_path)/jni/src/tbb local_module := tbb #export make_path=d:/android/ndk/prebuilt/windows/bin include $(ndk_project_path)/jni/makefile #local_src_files := concurrent_hash_map.cpp concurrent_vector.cpp dynamic_link.cpp itt_notify.cpp cache_aligned_allocator.cpp queuing_mutex.cpp queuing_rw_mutex.cpp reader_writer_lock.cpp spin_rw_mutex.cpp spin_mutex.cpp critical_section.cpp tbb_misc.cpp tbb_misc_ex.cpp mutex.cpp recursive_mutex.cpp condition_variable.cpp concurrent_monitor.cpp semaphore.cpp rml_tbb.cpp tbb_statistics.cpp tbb_thread.cpp governor.cpp market.cpp arena.cpp scheduler.cpp observer_proxy.cpp pipeline.cpp tbb_thread.cpp private_server.cpp task_group_context.cpp task.cpp tbb_main.cpp include $(build_shared_library)
here application.mk file:
export tbb_os?=linux export compiler?=gcc export arch?=ia32 export target?=android ifeq (arm,$(arch)) app_abi:=armeabi-v7a else app_abi:=x86 endif app_platform:=android-9 ndk_toolchain_version:=4.6 app_stl :=gnustl_shared
please let me know if should add other file here let understand issue.
multiple libraries cannot found. try find out these libraries located on system.
in makefile, path added ld_flags linker search:
-l$(ndk_root)/platforms/android-9/arch-x86/usr/lib/
first, check if required libraries can found there (e.g. libm.so)
if not, try find out whether somewhere else on system. on linux, libdl.so, libm.so etc. can found in /usr/lib64 (/usr/lib on 32-bit system). if find them, add path ldflags path above:
-l/path/to/libs
Comments
Post a Comment