conda-forge / rocksdb-feedstock

A conda-smithy repository for rocksdb.
BSD 3-Clause "New" or "Revised" License
0 stars 11 forks source link

Why dependency is libzlib instead of zlib? #57

Closed gau-nernst closed 1 year ago

gau-nernst commented 1 year ago

Comment:

Hello,

I'm not too familiar with conda build process. But I observe that when I install rocksdb package, libzlib is installed instead of zlib.

To verify this

conda search rocksdb --info

Output on Macbook Air M1

rocksdb 7.9.2 h150c939_1
------------------------
file name   : rocksdb-7.9.2-h150c939_1.conda
name        : rocksdb
version     : 7.9.2
build       : h150c939_1
build number: 1
size        : 5.7 MB
license     : Apache-2.0
subdir      : osx-arm64
url         : https://conda.anaconda.org/conda-forge/osx-arm64/rocksdb-7.9.2-h150c939_1.conda
md5         : 70cc1fb740638c7be2941dbb7f8c43dc
timestamp   : 2023-01-22 18:53:57 UTC
dependencies:
  - bzip2 >=1.0.8,<2.0a0
  - gflags >=2.2.2,<2.3.0a0
  - libcxx >=14.0.6
  - libjemalloc >=5.2.1
  - libzlib >=1.2.13,<1.3.0a0
  - lz4-c >=1.9.3,<1.10.0a0
  - snappy >=1.1.9,<2.0a0
  - zstd >=1.5.2,<1.6.0a0

Output on Windows machine

rocksdb 7.9.2 hf81f564_1
------------------------
file name   : rocksdb-7.9.2-hf81f564_1.conda
name        : rocksdb
version     : 7.9.2
build       : hf81f564_1
build number: 1
size        : 43.8 MB
license     : Apache-2.0
subdir      : win-64
url         : https://conda.anaconda.org/conda-forge/win-64/rocksdb-7.9.2-hf81f564_1.conda
md5         : 81b48ef760044440820da19e2bf9fe43
timestamp   : 2023-01-22 18:58:30 UTC
dependencies:
  - bzip2 >=1.0.8,<2.0a0
  - gflags >=2.2.2,<2.3.0a0
  - libzlib >=1.2.13,<1.3.0a0
  - lz4-c >=1.9.3,<1.10.0a0
  - snappy >=1.1.9,<2.0a0
  - ucrt >=10.0.20348.0
  - vc >=14.2,<15
  - vs2015_runtime >=14.29.30139
  - zstd >=1.5.2,<1.6.0a0

This is quite strange since the requirements in meta.yaml is zlib

https://github.com/conda-forge/rocksdb-feedstock/blob/a322aade0b6c6bd5595bed6b80d5b816d59812ab/recipe/meta.yaml#L20-L32

libzlib only provides dynamic library, while zlib will provide header files, dynamic and static libraries. In other words, zlib is more complete.

So my question is, where is the code/config that maps zlib requirement in meta.yaml to the libzlib package on conda-forge? Also, was there a reason of choosing libzlib over zlib package?

gau-nernst commented 1 year ago

@hadim do you happen to know the answer for this? I'm building a rocksdb Python binding. On Windows, libzlib only provides a DLL file so I cannot link zlib. I also need the import library zlib.lib to link correctly. Installing zlib from conda-forge solves the problem, but it's strange the dependency is libzlib but not zlib package.

hadim commented 1 year ago

I don't know the answer. Does rocksdb depend on zlib or libzlib? If it does not directly depend on zlib then maybe you should install zlib on the side for your python binding lib (conda will solve the version that matches the rocksdb one).

hadim commented 1 year ago

Maybe ping @conda-forge/help-c-cpp here to check what's the best thing to do here.

gau-nernst commented 1 year ago

From what I check, zlib and libzlib packages are both zlib library, but they provide different library types (zlib package provides header files, static and dynamic versions of the library, while libzlib only provides dynamic version of the library).

Using either one is fine for RocksDB. However, to compile an executable (or in my case, Python binding) that uses RocksDB, I need the zlib package on Windows to link against the "import library". This problem does not exist for macOS and Linux. So in my use case, installing zlib package solves the issue and it is fine for me.

My question is more like, which part of the configuration/code in this repo that says rocksdb package depends on libzlib package? I cannot find any reference to libzlib package in this repo, only this

https://github.com/conda-forge/rocksdb-feedstock/blob/a322aade0b6c6bd5595bed6b80d5b816d59812ab/recipe/meta.yaml#L20-L32

I also wonder why there are 2 version of zlib on conda-forge, but that is not the scope of the original question.

hadim commented 1 year ago

Indeed, only zlib is in the recipe.

Unfortunately, it's beyond my knowledge here so I would suggest waiting for a conda-forge dev to jump here. Maybe you can also ask on Gitter directly at https://gitter.im/conda-forge/conda-forge.github.io