Skip to content

Release universal binaries for MacOS #4654

@jeroen

Description

@jeroen

Currently you are releasing separate binaries for macos x86_64 and arm64, for example:

It is very easy on macos to merge two libraries into "univeral binaries", for example:

lipo -create x86_64/lib/libtiledb.dylib  arm64/lib/libtiledb.dylib -output universal/libtiledb.dylib

The resulting libtiledb.dylib contains both libs and can be linked on either architecture:

file universal/libtiledb.dylib
## universal/libtiledb.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
## universal/libtiledb.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
## universal/libtiledb.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

Currently, the client application has to guess what platform it is targeting, which is tricky when we may be cross compiling, such that the host is different than target. For example tiledbsoma has this:

          if (CMAKE_OSX_ARCHITECTURES STREQUAL x86_64)
            SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.19.0/tiledb-macos-x86_64-2.19.0-fa30a88a.tar.gz")
            SET(DOWNLOAD_SHA1 "089b3aa8a92df0bd5a8f7515ed8e5b6bacb5ab47")
          elseif (CMAKE_OSX_ARCHITECTURES STREQUAL arm64)
            SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.19.0/tiledb-macos-arm64-2.19.0-fa30a88a.tar.gz")
            SET(DOWNLOAD_SHA1 "83acdc7529d50dcf293dbd6bbc81263856c7c74c")
          elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)")
            SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.19.0/tiledb-macos-x86_64-2.19.0-fa30a88a.tar.gz")
            SET(DOWNLOAD_SHA1 "089b3aa8a92df0bd5a8f7515ed8e5b6bacb5ab47")
          elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
            SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.19.0/tiledb-macos-arm64-2.19.0-fa30a88a.tar.gz")
            SET(DOWNLOAD_SHA1 "83acdc7529d50dcf293dbd6bbc81263856c7c74c")
          endif()

Where we are supposed to set CMAKE_OSX_ARCHITECTURES manually when cross compiling. And then some more heuristics when building the R package. This is painful and error prone. If you just ship libtiledb as universal binaries you can get rid of all that, one library that will just work any macos hardware, even with cross compiling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions