From 40a7e1abb40f3d02efb2b7a2913bb7518559563a Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Tue, 3 Jun 2025 18:13:40 +0200 Subject: [PATCH] Build: Remove features from blosc that we don't use Seems like only lz4 is used by openvdb. The zstd support were causing runtime issues because of version mismatches with our other libraries. In addition to this, blosc doesn't seem to properly link to static libraries. The resulting static library has undefied symbols in it from both zlib and zstd. This wasn't caught before as openvdb links to zlib. Pull Request: https://projects.blender.org/blender/blender/pulls/139792 --- .../build_environment/cmake/blosc.cmake | 15 +- .../build_environment/patches/blosc.diff | 131 ------------------ 2 files changed, 2 insertions(+), 144 deletions(-) delete mode 100644 build_files/build_environment/patches/blosc.diff diff --git a/build_files/build_environment/cmake/blosc.cmake b/build_files/build_environment/cmake/blosc.cmake index 8d699349233..cb76dc8df97 100644 --- a/build_files/build_environment/cmake/blosc.cmake +++ b/build_files/build_environment/cmake/blosc.cmake @@ -3,8 +3,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later set(BLOSC_EXTRA_ARGS - -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ - -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF -DCMAKE_DEBUG_POSTFIX=_d @@ -12,15 +10,11 @@ set(BLOSC_EXTRA_ARGS -DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC3.lib -DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc -DDEACTIVATE_SNAPPY=ON + -DDEACTIVATE_ZLIB=ON + -DDEACTIVATE_ZSTD=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON ) -# Prevent blosc from including its own local copy of zlib in the object file -# and cause linker errors with everybody else. -set(BLOSC_EXTRA_ARGS ${BLOSC_EXTRA_ARGS} - -DPREFER_EXTERNAL_ZLIB=ON -) - ExternalProject_Add(external_blosc URL file://${PACKAGE_DIR}/${BLOSC_FILE} DOWNLOAD_DIR ${DOWNLOAD_DIR} @@ -35,11 +29,6 @@ ExternalProject_Add(external_blosc INSTALL_DIR ${LIBDIR}/blosc ) -add_dependencies( - external_blosc - external_zlib -) - if(WIN32) add_dependencies( external_blosc diff --git a/build_files/build_environment/patches/blosc.diff b/build_files/build_environment/patches/blosc.diff deleted file mode 100644 index 0080694fae1..00000000000 --- a/build_files/build_environment/patches/blosc.diff +++ /dev/null @@ -1,131 +0,0 @@ -diff -Naur src/blosc/CMakeLists.txt external_blosc/blosc/CMakeLists.txt ---- src/blosc/CMakeLists.txt 2016-02-03 10:26:28 -0700 -+++ external_blosc/blosc/CMakeLists.txt 2017-03-03 09:03:31 -0700 -@@ -61,6 +61,8 @@ - set(SOURCES ${SOURCES} win32/pthread.c) - else(NOT Threads_FOUND) - set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) -+ set(LIBS ${LIBS} ${PTHREAD_LIBS}) -+ include_directories( ${PTHREAD_INCLUDE_DIR} ) - endif(NOT Threads_FOUND) - else(WIN32) - find_package(Threads REQUIRED) -diff -Naur src/CMakeLists.txt external_blosc/CMakeLists.txt ---- src/CMakeLists.txt 2016-02-03 10:26:28 -0700 -+++ external_blosc/CMakeLists.txt 2017-03-03 09:03:31 -0700 -@@ -17,8 +17,8 @@ - # do not include support for the Snappy library - # DEACTIVATE_ZLIB: default OFF - # do not include support for the Zlib library --# PREFER_EXTERNAL_COMPLIBS: default ON --# when found, use the installed compression libs instead of included sources -+# PREFER_EXTERNAL_ZLIB: default ON -+# when found, use the installed zlib instead of included sources - # TEST_INCLUDE_BENCH_SINGLE_1: default ON - # add a test that runs the benchmark program passing "single" with 1 thread - # as first parameter -@@ -80,29 +80,23 @@ - "Do not include support for the SNAPPY library." OFF) - option(DEACTIVATE_ZLIB - "Do not include support for the ZLIB library." OFF) --option(PREFER_EXTERNAL_COMPLIBS -- "When found, use the installed compression libs instead of included sources." ON) -+option(PREFER_EXTERNAL_ZLIB -+ "When found, use the installed zlib instead of included sources." ON) - - set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - --if(NOT PREFER_EXTERNAL_COMPLIBS) -+if(NOT PREFER_EXTERNAL_ZLIB) - message(STATUS "Finding external libraries disabled. Using internal sources.") --endif(NOT PREFER_EXTERNAL_COMPLIBS) -+endif(NOT PREFER_EXTERNAL_ZLIB) - - - if(NOT DEACTIVATE_LZ4) -- if(PREFER_EXTERNAL_COMPLIBS) -- find_package(LZ4) -- endif(PREFER_EXTERNAL_COMPLIBS) - # HAVE_LZ4 will be set to true because even if the library is - # not found, we will use the included sources for it - set(HAVE_LZ4 TRUE) - endif(NOT DEACTIVATE_LZ4) - - if(NOT DEACTIVATE_SNAPPY) -- if(PREFER_EXTERNAL_COMPLIBS) -- find_package(Snappy) -- endif(PREFER_EXTERNAL_COMPLIBS) - # HAVE_SNAPPY will be set to true because even if the library is not found, - # we will use the included sources for it - set(HAVE_SNAPPY TRUE) -@@ -110,13 +104,13 @@ - - if(NOT DEACTIVATE_ZLIB) - # import the ZLIB_ROOT environment variable to help finding the zlib library -- if(PREFER_EXTERNAL_COMPLIBS) -+ if(PREFER_EXTERNAL_ZLIB) - set(ZLIB_ROOT $ENV{ZLIB_ROOT}) - find_package( ZLIB ) - if (NOT ZLIB_FOUND ) - message(STATUS "No zlib found. Using internal sources.") - endif (NOT ZLIB_FOUND ) -- endif(PREFER_EXTERNAL_COMPLIBS) -+ endif(PREFER_EXTERNAL_ZLIB) - # HAVE_ZLIB will be set to true because even if the library is not found, - # we will use the included sources for it - set(HAVE_ZLIB TRUE) -diff -Naur external_blosc.orig/blosc/blosc.c external_blosc/blosc/blosc.c ---- external_blosc.orig/blosc/blosc.c 2018-07-30 04:56:38 -0600 -+++ external_blosc/blosc/blosc.c 2018-08-11 15:27:26 -0600 -@@ -41,12 +41,7 @@ - #include - #endif /* _WIN32 */ - --#if defined(_WIN32) -- #include "win32/pthread.h" -- #include "win32/pthread.c" --#else -- #include --#endif -+#include - - - /* Some useful units */ - diff --git a/blosc/shuffle.c b/blosc/shuffle.c - index 84b5095..23053b4 100644 - --- a/blosc/shuffle.c - +++ b/blosc/shuffle.c - @@ -490,12 +490,12 @@ void unshuffle(size_t bytesoftype, size_t blocksize, - #else /* no __SSE2__ available */ - - void shuffle(size_t bytesoftype, size_t blocksize, - - uint8_t* _src, uint8_t* _dest) { - + const uint8_t* _src, uint8_t* _dest) { - _shuffle(bytesoftype, blocksize, _src, _dest); - } - - void unshuffle(size_t bytesoftype, size_t blocksize, - - uint8_t* _src, uint8_t* _dest) { - + const uint8_t* _src, uint8_t* _dest) { - _unshuffle(bytesoftype, blocksize, _src, _dest); - } - --- a/cmake/FindSSE.cmake - +++ b/cmake/FindSSE.cmake - @@ -49,6 +49,17 @@ - set(AVX_FOUND false CACHE BOOL "AVX available on host") - ENDIF (AVX_TRUE) - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") - + execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) - + message(STATUS "Detected architecture ${ARCHITECTURE}") - + IF("${ARCHITECTURE}" STREQUAL "arm64") - + set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") - + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") - + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") - + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") - + set(AVX_FOUND false CACHE BOOL "AVX available on host") - + return() - + ENDIF() - + - EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE - CPUINFO) - \ No newline at end of file