conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
945 stars 1.72k forks source link

`zlib` does not use a correct `pkg-config` name for the library with `clang` #23058

Open mmomtchev opened 6 months ago

mmomtchev commented 6 months ago

https://github.com/conan-io/conan-center-index/blob/5b9ff5f781fee9e9eb8eaa9f78796e3277ec8855/recipes/zlib/all/conanfile.py#L103

Reproduction:

[requires]
zlib/[>=1.2.0]

[generators]
PkgConfigDeps
[buildenv]
CC=clang.cmd
CXX=clang++.cmd

[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu17
compiler.version=17
compiler.libcxx=libc++
os=Windows

[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.gnu:make_program=ninja.cmd
conan install .

I wonder what should be the correct test, since clang is not mingw? Or maybe clang should be mingw?

mmomtchev commented 6 months ago

Needs https://github.com/conan-io/conan/issues/15648 for a good solution

Any ideas for a temporary workaround when building?

mmomtchev commented 2 days ago

In conanfile.py:

    def layout(self):
      if self.dependencies['zlib']:
        # https://github.com/conan-io/conan-center-index/issues/23058
        print('Monkey patching zlib')
        zlib = self.dependencies.host['zlib']._conanfile
        zlib._package_info = zlib.package_info
        def zlib_package_info():
          zlib._package_info()
          zlib.cpp_info.libs = ['z']
        zlib.package_info = zlib_package_info