Creating a wrapper for GDAL for use within an iOS Project

I'm trying to leverage the features of GDAL for use within an iOS application. My approach to achieve this has been to-

  1. Create a Swift package that wraps around GDAL
  2. Use the above package within an Xcode project for iOS

I would greatly appreciate insights as to whether this approach is viable and if it isn't, any suggestions for the best alternative. As it stands, the project can be found here.

Background-

  • I'm using an Apple Silicon MacBook Pro
  • GDAL is currently installed via homebrew on my Mac
  • Unless I'm mistaken, the installation of GDAL on my Mac is for the arm64 architecture-
$ objdump -a /opt/homebrew/opt/gdal//lib/libgdal.a | grep 'file format'
/opt/homebrew/opt/gdal//lib/libgdal.a(gml2ogrgeometry.o):	file format mach-o arm64
  • I've linked the header file for gdal within the module.modulemap of my package
  • I'm attempting to build the package for Any iOS Device (arm64)

Initially, I received the following warning and error message while building the project-

ld: warning: Could not find or use auto-linked library 'gdal'
Undefined symbols for architecture arm64:
  "_GDALVersionInfo", referenced from:
      static SwiftGDAL.SwiftGDAL.gdalVersionPrint() -> () in SwiftGDAL.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

My code within the Swift package is able to identify GDALVersionInfo, as I'm able to view it's declaration by option-clicking it, which leads me to believe that my package is able to read the contents of GDAL, but unable to determine what to do with it.

Upon explicitly setting the LIBRARY_SEARCH_PATHS in Build Settings to /opt/homebrew/opt, I received an additional warning-

ld: warning: building for iOS, but linking in dylib file (/opt/homebrew/opt/gdal/lib/libgdal.dylib) built for macOS, 'gdal'

Given my installation of GDAL on my Mac is arm64, is there a way the above warning can be resolved? And by extension, why is the compiler having trouble finding symbols for architecture arm64?