简体   繁体   中英

leptonica 1.69 crosscompile for iOS (armv7, armv7s and arm64)

I try to cross compile leptonica 1.69 for armv7, armv7s and arm64.

For simulator (i386, x86_64) I use these settings and it works fine:

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

And then call configure

./configure --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff --libdir=$PWD/lib/nodebug

Now to build it for arm I tried to use these settings: (adding -arch to CFLAGS and CPPFLAGS, setting the SDK root and adding --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

but somehow the cpp does not work. The config logs says the following:

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

Anyone any ideas what's wrong? Or any idea how to debug this further?

It seems that something with my paths to the compiler, preprocessors etc was wrong. Using just the default ones in the path works. So removing the following part solved my issue:

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/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM