[gdal-dev] iOS patch for GDAL 3.5 requires modification for Mac Catalyst

Even Rouault even.rouault at spatialys.com
Wed Aug 31 07:06:22 PDT 2022


Nik,

I've prepared a PR with your suggested fix in 
https://github.com/OSGeo/gdal/pull/6282

It passes fine on existing MacOS continuous integration jobs we have. It 
would be good if people that have access to a bit ancient MacOSX (not 
sure how ancient it should be...), or with 32-bit builds, could check if 
that PR doesn't prevent using data files > 4 GB.

Even

Le 31/08/2022 à 01:07, Nik Sands a écrit :
> Hi GDAL devs,
>
> A few months ago, a patch to GDAL 3.5 was developed so that building with CMAKE would run correctly for iOS builds.  The patch is below.
>
> I am now extending my iOS app to use Mac Catalyst (for those who don’t know, this is an Apple technology to enable apps developed for iOS to also run on macOS (both ARM and Intel), and for the Mac version to also be extended to include macOS-only functionality, such as menu bars, etc).
>
> I have found that when building for Mac Catalyst, the build failed in exactly the same way that it used to fail for iOS before applying the patch (below).  The errors are due to (as the patch comment says):  tests detect xxxx64 symbols for iOS, which are not available at build time.
>
> So I modified the patched file further to replace this line:
>
> if (${CMAKE_SYSTEM_NAME} MATCHES "iOS”)
>
> ...with this:
>
> if (${CMAKE_SYSTEM_NAME} MATCHES “iOS” OR ${CMAKE_SYSTEM_NAME} MATCHES “Darwin”)
>
> ...and now the Mac Catalyst build works correctly (for both Mac Catalyst x86_64 AND Mac Catalyst arm64).
>
> HOWEVER, I do not know if this might adversely affect direct (non-catalyst) “normal” macOS builds (as I am not doing any such builds myself).  Is anybody able to verify if this change would be a problem for macOS.  If not, can this change be included in future builds of GDAL, or if it would be problematic for “normal” macOS, is there some way to modify the cmake config to check explicitly for Mac Catalyst, as opposed to “normal” macOS?
>
> Cheers,
> Nik.
>
>
> START OF PATCH
> ——————————
>
> --- orig/configure.cmake	2022-05-11 00:03:37.000000000 +1000
> +++ patched/configure.cmake	2022-07-06 18:54:48.000000000 +1000
> @@ -41,6 +41,7 @@
>   check_type_size("int" SIZEOF_INT)
>   check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
>   check_type_size("void*" SIZEOF_VOIDP)
> +check_type_size("size_t" SIZEOF_SIZE_T)
>   
>   if (MSVC)
>     set(HAVE_VSNPRINTF 1)
> @@ -116,6 +117,13 @@
>           "
>       HAVE_5ARGS_MREMAP)
>   
> +  check_c_source_compiles(
> +    "
> +        #include <pthread.h>
> +        int main() { pthread_atfork(0,0,0); 0; }
> +        "
> +    HAVE_PTHREAD_ATFORK)
> +
>     check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
>     if (${CMAKE_SYSTEM} MATCHES "Linux")
>         check_include_file("linux/fs.h" HAVE_LINUX_FS_H)
> @@ -233,6 +241,27 @@
>       set(VSI_FTRUNCATE64 "ftruncate")
>     endif ()
>   
> +  # For some reason, above tests detect xxxx64 symbols for iOS, which are not
> +  # available at build time.
> +  if (${CMAKE_SYSTEM_NAME} MATCHES "iOS")
> +    set(VSI_FOPEN64 "fopen")
> +    set(VSI_FTRUNCATE64 "ftruncate")
> +    set(VSI_FTELL64 "ftell")
> +    set(VSI_FSEEK64 "fseek")
> +    set(VSI_STAT64 "stat")
> +    set(VSI_STAT64_T "stat")
> +    unset(HAVE_FOPEN64)
> +    unset(HAVE_FOPEN64 CACHE)
> +    unset(HAVE_FTRUNCATE64)
> +    unset(HAVE_FTRUNCATE64 CACHE)
> +    unset(HAVE_FTELL64)
> +    unset(HAVE_FTELL64 CACHE)
> +    unset(HAVE_FSEEK64)
> +    unset(HAVE_FSEEK64 CACHE)
> +    unset(HAVE_STATVFS64)
> +    unset(HAVE_STATVFS64 CACHE)
> +  endif()
> +
>     set(UNIX_STDIO_64 TRUE)
>   
>     set(INCLUDE_XLOCALE_H)
> @@ -313,4 +342,4 @@
>     set(MACOSX_FRAMEWORK OFF)
>   endif ()
>   
> -# vim: ts=4 sw=4 sts=4 et
> +# vim: ts=4 sw=4 sts=4 et
> \ No newline at end of file
>
>
> ——————————
> END OF PATCH
>
> ========================================================
> NIK SANDS
> Line Tamer | Time Traveller | Space Cadet
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list