首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在OS X上编译libjpeg-turbo for Android?

如何在OS X上编译libjpeg-turbo for Android?
EN

Stack Overflow用户
提问于 2015-07-16 21:39:01
回答 1查看 480关注 0票数 0

我正在尝试为OS X上的Android构建libjpeg-turbo。以下是我正在使用的脚本:

代码语言:javascript
复制
# Set these variables to suit your needs
NDK_PATH=/Users/***/android_ndk
BUILD_PLATFORM="darwin-x86_64"
TOOLCHAIN_VERSION="4.9"
ANDROID_VERSION="14"

HOST=arm-linux-androideabi
TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include"
ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
  -fstrict-aliasing --sysroot=${SYSROOT} "

export CROSS_COMPILE=arm-linux-androideabi
export CC=${CROSS_COMPILE}-gcc
export CXX=${CROSS_COMPILE}-g++

export CPP=${TOOLCHAIN}/bin/${HOST}-cpp
export AR=${TOOLCHAIN}/bin/${HOST}-ar
export AS=${TOOLCHAIN}/bin/${HOST}-as
export NM=${TOOLCHAIN}/bin/${HOST}-nm
export CC=${TOOLCHAIN}/bin/${HOST}-gcc
export LD=${TOOLCHAIN}/bin/${HOST}-ld
export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
cd .
sh ./configure --host=${HOST} \
  CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3" \
  CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \
  LDFLAGS="${ANDROID_CFLAGS}" --with-simd ${1+"$@"}
make  

下面是输出:

代码语言:javascript
复制
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for arm-linux-androideabi-strip... /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip
checking for style of include used by make... GNU
checking for arm-linux-androideabi-gcc... /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc accepts -g... yes
checking for /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc option to accept ANSI C... none needed
checking dependency style of /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc... gcc3
checking how to run the C preprocessor... /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-cpp
checking for arm-linux-androideabi-gcc... (cached) /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc accepts -g... (cached) yes
checking for /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc option to accept ANSI C... (cached) none needed
checking dependency style of /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc... (cached) gcc3
checking whether /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc and cc understand -c and -o together... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-apple-darwin14.4.0
checking host system type... arm-unknown-linux-androideabi
checking for a sed that does not truncate output... /usr/bin/sed
checking for egrep... grep -E
checking for ld used by /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc... /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ld
checking if the linker (/Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ld) is GNU ld... yes
checking for /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ld option to reload object files... -r
checking for BSD-compatible nm... /Users/***/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for arm-linux-androideabi-g++... arm-linux-androideabi-g++
checking whether we are using the GNU C++ compiler... no
checking whether arm-linux-androideabi-g++ accepts -g... no
checking dependency style of arm-linux-androideabi-g++... none
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make: *** No targets specified and no makefile found.  Stop.

可能的原因是什么?我遗漏了什么?

EN

回答 1

Stack Overflow用户

发布于 2015-07-16 22:40:26

您需要将CPP从${TOOLCHAIN}/bin/${HOST}-cpp更改为$CC ${ANDROID_CFLAGS} -E

代码语言:javascript
复制
export CPP="$CC ${ANDROID_CFLAGS} -E"
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31455856

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档