Skip to content

Build with signed char on every platform - #11

Closed
tfenne wants to merge 1 commit into
mainfrom
tf_signed_char
Closed

tfenne wants to merge 1 commit into
mainfrom
tf_signed_char

Conversation

@tfenne

@tfenne tfenne commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

char is signed on x86-64 and Apple arm64 but unsigned on Linux aarch64, and TileDB keeps signed values in chars. The array schema stores each compression level as a char, so on Linux aarch64 zlib's default level of −1 reads back as 255 and GZIP compression fails with Z_STREAM_ERROR, as in tiledb_array_write_dense_1. TILEDB_EMPTY_CHAR (CHAR_MAX), which marks missing char values on disk, is 255 there and 127 everywhere else, so missing values written on x86-64 or macOS read back on aarch64 as 127, and missing values written on aarch64 read back elsewhere as −1. This builds TileDB with -fsigned-char and adds it to the link interface of tiledb_static and tiledb_shared, so that code linking them, such as GenomicsDB, agrees on TILEDB_EMPTY_CHAR too, and adds a test that it is 127. CI has no aarch64 runner, so I checked it in an AlmaLinux 8 container on aarch64 with GCC 15 and clang 21, which need #12 to build: every test and example passes with this change, and tiledb_array_write_dense_1 fails without it.

@nalinigans, one thing needs your view: arrays already written on Linux aarch64 mark missing chars with 255, which after this change reads as −1 rather than as missing. If there are aarch64 users with existing workspaces, it would need at least a note in the release.

char is signed on x86-64 and Apple arm64 but unsigned on Linux aarch64,
and TileDB keeps signed values in chars. The array schema stores each
compression level as a char, so on aarch64 zlib's default level of -1
read back as 255 and GZIP compression failed with Z_STREAM_ERROR.
TILEDB_EMPTY_CHAR (CHAR_MAX), which marks missing char values on disk,
was 255 there and 127 elsewhere: missing values written on x86-64 or
macOS read back on aarch64 as 127, and missing values written on aarch64
read back elsewhere as -1. TileDB is now built with -fsigned-char, which
its library targets also pass on to code that links them, since that
code reads TILEDB_EMPTY_CHAR from TileDB's headers.
@tfenne

tfenne commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #14, which redefines TILEDB_EMPTY_CHAR as 0x7F as you suggested, rather than changing char's signedness. The compression-level fix this also carried is in #13.

@tfenne tfenne closed this Oct 6, 2026
@tfenne
tfenne deleted the tf_signed_char branch October 6, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant