From 289e3403ab98cc9a420140e5b54fef3a9a4091a2 Mon Sep 17 00:00:00 2001 From: Gigon Bae Date: Wed, 2 Oct 2024 11:41:50 -0700 Subject: [PATCH] Do not depends on unused libraries for libtiff (#785) Libraries such as jbig, libwebp-base, and zlib are not used for the functionality of cuCIM. These codec libraries are linked to libtiff only when available at build time. This patch explicitly disables external codecs and removes unnecessary dependencies from the `dependencies.yaml`. With this patch, I can confirm that they are not requested at all. ``` -- Support for external codecs: -- ZLIB support: OFF (requested) (availability) -- Pixar log-format algorithm: OFF (requested) FALSE (availability) -- JPEG support: OFF (requested) TRUE (availability) -- Old JPEG support: OFF (requested) TRUE (availability) -- JPEG 8/12 bit dual mode: OFF (requested) FALSE (availability) -- ISO JBIG support: OFF (requested) FALSE (availability) -- LZMA2 support: OFF (requested) (availability) -- ZSTD support: OFF (requested) (availability) -- WEBP support: OFF (requested) FALSE (availability) ``` Authors: - Gigon Bae (https://github.com/gigony) Approvers: - James Lamb (https://github.com/jameslamb) - https://github.com/jakirkham URL: https://github.com/rapidsai/cucim/pull/785 --- CONTRIBUTING.md | 2 +- conda/environments/all_cuda-118_arch-x86_64.yaml | 5 ----- conda/environments/all_cuda-125_arch-x86_64.yaml | 5 ----- conda/recipes/libcucim/meta.yaml | 11 ----------- .../cucim.kit.cuslide/cmake/deps/libtiff.cmake | 11 +++++++++++ dependencies.yaml | 11 ----------- 6 files changed, 12 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a05dee929..9dc5c6232 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -123,7 +123,7 @@ cd $CUCIM_HOME Conda can be used to setup an environment which includes all of the necessary dependencies (as shown in `./conda/environments/all_cuda-118_arch-x86_64.yaml`) for building cuCIM. -Otherwise, you may need to install dependencies (such as zlib, xz, yasm) through your OS's package manager (`apt`, `yum`, and so on). +Otherwise, you may need to install dependencies (such as yasm) through your OS's package manager (`apt`, `yum`, and so on). ### Creating the Conda Development Environment `cucim` diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index d657617b4..66b66b94f 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -16,13 +16,11 @@ dependencies: - gcc_linux-64=11.* - imagecodecs>=2021.6.8 - ipython -- jbig - lazy_loader>=0.1 - libcufile-dev=1.4.0.31 - libcufile=1.4.0.31 - libnvjpeg-dev=11.6.0.55 - libnvjpeg=11.6.0.55 -- libwebp-base - matplotlib-base - nbsphinx - ninja @@ -47,10 +45,7 @@ dependencies: - sphinx<6 - sysroot_linux-64==2.17 - tifffile>=2022.7.28 -- xz - yasm -- zlib -- zstd - pip: - opencv-python-headless>=4.6 name: all_cuda-118_arch-x86_64 diff --git a/conda/environments/all_cuda-125_arch-x86_64.yaml b/conda/environments/all_cuda-125_arch-x86_64.yaml index a193f5cdd..392850e85 100644 --- a/conda/environments/all_cuda-125_arch-x86_64.yaml +++ b/conda/environments/all_cuda-125_arch-x86_64.yaml @@ -17,12 +17,10 @@ dependencies: - gcc_linux-64=11.* - imagecodecs>=2021.6.8 - ipython -- jbig - lazy_loader>=0.1 - libcufile-dev - libnvjpeg-dev - libnvjpeg-static -- libwebp-base - matplotlib-base - nbsphinx - ninja @@ -46,10 +44,7 @@ dependencies: - sphinx<6 - sysroot_linux-64==2.17 - tifffile>=2022.7.28 -- xz - yasm -- zlib -- zstd - pip: - opencv-python-headless>=4.6 name: all_cuda-125_arch-x86_64 diff --git a/conda/recipes/libcucim/meta.yaml b/conda/recipes/libcucim/meta.yaml index b373ffbbe..7ab230806 100644 --- a/conda/recipes/libcucim/meta.yaml +++ b/conda/recipes/libcucim/meta.yaml @@ -17,7 +17,6 @@ build: number: {{ GIT_DESCRIBE_NUMBER }} string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} ignore_run_exports: - - libwebp-base - openslide ignore_run_exports_from: {% if cuda_major == "11" %} @@ -74,13 +73,8 @@ requirements: - libnvjpeg-dev - libnvjpeg-static {% endif %} - - jbig - - libwebp-base - nvtx-c >=3.1.0 - openslide - - xz - - zlib - - zstd run: - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} {% if cuda_major == "11" %} @@ -91,11 +85,6 @@ requirements: - libcufile # [linux64] - libnvjpeg {% endif %} - - {{ pin_compatible('libwebp-base', max_pin='x.x') }} - - jbig - - xz - - zlib - - zstd run_constrained: - {{ pin_compatible('openslide') }} diff --git a/cpp/plugins/cucim.kit.cuslide/cmake/deps/libtiff.cmake b/cpp/plugins/cucim.kit.cuslide/cmake/deps/libtiff.cmake index 8328bbd71..fd20e7f0e 100644 --- a/cpp/plugins/cucim.kit.cuslide/cmake/deps/libtiff.cmake +++ b/cpp/plugins/cucim.kit.cuslide/cmake/deps/libtiff.cmake @@ -53,6 +53,17 @@ if (NOT TARGET deps::libtiff) set(JPEG_LIBRARIES deps::libjpeg-turbo) # for jpeglib.h and jconfig.h/jconfigint.h set(TIFF_INCLUDES ${deps-libjpeg-turbo_SOURCE_DIR} ${deps-libjpeg-turbo_BINARY_DIR} ) + + # Explicitly disable external codecs + set(zlib OFF) + set(pixarlog OFF) + set(lzma OFF) + set(old-jpeg OFF) + set(jpeg12 OFF) + set(zstd OFF) + set(jbig OFF) + set(webp OFF) + add_subdirectory(${deps-libtiff_SOURCE_DIR} ${deps-libtiff_BINARY_DIR} EXCLUDE_FROM_ALL) # Disable visibility to not expose unnecessary symbols diff --git a/dependencies.yaml b/dependencies.yaml index 62e2ddefe..e25c6f909 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -265,17 +265,6 @@ dependencies: - output_types: conda packages: - cupy>=12.0.0 - # All dependencies below this point are specific to `cucim.clara` and - # are not needed for either `cucim.core` or `cucim.skimage`. I did - # not include these under a "pyproject" output so that it is still - # possible to run `pip install .` from the python/cucim folder - # without having build the C++ library at all. This allows, usage of - # usage of `cucim.skimage` on Windows, for example. - - jbig - - libwebp-base - - xz - - zlib - - zstd # Not sure where these go, if anywhere: # - openslide # - xorg-libxcb