<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>(re-adding the list)</p>
    <p>ok, it's a bit weird CMake detects symbols that are not available
      at build time, but there might be some subtelties in iOS SDK<br>
    </p>
    <p>Can you try the following patch which basically forces to remap
      all "foo64" functions to "foo". I assume that iOS Unix I/O is
      64-bit enabled by default...<br>
    </p>
    <p>diff --git a/cmake/helpers/configure.cmake
      b/cmake/helpers/configure.cmake<br>
      index c38604e23e..e5be264bf9 100644<br>
      --- a/cmake/helpers/configure.cmake<br>
      +++ b/cmake/helpers/configure.cmake<br>
      @@ -241,6 +241,20 @@ else ()<br>
           set(VSI_FTRUNCATE64 "ftruncate")<br>
         endif ()<br>
       <br>
      +  if (${CMAKE_SYSTEM_NAME} MATCHES "iOS")<br>
      +    set(VSI_FOPEN64 "fopen")<br>
      +    set(VSI_FTRUNCATE64 "ftruncate")<br>
      +    set(VSI_FTELL64 "ftell")<br>
      +    set(VSI_FSEEK64 "fseek")<br>
      +    set(VSI_STAT64 stat)<br>
      +    set(VSI_STAT64_T stat)<br>
      +    unset(HAVE_FOPEN64)<br>
      +    unset(HAVE_FTRUNCATE64)<br>
      +    unset(HAVE_FTELL64)<br>
      +    unset(HAVE_FSEEK64)<br>
      +    unset(HAVE_STATVFS64)<br>
      +  endif()<br>
      +<br>
         set(UNIX_STDIO_64 TRUE)<br>
       <br>
         set(INCLUDE_XLOCALE_H)<br>
      <br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 05/07/2022 à 13:07, Nik Sands a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:33BE1262-EBE6-49A6-BF9D-232CF72294DC@nixanz.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="">Hi Even,</div>
      <div class=""><br class="">
      </div>
      <div class="">Thanks again for your advice.  The debug  message
        did produce what I believe was the expected output as follows:</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div class="">CMake Warning at cmake/helpers/configure.cmake:175
          (message):</div>
        <div class="">  CMAKE_SYSTEM_NAME=iOS</div>
      </div>
      <div class=""><br class="">
      </div>
      <div class="">Making the suggested change to the configure.cmake
        file (line 175 in the version 3.5 distribution I have) and
        re-building certainly progresses further than my previous build
        attempt.  I now get the errors in the ouput listed below.  Note
        that I found one other location in the same configure.cmake file
        where it was checking for “Darwin” and I made the same change to
        that line, but it made no difference to these errors below.</div>
      <div class=""><br class="">
      </div>
      <div class="">Cheers,</div>
      <div class="">Nik.</div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class="">==========</div>
      <div class="">…</div>
      <div class="">…</div>
      <div class="">
        <div class="">[  7%] Building CXX object
          port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:139:23:
          error: use of undeclared identifier 'ftell64'</div>
        <div class="">static_assert( sizeof(VSI_FTELL64(nullptr)) ==
          sizeof(vsi_l_offset),</div>
        <div class="">                      ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:152:21:
          note: expanded from macro 'VSI_FTELL64'</div>
        <div class="">#define VSI_FTELL64 ftell64</div>
        <div class="">                    ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:315:25:
          error: use of undeclared identifier 'fseek64'</div>
        <div class="">    const int nResult = VSI_FSEEK64( fp,
          nOffsetIn, nWhence );</div>
        <div class="">                        ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:149:21:
          note: expanded from macro 'VSI_FSEEK64'</div>
        <div class="">#define VSI_FSEEK64 fseek64</div>
        <div class="">                    ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:355:25:
          error: use of undeclared identifier 'ftell64'</div>
        <div class="">            m_nOffset = VSI_FTELL64( fp );</div>
        <div class="">                        ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:152:21:
          note: expanded from macro 'VSI_FTELL64'</div>
        <div class="">#define VSI_FTELL64 ftell64</div>
        <div class="">                    ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:422:13:
          error: use of undeclared identifier 'fseek64'</div>
        <div class="">        if( VSI_FSEEK64( fp, m_nOffset, SEEK_SET )
          != 0 )</div>
        <div class="">            ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:149:21:
          note: expanded from macro 'VSI_FSEEK64'</div>
        <div class="">#define VSI_FSEEK64 fseek64</div>
        <div class="">                    ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:456:35:
          error: use of undeclared identifier 'ftell64'</div>
        <div class="">        vsi_l_offset nNewOffset = VSI_FTELL64( fp
          );</div>
        <div class="">                                  ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:152:21:
          note: expanded from macro 'VSI_FTELL64'</div>
        <div class="">#define VSI_FTELL64 ftell64</div>
        <div class="">                    ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:484:13:
          error: use of undeclared identifier 'fseek64'</div>
        <div class="">        if( VSI_FSEEK64( fp, m_nOffset, SEEK_SET )
          != 0 )</div>
        <div class="">            ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:149:21:
          note: expanded from macro 'VSI_FSEEK64'</div>
        <div class="">#define VSI_FSEEK64 fseek64</div>
        <div class="">                    ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:532:12:
          error: use of undeclared identifier 'ftruncate64'; did you
          mean 'ftruncate'?</div>
        <div class="">    return VSI_FTRUNCATE64( fileno(fp), nNewSize
          );</div>
        <div class="">           ^~~~~~~~~~~~~~~</div>
        <div class="">           ftruncate</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:146:25:
          note: expanded from macro 'VSI_FTRUNCATE64'</div>
        <div class="">#define VSI_FTRUNCATE64 ftruncate64</div>
        <div class="">                        ^</div>
        <div class="">/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/usr/include/unistd.h:611:6:
          note: 'ftruncate' declared here</div>
        <div class="">int      ftruncate(int, off_t);</div>
        <div class="">         ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:645:16:
          error: use of undeclared identifier 'fopen64'; did you mean
          'fopen'?</div>
        <div class="">    FILE *fp = VSI_FOPEN64( pszFilename, pszAccess
          );</div>
        <div class="">               ^~~~~~~~~~~</div>
        <div class="">               fopen</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:143:21:
          note: expanded from macro 'VSI_FOPEN64'</div>
        <div class="">#define VSI_FOPEN64 fopen64</div>
        <div class="">                    ^</div>
        <div class="">/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/usr/include/stdio.h:153:7:
          note: 'fopen' declared here</div>
        <div class="">FILE    *fopen(const char * __restrict __filename,
          const char * __restrict __mode)
          __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0,
          __DARWIN_ALIAS(fopen));</div>
        <div class="">         ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:793:22:
          error: variable has incomplete type 'struct statvfs64'</div>
        <div class="">    struct statvfs64 buf;</div>
        <div class="">                     ^</div>
        <div class="">/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsil_unix_stdio_64.cpp:793:12:
          note: forward declaration of 'statvfs64'</div>
        <div class="">    struct statvfs64 buf;</div>
        <div class="">           ^</div>
        <div class="">9 errors generated.</div>
        <div class="">make[2]: ***
          [port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o] Error 1</div>
        <div class="">make[1]: *** [port/CMakeFiles/cpl.dir/all] Error 2</div>
        <div class="">make: *** [all] Error 2</div>
      </div>
      <div class="">==========</div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On 5 Jul 2022, at 5:00 pm, Even Rouault <<a
              href="mailto:even.rouault@spatialys.com"
              class="moz-txt-link-freetext" moz-do-not-send="true">even.rouault@spatialys.com</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <div class="">Nik,<br class="">
              <br class="">
              in cmake/helpers/configure.cmake, there's a special case
              of Darwin at line 183 in master<br class="">
              <br class="">
                if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")<br class="">
              <br class="">
              Can you test if replacing it with<br class="">
              <br class="">
                if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR
              ${CMAKE_SYSTEM_NAME} MATCHES "iOS")<br class="">
              <br class="">
              works better? (I assume CMAKE_SYSTEM_NAME = iOS from <a
                href="https://cmake.org/cmake/help/latest/variable/IOS.html"
                class="moz-txt-link-freetext" moz-do-not-send="true">https://cmake.org/cmake/help/latest/variable/IOS.html</a>
              , but you might want to add a 'message(WARNING
              "CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")' debug statement
              to check<br class="">
              <br class="">
              Even<br class="">
              <br class="">
              Le 05/07/2022 à 06:14, Nik Sands a écrit :<br class="">
              <blockquote type="cite" class="">Hi GDAL devs,<br class="">
                <br class="">
                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.<br class="">
                <br class="">
                A quick summary of some relevant points is:<br class="">
                •  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).<br class="">
                •  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)<br class="">
                <br class="">
                The 'cmake <options> ..’ succeeds to configure the
                GDAL build.  However, when I run ‘cmake —build .’ I get
                the following output:<br class="">
                <br class="">
                ==========<br class="">
                [  0%] Built target generate_gdal_version_h<br class="">
                [  0%] Building CXX object
                apps/CMakeFiles/appslib.dir/gdalinfo_lib.cpp.o<br
                  class="">
                [  0%] Building CXX object
                apps/CMakeFiles/appslib.dir/gdalbuildvrt_lib.cpp.o<br
                  class="">
                [  1%] Building CXX object
                apps/CMakeFiles/appslib.dir/gdal_grid_lib.cpp.o<br
                  class="">
/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')<br class="">
                            VSIStatBufL  sStat;<br class="">
                                         ^<br class="">
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/port/cpl_vsi.h:195:16:
                note: forward declaration of 'stat64'<br class="">
                typedef struct VSI_STAT64_T VSIStatBufL;<br class="">
                               ^<br class="">
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/build/port/cpl_config.h:41:22:
                note: expanded from macro 'VSI_STAT64_T'<br class="">
                #define VSI_STAT64_T stat64<br class="">
                                     ^<br class="">
                1 error generated.<br class="">
                make[2]: ***
                [apps/CMakeFiles/appslib.dir/gdal_grid_lib.cpp.o] Error
                1<br class="">
                make[1]: *** [apps/CMakeFiles/appslib.dir/all] Error 2<br
                  class="">
                make: *** [all] Error 2<br class="">
                ==========<br class="">
                <br class="">
                I found a GDAL bug that appears to be related, but it
                was closed as ‘fixed’ about 8 years ago:<br class="">
                <a href="https://trac.osgeo.org/gdal/ticket/1005"
                  class="moz-txt-link-freetext" moz-do-not-send="true">https://trac.osgeo.org/gdal/ticket/1005</a><br
                  class="">
                <br class="">
                This may also be relevant:<br class="">
                <a class="moz-txt-link-freetext" href="https://www.spinics.net/lists/dash/msg02117.html">https://www.spinics.net/lists/dash/msg02117.html</a><br
                  class="">
                <br class="">
                But this is somewhat beyond my (lack of) expertise to
                resolve.  Does anybody have any suggestions for
                resolving this issue?<br class="">
                <br class="">
                Cheers,<br class="">
                Nik.<br class="">
                <br class="">
                <br class="">
                COMPLETE PROCESS TO BUILD iOS GDAL (so far):<br class="">
                <br class="">
                <br class="">
                Install Homebrew package manager:<br class="">
                /usr/bin/ruby -e "$(curl -fsSL
                <a class="moz-txt-link-freetext" href="https://raw.githubusercontent.com/Homebrew/install/master/install">https://raw.githubusercontent.com/Homebrew/install/master/install</a>)"<br
                  class="">
                <br class="">
                Install cmake using Homebrew:<br class="">
                brew install cmakecmake --build . --target install<br
                  class="">
                <br class="">
                Install ios.toolchain.cmake:<br class="">
                Download from:  <a class="moz-txt-link-freetext" href="https://github.com/leetal/ios-cmake">https://github.com/leetal/ios-cmake</a><br
                  class="">
                Install at:
 $HOME/Documents/Development/3rdParty/ios-cmake-master/ios.toolchain.cmake<br
                  class="">
                <br class="">
                Environment Variables:<br class="">
                export PREFIX=$HOME/build/arm64<br class="">
                export
CMTOOLCHAIN=$HOME/Documents/Development/3rdParty/ios-cmake-master/ios.toolchain.cmake<br
                  class="">
                <br class="">
                Build SQLite:<br class="">
                Download CMAKE-compatible SQLite amalgamation from:<br
                  class="">
                <a class="moz-txt-link-freetext" href="https://github.com/azadkuh/sqlite-amalgamation">https://github.com/azadkuh/sqlite-amalgamation</a><br
                  class="">
                <br class="">
                cd sqlite-amalgamation-master<br class="">
                mkdir build<br class="">
                cd build<br class="">
                cmake -DCMAKE_TOOLCHAIN_FILE=$CMTOOLCHAIN
                -DPLATFORM=OS64 -DCMAKE_INSTALL_PREFIX=$PREFIX
                -DSQLITE_ENABLE_RTREE=ON ..<br class="">
                cmake --build .<br class="">
                cmake --build . --target install<br class="">
                <br class="">
                Build Proj:<br class="">
                cd proj-{VERSION}<br class="">
                mkdir build<br class="">
                cd build<br class="">
                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 ..<br
                  class="">
                cmake --build .<br class="">
                cmake --build . --target install<br class="">
                <br class="">
                Build GDAL:<br class="">
                (Specifying the path to PROJ is not required because
                cmake automatically adds CMAKE_INSTALL_PREFIX to
                CMAKE_SYSTEM_PREFIX_PATH<br class="">
                <br class="">
                cd gdal-{VERSION}<br class="">
                mkdir build<br class="">
                cd build<br class="">
                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 ..<br class="">
                cmake --build .<br class="">
                cmake --build . --target install<br class="">
                _______________________________________________<br
                  class="">
                gdal-dev mailing list<br class="">
                <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br class="">
                <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br
                  class="">
              </blockquote>
              <br class="">
              -- <br class="">
              <a href="http://www.spatialys.com"
                class="moz-txt-link-freetext" moz-do-not-send="true">http://www.spatialys.com</a><br
                class="">
              My software is free, but my time generally not.<br
                class="">
              <br class="">
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <div class="">
        <div style="color: rgb(0, 0, 0); letter-spacing: normal;
          orphans: auto; text-align: start; text-indent: 0px;
          text-transform: none; white-space: normal; widows: auto;
          word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap:
          break-word; -webkit-nbsp-mode: space; -webkit-line-break:
          after-white-space;" class="">
          <div style="color: rgb(0, 0, 0); letter-spacing: normal;
            orphans: auto; text-align: start; text-indent: 0px;
            text-transform: none; white-space: normal; widows: auto;
            word-spacing: 0px; -webkit-text-stroke-width: 0px;
            word-wrap: break-word; -webkit-nbsp-mode: space;
            -webkit-line-break: after-white-space;" class="">
            <div style="color: rgb(0, 0, 0); letter-spacing: normal;
              orphans: auto; text-align: start; text-indent: 0px;
              text-transform: none; white-space: normal; widows: auto;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              word-wrap: break-word; -webkit-nbsp-mode: space;
              -webkit-line-break: after-white-space;" class="">
              <div style="color: rgb(0, 0, 0); letter-spacing: normal;
                orphans: auto; text-align: start; text-indent: 0px;
                text-transform: none; white-space: normal; widows: auto;
                word-spacing: 0px; -webkit-text-stroke-width: 0px;
                word-wrap: break-word; -webkit-nbsp-mode: space;
                -webkit-line-break: after-white-space;" class="">
                <div style="color: rgb(0, 0, 0); letter-spacing: normal;
                  orphans: auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px; word-wrap: break-word; -webkit-nbsp-mode: space;
                  -webkit-line-break: after-white-space;" class="">
                  <div style="color: rgb(0, 0, 0); font-family:
                    Helvetica; font-size: 12px; font-style: normal;
                    font-variant: normal; font-weight: normal;
                    letter-spacing: normal; line-height: normal;
                    orphans: 2; text-align: start; text-indent: 0px;
                    text-transform: none; white-space: normal; widows:
                    2; word-spacing: 0px; -webkit-text-stroke-width:
                    0px;" class=""><br class="Apple-interchange-newline">
========================================================</div>
                  <div style="color: rgb(0, 0, 0); font-family:
                    Helvetica; font-size: 12px; font-style: normal;
                    font-variant: normal; font-weight: normal;
                    letter-spacing: normal; line-height: normal;
                    orphans: 2; text-align: start; text-indent: 0px;
                    text-transform: none; white-space: normal; widows:
                    2; word-spacing: 0px; -webkit-text-stroke-width:
                    0px;" class="">NIK SANDS</div>
                  <div style="color: rgb(0, 0, 0); font-family:
                    Helvetica; font-size: 12px; font-style: normal;
                    font-variant: normal; font-weight: normal;
                    letter-spacing: normal; line-height: normal;
                    orphans: 2; text-align: start; text-indent: 0px;
                    text-transform: none; white-space: normal; widows:
                    2; word-spacing: 0px; -webkit-text-stroke-width:
                    0px;" class="">Line Tamer | Time Traveller | Space
                    Cadet</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br class="">
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>