kiyo-masui / bitshuffle

Filter for improving compression of typed binary data.
Other
215 stars 76 forks source link

Compilation errors in gcc-14 #153

Open sjforeman opened 2 months ago

sjforeman commented 2 months ago

OS: macOS Sonoma 14.5 Chip: Apple M3 Pro Python: Python 3.10.14 Compiler: gcc 14.1.0

Attempting to pip-install bitshuffle in the above setup yields the following:

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/include -arch arm64 -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/include -arch arm64 -Ilzf/ -Ilzf/lzf/ -I/opt/homebrew/Cellar/hdf5/1.14.3_1/include -I/Users/sforeman/Desktop/venv/include -I/opt/homebrew/Caskroom/miniforge/base/include/python3.10 -c lzf/lzf_filter.c -o build/temp.macosx-11.0-arm64-cpython-310/lzf/lzf_filter.o -mcpu=native -O3 -fno-strict-aliasing -fPIC -ffast-math -std=c99
      lzf/lzf_filter.c: In function 'register_lzf':
      lzf/lzf_filter.c:85:9: error: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
         85 |         "lzf",
            |         ^~~~~
      lzf/lzf_filter.c:85:9: note: (near initialization for 'filter_class.id')
      lzf/lzf_filter.c:86:9: error: initialization of 'unsigned int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
         86 |         NULL,
            |         ^~~~
      lzf/lzf_filter.c:86:9: note: (near initialization for 'filter_class.encoder_present')
      lzf/lzf_filter.c:87:9: error: initialization of 'unsigned int' from 'herr_t (*)(hid_t,  hid_t,  hid_t)' {aka 'int (*)(long long int,  long long int,  long long int)'} makes integer from pointer without a cast [-Wint-conversion]
         87 |         (H5Z_set_local_func_t)(lzf_set_local),
            |         ^
      lzf/lzf_filter.c:87:9: note: (near initialization for 'filter_class.decoder_present')
      lzf/lzf_filter.c:88:9: error: initialization of 'const char *' from incompatible pointer type 'size_t (*)(unsigned int,  size_t,  const unsigned int *, size_t,  size_t *, void **)' {aka 'long unsigned int (*)(unsigned int,  long unsigned int,  const unsigned int *, long unsigned int,  long unsigned int *, void **)'} [-Wincompatible-pointer-types]
         88 |         (H5Z_func_t)(lzf_filter)
            |         ^
      lzf/lzf_filter.c:88:9: note: (near initialization for 'filter_class.name')
      error: command '/opt/homebrew/bin/clang' failed with exit code 1

The failures occur because the int-conversion and incompatible-pointer-types warnings are treated as errors. According to https://gcc.gnu.org/gcc-14/porting_to.html#warnings-as-errors, these warnings are treated as errors in gcc-14, but were treated as warnings by default in gcc-13 and earlier. I find that bitshuffle compiles and installs without issue in gcc-13. Altering the lines reference above should be sufficient to restore gcc-14 compatibility.