我有问题移植并使用Android-ndk-r5b将增强库链接到Android。我首先使用以下步骤构建boost库:
#if [os.name] =“NT”{api = win32; }
androidNDKRoot = ../android-ndk-r5b;
使用gcc:android4.4.3:$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-g ++。exe:
--sysroot = $(androidNDKRoot)/平台/机器人-3 /拱形臂
-mthumb
-The
-fno严格混叠
-02
-DNDEBUG
-G
-fexceptions
-frtti
-lstdc ++
-I $(androidNDKRoot)/源/ CXX-STL / GNU-的libstdc ++ /包括
-I $(androidNDKRoot)/源/ CXX-STL / GNU-的libstdc ++ /库/ armeabi /包括
-D__GLIBC__
-DBOOST_NO_INTRINSIC_WCHAR_T
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ar.exe
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ranlib.exe
Linux的
;
bjam.exe --user-config = user-config.jam --without-python --without-mpi toolset = gcc-android4.4.3 link = static runtime-link = static target-os = linux --stagedir = android> d:\ out.txt
APP_STL:= gnustl_static
APP_PLATFORM:= android-3
APP_CPPFLAGS + = - 手表
APP_CPPFLAGS + = -Os
APP_CPPFLAGS + = -fno-strict-aliasing
APP_CPPFLAGS + = -O2
APP_CPPFLAGS + = -DNDEBUG
APP_CPPFLAGS + = -g
APP_CPPFLAGS + = -fexceptions
APP_CPPFLAGS + = -frtti
APP_CPPFLAGS + = -lstdc ++
APP_CPPFLAGS + = -D__GLIBC__
APP_CPPFLAGS + = -DBOOST_NO_INTRINSIC_WCHAR_T
APP_CPPFLAGS + = -L / cygdrive / d / Android / boost_1_46_0 / android / lib /
# 如何
# http://source.android.com/porting/build_cookbook.html
#
LOCAL_PATH:= $(call my-dir)
# ==============================================================
#libudt
# ==============================================================
包括$(CLEAR_VARS)
LOCAL_MODULE:= libudt
LOCAL_C_INCLUDES + = / cygdrive / d / Android / boost_1_46_0 /
LOCAL_SRC_FILES + = udt.cpp
LOCAL_STATIC_LIBRARIES:= boost_thread-gcc-mt-s-1_46
包括$(BUILD_SHARED_LIBRARY)
#include“boost / bind.hpp”
#include“boost / thread.hpp”
void thread_fn(int)
{
}
extern“C”int func1()
{
boost :: thread thrd(boost :: bind(thread_fn,1));
thrd.join();
返回0;
}
编译++ thumb:udt>>>':
D:/Android/boost_1_46_0/boost/thread/detail/thread.hpp:204:对`boost :: thread :: start_thread()'的未定义引用
D:/Android/boost_link/obj/local/armeabi/objs/udt/udt.o:函数`func1':
D:/Android/boost_link/jni/udt.cpp:19:未定义引用`boost :: thread :: join()'
D:/Android/boost_link/jni/udt.cpp:20:对`boost :: thread ::〜thread()'的未定义引用
D:/Android/boost_link/jni/udt.cpp:20:对`boost :: thread ::〜thread()'的未定义引用
d:/Android/boost_link/obj/local/armeabi/objs/udt/udt.o :( data.rel.ro._ZTIN5boost6detail11thread_dataINS_3_bi6bind_tIvPFv。
iENS2_5list1INS2_5valueIiEEEEEEEE [typeinfo for boost :: detail :: thread_data> >>] + 0x8):未定义的引用`typeinfo for boost :: detail :: thread_data_base'
collect2:ld返回1退出状态
make:*** [/cygdrive/d/Android/boost_link/obj/local/armeabi/libudt.so]错误1
发布于 2018-04-09 18:51:27
我们目前使用一些boost的部分,只需在库的makefile中包含相关的boost文件即可。
发布于 2018-04-09 20:14:52
我不知道你是否可以使用gcc,然后将静态库链接到Android平台。我所知道的是,所有东西都必须在NDK编译器下编译。
你可以使用这个:https: //github.com/MysticTreeGames/Boost-for-Android (.tar)
https://stackoverflow.com/questions/-100008026
复制相似问题