Skip to content

Commit

Permalink
Do not depends on unused libraries for libtiff (#785)
Browse files Browse the repository at this point in the history
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: #785
  • Loading branch information
gigony authored Oct 2, 2024
1 parent 6e3fd31 commit 289e340
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
5 changes: 0 additions & 5 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
5 changes: 0 additions & 5 deletions conda/environments/all_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
11 changes: 0 additions & 11 deletions conda/recipes/libcucim/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}
Expand Down Expand Up @@ -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" %}
Expand All @@ -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') }}

Expand Down
11 changes: 11 additions & 0 deletions cpp/plugins/cucim.kit.cuslide/cmake/deps/libtiff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 289e340

Please sign in to comment.