2

参考别人的话题,我这样做:

export ANDROID_ROOT=/home/jean/android-ndk-r8e
export PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86/bin/
./configure --host=arm-linux-androideabi CC=arm-linux-androideabi-gcc CPPFLAGS="-I$ANDROID_ROOT/platforms/android-9/arch-arm/usr/include/ -I$ANDROID_ROOT/sources/cxx-stl/gnu-libstdc++/4.7/include" CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/android-9/arch-arm/usr/lib/ -L$ANDROID_ROOT/platforms/android-9/arch-arm/usr/lib/" LIBS="-lc"

配置成功,但是报错,提示cannot find bits/c++config.h in include path,我搜索这个文件,发现它位于android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/ 4.7/libs/armeabi/include/bits,所以我将它复制到 android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/include 并再次制作,另一个错误:

/bin/bash ../libtool  --tag=CXX   --mode=compile arm-linux-androideabi-g++ -DHAVE_CONFIG_H -I. -I..   -I/home/jean/android-ndk-r8e/platforms/android-9/arch-arm/usr/include/ -I/home/jean/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/include  -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -MT common.lo -MD -MP -MF .deps/common.Tpo -c -o common.lo `test -f 'google/protobuf/stubs/common.cc' || echo './'`google/protobuf/stubs/common.cc
libtool: compile:  arm-linux-androideabi-g++ -DHAVE_CONFIG_H -I. -I.. -I/home/jean/android-ndk-r8e/platforms/android-9/arch-arm/usr/include/ -I/home/jean/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/include -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -MT common.lo -MD -MP -MF .deps/common.Tpo -c google/protobuf/stubs/common.cc  -fPIC -DPIC -o .libs/common.o
../libtool: line 1125: arm-linux-androideabi-g++: command not found
make[2]: *** [common.lo] Error 1

这很奇怪,我已将 arm-linux-androideabi-g++ 路径添加到 PATH 并输入“arm-linux-androideabi-g++ --version”它有效,为什么 make 找不到它?

顺便说一句,如果我使用 sudo 执行配置或更改为超级用户,配置将报告错误。错误是:

checking for arm-linux-androideabi-gcc... arm-linux-androideabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/jean/Dev/cpplibs/protobuf-2.5.0':
configure: error: C compiler cannot create executables
4

1 回答 1

0

您需要添加:

CXX=arm-linux-androideabi-g++

至少你的论点configure。您可能还需要添加一些广告CXXFLAGS

于 2013-06-08T17:34:18.157 回答