错误:从android

时间:2015-12-25 08:24:57

标签: android cross-compiling

我正在尝试在dahdi-linux-complete-2.10.2 + 2.10.2 for android中编译工具。

我使用下面的android_configure.sh文件来执行./configure。它基于https://gist.github.com/nddrylliog/4688209

 #!/bin/sh
 export ANDROID_SDK=/home/aks/android4.2
 # I put all my dev stuff in herej
 export DEV_PREFIX=${ANDROID_SDK}/development/

# Don't forget to adjust this to your NDK path
#export ANDROID_NDK=${DEV_PREFIX}/ndk/

export CROSS_COMPILE=arm-linux-androideabi

# I chose the gcc-4.7 toolchain - works fine for me##!
export ANDROID_PREFIX=${ANDROID_SDK}/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6

# Apparently android-8 works fine, there are other versions, look them up
export SYSROOT=${ANDROID_SDK}/prebuilts/ndk/8/platforms/android-9/arch-arm

#export CROSS_PATH=/home/androida20/a20_rbox/lichee/out/android/common/buildroot/external-toolchain/arm-linux-gnueabi/bin

# Non-exhaustive lists of compiler + binutils
# Depending on what you compile, you might need more binutils than that
export CPP=${CROSS_PATH}-cpp
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib

# This is just an empty directory where I want the built objects to be installed
export PREFIX=${HOME}/android-prefix

# Don't mix up .pc files from your host and build target
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig

# You can clone the full Android sources to get bionic if you want.. I didn't
# want to so I just got linker.h from here: http://gitorious.org/0xdroid/bionic
# Note that this was only required to build boehm-gc with dynamic linking support.
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${ANDROID_SDK}/bionic"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} --sysroot=${SYSROOT} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib" 
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} --prefix=${PREFIX} --with-dahdi=../linux "$@"

要编译我在命令下运行

./android_configure.sh
make

制作显示以下错误

error: cannot find -lpthread

以下是来自make

的最后一条错误消息
/home/androida20/a20_rbox/android4.2/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc --sysroot=/home/androida20/a20_rbox/android4.2/prebuilts/ndk/8/platforms/android-9/arch-arm -L/home/androida20/a20_rbox/android4.2/prebuilts/ndk/8/platforms/android-9/arch-arm/usr/lib -L/home/androida20/a20_rbox/android4.2/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/lib dahdi_cfg.o version.o libtonezone.a -lm -lpthread -o dahdi_cfg
/home/androida20/a20_rbox/android4.2/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpthread
collect2: ld returned 1 exit status
make: *** [dahdi_cfg] Error 1

对此方面的任何帮助表示赞赏。在此先感谢

1 个答案:

答案 0 :(得分:0)

在android中它使用bionic,它有自己的pthread实现,所以从makefile中删除-lpthread后,就可以编译了。