I'm trying to build the numcodecs Python library, which has a git submodule for c-blosc. I see the following build error on macOS:
/Users/Adam/spack/lib/spack/env/clang/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DHAVE_LZ4=1 -DHAVE_SNAPPY=1 -DHAVE_ZLIB=1 -DHAVE_ZSTD=1 -Ic-blosc/blosc -Ic-blosc/internal-complibs/snappy-1.1.1 -Ic-blosc/internal-complibs/zstd-1.4.4 -Ic-blosc/internal-complibs/lz4-1.9.2 -Ic-blosc/internal-complibs/zlib-1.2.8 -Ic-blosc/internal-complibs/zstd-1.4.4/compress -Ic-blosc/internal-complibs/zstd-1.4.4/dictBuilder -Ic-blosc/internal-complibs/zstd-1.4.4/decompress -Ic-blosc/internal-complibs/zstd-1.4.4/legacy -Ic-blosc/internal-complibs/zstd-1.4.4/common -Ic-blosc/internal-complibs/zstd-1.4.4/dll -Ic-blosc/internal-complibs/zstd-1.4.4/deprecated -I/Users/Adam/spack/opt/spack/darwin-catalina-x86_64/apple-clang-12.0.0/python-3.8.7-3auqbnqcq3ti45v6unf4rcyrfkvwmnvo/include/python3.8 -c c-blosc/internal-complibs/zlib-1.2.8/gzread.c -o build/temp.macosx-10.15.7-x86_64-3.8/c-blosc/internal-complibs/zlib-1.2.8/gzread.o -msse2 -stdlib=libc++ -DSHUFFLE_SSE2_ENABLED
c-blosc/internal-complibs/zlib-1.2.8/gzread.c:30:15: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = read(state->fd, buf + *have, len - *have);
^
c-blosc/internal-complibs/zlib-1.2.8/gzread.c:30:15: note: did you mean 'fread'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:158:9: note: 'fread' declared here
size_t fread(void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream);
^
c-blosc/internal-complibs/zlib-1.2.8/gzread.c:591:11: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = close(state->fd);
^
2 errors generated.
[numcodecs] command '/Users/Adam/spack/lib/spack/env/clang/clang' failed with exit status 1
Apple Clang 12 (the current release) is more strict than previous releases. This can be solved with the following patch:
diff --git a/internal-complibs/zlib-1.2.8/gzguts.h b/internal-complibs/zlib-1.2.8/gzguts.h
index d87659d..f6823ed 100644
--- a/internal-complibs/zlib-1.2.8/gzguts.h
+++ b/internal-complibs/zlib-1.2.8/gzguts.h
@@ -26,6 +26,7 @@
# include <limits.h>
#endif
#include <fcntl.h>
+#include <unistd.h>
#ifdef _WIN32
# include <stddef.h>
Idea comes from https://stackoverflow.com/questions/15296067/how-to-handle-a-warning-from-the-clang-compiler
Would it be possible to update from zlib 1.2.8 to 1.2.11? Not sure if this will fix it or not, you may also need to run configure. Ideally, I could simply use an external zlib installation since I don't want to be stuck with an older broken version of zlib.
I'm trying to build the numcodecs Python library, which has a git submodule for c-blosc. I see the following build error on macOS:
Apple Clang 12 (the current release) is more strict than previous releases. This can be solved with the following patch:
Idea comes from https://stackoverflow.com/questions/15296067/how-to-handle-a-warning-from-the-clang-compiler
Would it be possible to update from zlib 1.2.8 to 1.2.11? Not sure if this will fix it or not, you may also need to run
configure. Ideally, I could simply use an external zlib installation since I don't want to be stuck with an older broken version of zlib.