我尝试为armv7,armv7s和arm64交叉编译leptonica 1.69。
对于模拟器(i386,x86_64)我使用这些设置并且工作正常:
export IOS_BASE_SDK="7.1"
export IOS_DEPLOY_TGT="6.1"
export TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator$IOS_BASE_SDK.sdk
export CFLAGS="-arch x86_64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
export CPP=$TOOLCHAIN/usr/bin/cpp
export CXX=$TOOLCHAIN/usr/bin/c++
export CXXCPP=$TOOLCHAIN/usr/bin/cpp
export CC=$TOOLCHAIN/usr/bin/cc
export LD=$TOOLCHAIN/usr/bin/ld
export AR=$TOOLCHAIN/usr/bin/ar
export AS=$TOOLCHAIN/usr/bin/as
export NM=$TOOLCHAIN/usr/bin/nm
export RANLIB=$TOOLCHAIN/usr/bin/ranlib
export LDFLAGS="-L$SDKROOT/usr/lib/"
export CPPFLAGS="-no-cpp-precomp -I$SDKROOT/usr/include/"
export CXXFLAGS=$CFLAGS
然后调用configure
./configure --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff --libdir=$PWD/lib/nodebug
现在为arm构建它我尝试使用这些设置:(将-arch添加到CFLAGS和CPPFLAGS,设置SDK根目录并添加--host = x86_64)
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
export CPPFLAGS="-arch armv7 -no-cpp-precomp -I$SDKROOT/usr/include/"
./configure --host=x86_64 --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff --libdir=$PWD/lib/nodebug
但不知何故,cpp不起作用。配置日志说明如下:
configure:5841: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cpp -arch armv7 -no-cpp-precomp -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/include/ conftest.c
clang: error: no input files
任何想法有什么不对?或者任何想法如何进一步调试?
答案 0 :(得分:0)
似乎我的编译器,预处理器等路径出错了。仅使用路径中的默认值。因此删除以下部分解决了我的问题:
export CPP=$TOOLCHAIN/usr/bin/cpp
export CXX=$TOOLCHAIN/usr/bin/c++
export CXXCPP=$TOOLCHAIN/usr/bin/cpp
export CC=$TOOLCHAIN/usr/bin/cc
export LD=$TOOLCHAIN/usr/bin/ld
export AR=$TOOLCHAIN/usr/bin/ar
export AS=$TOOLCHAIN/usr/bin/as
export NM=$TOOLCHAIN/usr/bin/nm
export RANLIB=$TOOLCHAIN/usr/bin/ranlib
export LDFLAGS="-L$SDKROOT/usr/lib/"