[gdal-dev] Build GDAL on iOS for iPhone

Jesse Crocker jesse at gaiagps.com
Mon Aug 22 06:00:45 PDT 2016


Hi Gane,
Here is a link to my gdal iOS build script, last tested with 1.11.2, but it
should still work with newer 1.11.x releases,
https://gist.github.com/JesseCrocker/22eee94485bce5b3a6ea

-
Jesse


On Fri, Aug 19, 2016 at 1:15 AM, Gane R <gane.prog at gmail.com> wrote:

> Hi all,
>
> I had a change to see the link
> http://stackoverflow.com/questions/12643898/incorporating-gdal-ogr-into-
> an-ios-project-a-quick-guide
>
> This was guiding to build with Xcode 4.0, the above link says that it
> doesn't work with Xcode version above 4.0
>
> I just wanted to build GDAL as static library for iPhone and use the OGR
> library there in iPhone.
>
> I modified the build script as shown here, build_gdal_ios_cus.sh
>
> #!/bin/bash
> if [ "$#" -eq 0 ]
> then
>     echo "No parameters supplied"
> else
>     default_prefix="${HOME}/Documents/iOS_GDAL"
>     prefix="${default_prefix}"
>     if [ "$1" == "arm" ]
>     then
>         arch="armv7"
>     fi
>     if [ "$1" == "sim" ]
>     then
>         arch="i386"
>     fi
>     if [ "$2" == "iPhone" ]
>     then
>         export PATH=$PATH:/Users/w1/ctools
>         echo $PATH
>         #extra_cflags="-m${thumb_opt:-no-thumb} -mthumb-interwork"
>         platform="iPhone"
>         platform_dir="/Applications/Xcode.app/Contents/Developer/
> Toolchains/XcodeDefault.xctoolchain"
>         platform_bin_dir="${platform_dir}/usr/bin"
>         platform_sdk_dir="/Applications/Xcode.app/
> Contents/Developer/Platforms/iPhoneOS.platform/Developer/
> SDKs/iPhoneOS.sdk/"
>         prefix="${prefix}/${arch}/${platform}.platform/iPhoneOS.sdk"
>         echo library will be exported to $prefix
>         #export CC="${platform_bin_dir}/clang"
>         export INCDIR="/Applications/Xcode.app/Contents/Developer/
> Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include"
>         export INCDIR1="/Applications/Xcode.app/Contents/Developer/
> Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
> usr/include/c++/4.2.1/tr1"
>         export INCDIRCPP="/Applications/Xcode.app/Contents/Developer/
> Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
> usr/include/c++/4.2.1"
>         #export CFLAGS="-std=gnu99 -nostdinc -I${INCDIR} -I${INCDIRCPP}
> -I${INCDIR1} -arch ${arch} -pipe -Os -gdwarf-2 -isysroot
> ${platform_sdk_dir}"
>         export CFLAGS="-std=gnu99 -nostdinc -I${INCDIR} -I${INCDIR1} -arch
> ${arch} -pipe -Os -gdwarf-2 -isysroot ${platform_sdk_dir}"
>         export LDFLAGS="-arch ${arch} -isysroot ${platform_sdk_dir}"
>         export CXXFLAGS="-stdlib=libstdc++ -nostdinc++ -I${INCDIR}
> -I${INCDIRCPP} -arch ${arch} -pipe -Os -gdwarf-2 -isysroot
> ${platform_sdk_dir}"
>     fi
>     if [ "$1" == "sim" ]
>     then
>         platform="iPhoneSimulator"
>     fi
>     ./configure \
>         --prefix="${prefix}" \
>         --host="${arch}-apple-darwin" \
>         --disable-shared \
>         --enable-static \
>         --with-unix-stdio-64=no
> fi
>
>
> I created symbolic links to
>  armv7-apple-darwin-gcc -> /usr/bin/llvm-gcc
>  armv7-apple-darwin-g++ -> /usr/bin/llvm-g++
>
> Actually points
>  llvm-g++ -> clang++
>  llvm-gcc -> clang
>
> Above script was invoked as
> ./build_gdal_ios_cus.sh arm iPhone
>
> Configure succeeded.
>
> when I run
>
> make
> I get error like this
>
> (cd alg; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
> /bin/sh /Users/w1/gdal-2.1.0/libtool --mode=compile --tag=CC
> armv7-apple-darwin-gcc -I/Users/w1/gdal-2.1.0/port
> -I/Users/w1/gdal-2.1.0/gcore -I/Users/w1/gdal-2.1.0/alg
> -I/Users/w1/gdal-2.1.0/ogr -I/Users/w1/gdal-2.1.0/ogr/ogrsf_frmts
> -I/Users/w1/gdal-2.1.0/gnm -I/Users/w1/gdal-2.1.0/apps -std=gnu99 -nostdinc
> -I/Applications/Xcode.app/Contents/Developer/Platforms/
> iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
> -I/Applications/Xcode.app/Contents/Developer/Platforms/
> iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/tr1
> -arch armv7 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/
> Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
> -Wall -Wdeclaration-after-statement -Wextra -Winit-self -Wunused-parameter
> -Wmissing-prototypes -Wmissing-declarations -Wformat
> -Werror=format-security -Wno-format-nonliteral -Wshorten-64-to-32 -Wshadow
> -Werror=vla -Wdeclaration-after-statement -Wnull-dereference
> -DINTERNAL_QHULL -Ilibqhull -DOGR_ENABLED -I/Users/w1/gdal-2.1.0/port
> -DGDAL_COMPILATION  -c -o delaunay.lo delaunay.c
> libtool: compile:  armv7-apple-darwin-gcc -I/Users/w1/gdal-2.1.0/port
> -I/Users/w1/gdal-2.1.0/gcore -I/Users/w1/gdal-2.1.0/alg
> -I/Users/w1/gdal-2.1.0/ogr -I/Users/w1/gdal-2.1.0/ogr/ogrsf_frmts
> -I/Users/w1/gdal-2.1.0/gnm -I/Users/w1/gdal-2.1.0/apps -std=gnu99 -nostdinc
> -I/Applications/Xcode.app/Contents/Developer/Platforms/
> iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
> -I/Applications/Xcode.app/Contents/Developer/Platforms/
> iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/tr1
> -arch armv7 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/
> Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
> -Wall -Wdeclaration-after-statement -Wextra -Winit-self -Wunused-parameter
> -Wmissing-prototypes -Wmissing-declarations -Wformat
> -Werror=format-security -Wno-format-nonliteral -Wshorten-64-to-32 -Wshadow
> -Werror=vla -Wdeclaration-after-statement -Wnull-dereference
> -DINTERNAL_QHULL -Ilibqhull -DOGR_ENABLED -I/Users/w1/gdal-2.1.0/port
> -DGDAL_COMPILATION -c delaunay.c -o delaunay.o
> In file included from delaunay.c:62:
> In file included from /w1/gdal-2.1.0/alg/internal_qhull_headers.h:977:
> libqhull/libqhull.c:64:34: error: use of undeclared identifier 'DBL_MAX'
>   if (qh RERUN || qh JOGGLEmax < REALmax/2)
>                                  ^
> libqhull/user.h:145:17: note: expanded from macro 'REALmax'
> #define REALmax DBL_MAX
>                 ^
> In file included from delaunay.c:62:
> In file included from /w1/gdal-2.1.0/alg/internal_qhull_headers.h:977:
> libqhull/libqhull.c:301:37: error: use of undeclared identifier 'DBL_MAX'
>     if (!qh RERUN && qh JOGGLEmax < REALmax/2) {
>                                     ^
> libqhull/user.h:145:17: note: expanded from macro 'REALmax'
> #define REALmax DBL_MAX
>                 ^
> In file included from delaunay.c:62:
> In file included from /w1/gdal-2.1.0/alg/internal_qhull_headers.h:977:
> libqhull/libqhull.c:325:49: error: use of undeclared identifier 'DBL_MAX'
>       if (qh TRACEpoint != -1 || qh TRACEdist < REALmax/2 || qh
> TRACEmerge) {
>                                                 ^
> libqhull/
>
> It seems that the float.h or cfloat does't have such definition or
> implementation for arm target
>
> Questions:
>
> 1. Can we build GDAL for iPhone with arm7 targert ??
>
> 2. Did I have missed or misconfigured something ???
>
> Any suggestion or references on web will be of great help.
>
> Thanks
> Gane
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160822/f63cb232/attachment.html>


More information about the gdal-dev mailing list