我需要为android编译mpich,我使用NDK arm-linux-andoirdeabi-4.8工具链来交叉编译mpi,我做了以下
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
但我收到以下错误:
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
当我添加-lpthread
时LIBS="-lc -lgcc -lpthread"
它没有编译
checking whether the C compiler works... no
configure: error: C compiler cannot create executables
答案 0 :(得分:2)
Android的特殊之处在于它实现了pthread,但没有单独的libpthread.a。简单的解决方法是add an empty library to your toolchain usr/lib
$AR q $SYS_ROOT/usr/lib/libpthread.a
在运行./configure
答案 1 :(得分:0)
对于libpthread问题,您有2个选项。
或
cd $ SYSROOT / usr / lib
ln -s libc.a libpthread.a