The script on internet is both too old and has issues on compiling. I enhance it and it's suitable for XCode 7.3.1
#!/bin/sh # build.sh GLOBAL_OUTDIR="`pwd`/dependencies" LOCAL_OUTDIR="./outdir" LEPTON_LIB="`pwd`/leptonica-1.73" TIFF_LIB="`pwd`/tiff-4.0.6" TESSERACT_LIB="`pwd`/tesseract-3.04.01" IOS_BASE_SDK="9.3" IOS_DEPLOY_TGT="9.3" setenv_all() { # Add internal libs export CFLAGS="-O2 $CFLAGS -I$GLOBAL_OUTDIR/include -L$GLOBAL_OUTDIR/lib" export TOOLCHAINROOT=/Applications/Xcode731.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain export CXX="$TOOLCHAINROOT/usr/bin/clang" export CC="$TOOLCHAINROOT/usr/bin/clang" export LD=$TOOLCHAINROOT/usr/bin/ld export AR=$TOOLCHAINROOT/usr/bin/ar export AS=$TOOLCHAINROOT/usr/bin/as export NM=$TOOLCHAINROOT/usr/bin/nm export RANLIB=$TOOLCHAINROOT/usr/bin/ranlib export LDFLAGS="-L$SDKROOT/usr/lib -L/usr/local/lib -lz" # export LDFLAGS="-L/usr/lib/ -L$GLOBAL_OURDIR/lib -lz" export CPPFLAGS=$CFLAGS export CXXFLAGS=$CFLAGS } setenv_arm6() { unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS export DEVROOT=/Applications/Xcode731.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/" setenv_all echo "compile arm6" } setenv_arm7() { unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS export DEVROOT=//Applications/Xcode731.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/" setenv_all echo "compile arm7" } setenv_i386() { unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS export DEVROOT=/Applications/Xcode731.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator$IOS_BASE_SDK.sdk export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT" setenv_all echo "compile i386" } create_outdir_lipo() { echo "create_outdir_lipo" for lib_i386 in `find $LOCAL_OUTDIR/i386 -name "lib*\.a"`; do #lib_arm6=`echo $lib_i386 | sed "s/i386/arm6/g"` lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"` lib=`echo $lib_i386 | sed "s/i386\///g"` #lipo -arch armv6 $lib_arm6 -arch armv7 $lib_arm7 -arch i386 $lib_i386 -create -output $lib lipo -arch armv7 $lib_arm7 -arch i386 $lib_i386 -create -output $lib done } merge_libfiles() { DIR=$1 LIBNAME=$2 cd $DIR for i in `find . -name "lib*.a"`; do $AR -x $i done $AR -r $LIBNAME *.o rm -rf *.o __* cd - } ####################### # LIBTIFF ####################### #cd $TIFF_LIB #rm -rf $LOCAL_OUTDIR #mkdir -p $LOCAL_OUTDIR/arm6 $LOCAL_OUTDIR/arm7 $LOCAL_OUTDIR/i386 # ##make clean 2> /dev/null ##make distclean 2> /dev/null ##setenv_arm6 ##./configure --host=arm-apple-darwin6 --enable-shared=no --prefix=`pwd`/$LOCAL_OUTDIR/arm6 ##make -j4 ##make install # #make clean 2> /dev/null #make distclean 2> /dev/null #setenv_arm7 #./configure --host=arm-apple-darwin7 --enable-shared=no --prefix=`pwd`/$LOCAL_OUTDIR/arm7 #make -j4 #make install # #make clean 2> /dev/null #make distclean 2> /dev/null #setenv_i386 #./configure --host=x86_64 --enable-shared=no --prefix=`pwd`/$LOCAL_OUTDIR/i386 #make -j4 #make install # ## since we're installing the libraries into LOCAL_OUTDIR/<arch>/lib ## create_outdir_lipo will try to put them in LOCAL_OUTDIR/lib #mkdir -p $LOCAL_OUTDIR/lib #create_outdir_lipo #mkdir -p $GLOBAL_OUTDIR/include && cp -rvf $LOCAL_OUTDIR/i386/include/*.h $GLOBAL_OUTDIR/include #mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib/lib*.a $GLOBAL_OUTDIR/lib #cd .. ####################### # LEPTONLIB ####################### #cd $LEPTON_LIB #rm -rf $LOCAL_OUTDIR #mkdir -p $LOCAL_OUTDIR/arm6 $LOCAL_OUTDIR/arm7 $LOCAL_OUTDIR/i386 ## ##make clean 2> /dev/null ##make distclean 2> /dev/null ##setenv_arm6 ##./configure --host=arm-apple-darwin6 --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --with-libtiff ##make -j4 ##cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/arm6 # #make clean 2> /dev/null #make distclean 2> /dev/null #setenv_arm7 #./configure --host=arm-apple-darwin7 --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --with-libtiff #make -j4 #cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/arm7 # #make clean 2> /dev/null #make distclean 2> /dev/null #setenv_i386 #./configure --host=x86_64 --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --with-libtiff #make -j4 #cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/i386 # #create_outdir_lipo #mkdir -p $GLOBAL_OUTDIR/include/leptonica && cp -rvf src/*.h $GLOBAL_OUTDIR/include/leptonica #mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib*.a $GLOBAL_OUTDIR/lib #cd .. ####################### # TESSERACT-OCR (v3) ####################### cd $TESSERACT_LIB rm -rf $LOCAL_OUTDIR mkdir -p $LOCAL_OUTDIR/arm6 $LOCAL_OUTDIR/arm7 $LOCAL_OUTDIR/i386 #make clean 2> /dev/null #make distclean 2> /dev/null #setenv_arm6 #export LDFLAGS="$LDFLAGS -ltiff" #bash autogen.sh #echo $CC ##export LIBLEPT_HEADERSDIR=/usr/local/include #./configure --host=arm-apple-darwin6 --enable-shared=no LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include/ ##./configure --host=arm-apple-darwin6 --enable-shared=no --prefix=`pwd`/$LOCAL_OUTDIR/arm7/ --with-extra-libraries=/usr/local/lib LIBLEPT_HEADERSDIR=/usr/local/include #make -j4 #for i in `find . -name "lib*.a"`; do cp -rvf $i $LOCAL_OUTDIR/arm6; done #merge_libfiles $LOCAL_OUTDIR/arm6 libtesseract_all.a #echo "Buidl for arm6" make clean 2> /dev/null make distclean 2> /dev/null setenv_arm7 export LDFLAGS="$LDFLAGS -ltiff" bash autogen.sh export LIBLEPT_HEADERSDIR=/usr/local/include ./configure --host=arm-apple-darwin7 --enable-shared=no --prefix=/usr/local/ --with-extra-libraries=/usr/local/lib make -j4 for i in `find . -name "lib*.a" | grep -v arm`; do cp -rvf $i $LOCAL_OUTDIR/arm7; done merge_libfiles $LOCAL_OUTDIR/arm7 libtesseract_all.a echo "Buidl for arm7" make clean 2> /dev/null make distclean 2> /dev/null setenv_i386 export LDFLAGS="$LDFLAGS -ltiff" bash autogen.sh export LIBLEPT_HEADERSDIR=/usr/local/include ./configure --host=x86_64 --enable-shared=no --host=i386 --prefix=/usr/local/ --with-extra-libraries=/usr/local/lib make -j4 for i in `find . -name "lib*.a" | grep -v arm`; do cp -rvf $i $LOCAL_OUTDIR/i386; done merge_libfiles $LOCAL_OUTDIR/i386 libtesseract_all.a echo "Buidl for i386" create_outdir_lipo mkdir -p $GLOBAL_OUTDIR/include/tesseract tess_inc=( api/apitypes.h api/baseapi.h ccmain/thresholder.h ccstruct/publictypes.h ccutil/errcode.h ccutil/genericvector.h ccutil/helpers.h ccutil/host.h ccutil/ndminx.h ccutil/ocrclass.h ccutil/platform.h ccutil/tesscallback.h ccutil/unichar.h ) for i in "${tess_inc[@]}"; do cp -rvf $i $GLOBAL_OUTDIR/include/tesseract done mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib*.a $GLOBAL_OUTDIR/lib make clean 2> /dev/null make distclean 2> /dev/null rm -rf $LOCAL_OUTDIR cd .. echo "Finished!"
相关推荐
在这个"cross_compile.zip"压缩包中,我们可以看到相关的源代码和文档,这显然是关于在两种不同的架构上进行高级语言测试——aarch64和x86_64,这两种架构分别代表了ARM64(通常用于移动设备和服务器)和x86(常见的...
### Cross Compile OpenSSH for MIPS 在嵌入式系统的开发过程中,常常需要为特定的硬件平台构建定制化的软件组件。本文将详细介绍如何为MIPS架构的嵌入式设备交叉编译OpenSSH,以便能够在其上运行SFTP服务。由于...
修改过的将大部分github资源转为指向Gitee上的镜像的一个编译脚本,同时外网的下载资源也转化为指向了ftp://localhost/xxxx ,使用前可先自行下载这些...然后替换当中的cross_compile_ffmpeg.sh为本文件,运行,即可。
You need at least one of these or Tesseract will not work. Note that tesseract-x.xx.tar.gz unpacks to the tesseract-ocr directory. tesseract-x.xx.<lang>.tar.gz unpacks to the tessdata directory which...
Compile SQLite using the cross-compiler such as arm-linux-gcc first, get sqlite-3.3.6.tar.gz from www.sqlite.org unzip it, #tar -zxvf sqlite-3.3.6.tar.gz change into the sqlite-3.3.6 directory cd ...
ROS 跨平台编译,也就是 "ros cross compile",是ROS开发中的一个重要环节,它允许开发者在一种架构(如x86)上构建适用于另一种架构(如ARM)的ROS软件包。这对于在嵌入式设备如树莓派或者无人机等资源有限的硬件上...
6. **定制编译脚本**:`compile_ntp`脚本是整个过程的关键,它指导编译流程,包括设置环境变量,执行`configure`,运行`make`,以及可能的`make install`步骤。这个脚本可以被修改以适应不同的交叉编译需求。 7. **...
- **设置变量**:通过导出变量的方式设置CROSS_COMPILE、CC、ac_cv_func_strtod和tcl_cv_strtod_buggy等环境变量。 - **调用configure脚本**:通过调用`configure`脚本并传入一系列参数来完成配置,这些参数包括:...
./configure --target-os=mingw32 --arch=x86_64 --enable-cross-compile --prefix=<install_path> --extra-cflags='-static' --extra-ldflags='-static' ``` 其中,`<install_path>`是你希望安装ffplay的目录。 ...
该文件夹包含交叉编译OpenCV所需要的编译器和依赖库文件,下载即用。内容包含编译器arm-2014.05,依赖库ffmpeg、libjpeg、libpng、libx264、libxvid、yasm、zlib。需要编译
总的来说,交叉编译驱动模块涉及的关键点包括:理解Makefile的结构,设置正确的`KERNELDIR`以指向目标内核的构建环境,以及确保编译工具链(包括`ARCH`和`CROSS_COMPILE`)正确配置。这些步骤对于成功地在开发板上...
compile
./configure --prefix=/jamvm_arm --includedir=/jamvm_arm/include --libdir=/jamvm_arm/lib --with-classpath-install-dir=/classpath --host=arm-musleabi-cross-linux-gnueabi ``` 在这里,`/classpath` 是...
Pattern pattern = Pattern.compile("\\d+\\s*:\\s*(.*)"); Matcher matcher = pattern.matcher(recognizedText); while (matcher.find()) { String questionNum = matcher.group(1); // 对questionNum进行进一步...
标题"compile_protobuf_protobuf:compile_protobuf_"指的是使用protobuf编译器来处理.proto文件的过程。这个过程涉及到将.proto文件编译成特定编程语言(如C++、Java或Python)的源代码,以便在程序中使用protobuf...
从Mac到Linux交叉编译Rust 如何将Rust从macOS交叉编译到Linux x86_64-unknown-linux-gnu的示例背景/最初动机截至2020年11月,我macOS笔记本电脑上的使用来迭代Kubernetes集群更改,然后再将其应用于生产集群。...
`color-compile`是一个实用工具,它为`gcc/g++/make`编译过程中的错误、警告和提示信息添加了颜色高亮,使得输出更加醒目,从而帮助开发者更快地识别问题所在。在某些不支持颜色输出的系统上,这个工具尤其有用。 ...
《Design Compile 深度解析》 Design Compile是一款由Synopsys公司开发的高级综合工具,广泛应用于集成电路(IC)设计领域。它以其强大的功能和高效的优化能力,为芯片设计者提供了一站式的解决方案,帮助他们将...
一个简单的msbuild命令行使用demo,可直接编译项目,无论是解决方案(sln)还是csproj或者vbproj。msbuild真的非常好,有了它就不用打开笨重的visual studio了!如需实际使用,请执行填写项目相对路径(绝对路径也可以)...
cross compile for arm