Hi GDAL devs,

As per my earlier emails, I’m attempting to build GDAL 3.5 for iOS.  The 
complete process (so far) for this is below, at the end of this email.

A quick summary of some relevant points is:
•  Using a 3rd party cmake toolchain file which caters for iOS, macOS (as well 
as other Apple OSs) and can even build a fat binary that works for both iOS 
device and simulator (arm64/x86_64).
•  Using a 3rd party mirror of SQLite which includes cmake configuration, so 
that I can incorporate the same methodology to build iOS SQLite that I’m using 
for other dependencies (the standard Apple bundled SQLite throws an error when 
building GDAL)

The 'cmake <options> ..’ succeeds to configure the GDAL build.  However, when I 
run ‘cmake —build .’ I get the following output:

==========
[  0%] Built target generate_gdal_version_h
[  0%] Building CXX object apps/CMakeFiles/appslib.dir/gdalinfo_lib.cpp.o
[  0%] Building CXX object apps/CMakeFiles/appslib.dir/gdalbuildvrt_lib.cpp.o
[  1%] Building CXX object apps/CMakeFiles/appslib.dir/gdal_grid_lib.cpp.o
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/apps/gdal_grid_lib.cpp:1213:26:
 error: variable has incomplete type 'VSIStatBufL' (aka 'stat64')
            VSIStatBufL  sStat;
                         ^
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsi.h:195:16:
 note: forward declaration of 'stat64'
typedef struct VSI_STAT64_T VSIStatBufL;
               ^
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:41:22:
 note: expanded from macro 'VSI_STAT64_T'
#define VSI_STAT64_T stat64
                     ^
1 error generated.
make[2]: *** [apps/CMakeFiles/appslib.dir/gdal_grid_lib.cpp.o] Error 1
make[1]: *** [apps/CMakeFiles/appslib.dir/all] Error 2
make: *** [all] Error 2
==========

I found a GDAL bug that appears to be related, but it was closed as ‘fixed’ 
about 8 years ago:
https://trac.osgeo.org/gdal/ticket/1005

This may also be relevant:
https://www.spinics.net/lists/dash/msg02117.html

But this is somewhat beyond my (lack of) expertise to resolve.  Does anybody 
have any suggestions for resolving this issue?

Cheers,
Nik.


COMPLETE PROCESS TO BUILD iOS GDAL (so far):


Install Homebrew package manager:
/usr/bin/ruby -e "$(curl -fsSL 
https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install cmake using Homebrew:
brew install cmakecmake --build . --target install

Install ios.toolchain.cmake:
Download from:  https://github.com/leetal/ios-cmake
Install at:  
$HOME/Documents/Development/3rdParty/ios-cmake-master/ios.toolchain.cmake

Environment Variables:
export PREFIX=$HOME/build/arm64
export 
CMTOOLCHAIN=$HOME/Documents/Development/3rdParty/ios-cmake-master/ios.toolchain.cmake

Build SQLite:
Download CMAKE-compatible SQLite amalgamation from:
https://github.com/azadkuh/sqlite-amalgamation

cd sqlite-amalgamation-master
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$CMTOOLCHAIN -DPLATFORM=OS64 
-DCMAKE_INSTALL_PREFIX=$PREFIX -DSQLITE_ENABLE_RTREE=ON ..
cmake --build .
cmake --build . --target install

Build Proj:
cd proj-{VERSION}
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$CMTOOLCHAIN -DPLATFORM=OS64 
-DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_TIFF=OFF -DENABLE_CURL=OFF 
-DBUILD_PROJSYNC=OFF -DSQLITE3_INCLUDE_DIR=$PREFIX/include 
-DSQLITE3_LIBRARY=$PREFIX/lib/libsqlite3.a ..
cmake --build .
cmake --build . --target install

Build GDAL:
(Specifying the path to PROJ is not required because cmake automatically adds 
CMAKE_INSTALL_PREFIX to CMAKE_SYSTEM_PREFIX_PATH

cd gdal-{VERSION}
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$CMTOOLCHAIN -DPLATFORM=OS64 
-DCMAKE_INSTALL_PREFIX=$PREFIX/arm64 -DBUILD_APPS=OFF -DBUILD_SHARED_LIBS=OFF 
-DBUILD_PYTHON_BINDINGS=OFF -DSQLITE3_INCLUDE_DIR=$PREFIX/include 
-DSQLITE3_LIBRARY=$PREFIX/lib/libsqlite3.a -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --build . --target install
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to