我正在尝试从threadingbuildingblocks编译 TBB 源文件。
我已经在 stackoverflow 上尝试了所有可用的解决方案,但它们都不起作用。我得到的错误是:
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 for 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 for target `tbb' failed
make: *** [tbb] Error 2
这是我的 Android.mk 文件:
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)
这是我的 Application.mk 文件:
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
请让我知道我是否应该在此处添加其他文件以让您了解问题。