跨采用了Android工具链编译 [英] cross compiling using Android toolchains
本文介绍了跨采用了Android工具链编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要编译为Android MPICH,我使用NDK臂Linux的andoirdeabi-4.8工具链交叉编译MPI,我做了以下
出口PATH =$ NDK_ROOT /工具链/ ARM-Linux的androideabi-4.8 / prebuilt / Linux的x86_64的/ bin中/:$ PATH
出口SYS_ROOT =$ NDK_ROOT /平台/ Android的-8 /弓臂/
出口CC =臂Linux的androideabi-GCC --sysroot = $ SYS_ROOT
出口LD =臂Linux的androideabi-LD
出口AR =臂Linux的androideabi-AR
的./configure主机=臂Linux的androideabi - preFIX = / Crosscompile2 / JNI / MPICH / LIBS = - LC -lgcc--disable共享--disable-FORTRAN --disable-CXX
但我得到了以下错误:
在-lpthread检查pthread_key_create ...没有
检查点检查库...配置:错误:pthread的需要检查点,但没有被发现
配置:错误:SRC / PM /九头蛇配置失败
当我加-lpthread
LIBS = - LC -lgcc -lpthread
它没有编译
检查C编译器是否工作......没有
配置:错误:C编译器不能创建可执行文件
解决方案
Android是特殊的,因为它实现pthreads的,但没有一个单独的libpthreads.a。最简单的解决方法是空库添加到您的工具链 usr / lib目录
$阿Q $ SYS_ROOT / usr / lib目录/的libpthreads.a
运行前./配置
I need to compile mpich for android , I used NDK arm-linux-andoirdeabi-4.8 toolchain to cross compile mpi , I did the following
export PATH="$NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/:$PATH"
export SYS_ROOT="$NDK_ROOT/platforms/android-8/arch-arm/"
export CC="arm-linux-androideabi-gcc --sysroot=$SYS_ROOT"
export LD="arm-linux-androideabi-ld"
export AR="arm-linux-androideabi-ar"
./configure --host=arm-linux-androideabi --prefix=/Crosscompile2/jni/mpich/ LIBS="-lc -lgcc " --disable-shared --disable-fortran --disable-cxx
but I got the following error:
checking for pthread_key_create in -lpthread... no
checking checkpointing library... configure: error: pthreads is required for checkpointing, but was not found
configure: error: src/pm/hydra configure failed
when I added -lpthread
LIBS="-lc -lgcc -lpthread"
it didn't compile
checking whether the C compiler works... no
configure: error: C compiler cannot create executables
解决方案
Android is special in that it implements pthreads, but does not have a separate libpthread.a. The easy workaround is to add an empty library to your toolchain usr/lib
$AR q $SYS_ROOT/usr/lib/libpthread.a
before running ./configure
这篇关于跨采用了Android工具链编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文