New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[zlib] zlib/1.2.12: Compilation with Clang on Windows produces the wrong library name (z.lib instead of zlib.lib) #13474
Comments
This breaks every library that depends on zlib (so you can imagine that is a lot) for me when I compile with clang + Ninja on Windows. I'm not quite sure if this is an issue on the conan recipe or the zlib cmake setup. |
Interesting. Just wondering. It seems that "UNIX" is somehow defined for this use-case? https://github.com/madler/zlib/blob/04f42ceca40f73e2978b50e93806c2a18c1281fc/CMakeLists.txt#L168 |
Interesting catch @HappySeaFox From the documentation of UNIX variable, maybe CMake considers (at least the scoop's version of) Clang to be |
If I build zlib myself using |
I am not used to looking at conan recipes, but guess this line just determines what file gets packaged, it doesn't affect the output. Is that correct? |
On a closer look I believe the error must lie here where the wild assumption is made that any non- @SpaceIm pinging you as that change came from your end. What was the rationale behind the change and are there no regression tests or the like? I would gladly fix it myself, but I would appreciate some guidance (specifically for adding tests) because I have extremely limited time right now. It seems especially crucial to me that a library as ubiquitous as zlib has tests that verify it works on a broad set of compilers and platforms. |
CCI and conan client don't properly support clang on Windows currently. Many recipes are broken for this compiler/os, and it's very hard to know which flavor of windows clang has been used based on conan profile. There were recent improvements in conan client, but I don't know how to handle this in a recipe. The main issue we have usually is that /cc @memsharded @SSE4 for advices, because currently clangcl handling is complete mess in conan-center and we don't know how to properly detect it nor what a canonical profile for each flavor should look like. Anyway, clangcl is not tested in c3i (like MinGW, Intel compiler, cross-build to Android, iOS, etc), so you can't expect premium support, anybody can break this settings in a PR. |
This approach of not supporting clang on Windows is quite disappointing. I'd much rather be told by my tool that something isn't supported and error out rather than having random breakages in arbitrary packages. That aside I get that working with clang on Windows is a tad more annoying and tedious than MSVC but I don't quite understand the criteria for not testing/supporting it. I don't have numbers to back this up so if you like you can disregard this statement, but I wager that clang on Windows is used plenty enough to be a valuable inclusion to the conan teams thoughts and tests. Edit: I should also not that the OP and I are not complaining about clang-cl not working on Windows but plain clang not working. The previous comment made it sound like we were complaining about clang-cl. Not that it matters much I reckon, but I still wanted to clarify. |
Yes, zlib recipe works for clang-cl (and before this special management it was broken for clang-cl but fine for other flavors) but not for other flavors of clang on Windows, because conan client didn't provide a predictable way to know this flavor from profile. Now it might be better since conan-io/conan#11492, but it requires conan 1.53.0 and it's not even deployed in c3i. |
What do you mean? There is no standard name on Windows (maybe just for MinGW where it has always been libz.a/libz.dll.a/zlib1.dll in msys2/pacman, so we can consider these names as standard names): madler/zlib#652, so downstream shouldn't expect any specific name but rely on pkgconf or FindZLIB.cmake or a plenty of different flavors. For example if you take a look at FindZLIB.cmake, they try many different names in order to locate zlib binary. If you mean that package_info() is broken for clang on Windows (if not clang-cl), yes it's true (
Yes, but zlib recipe has a CMakeLists patch to change this name depending on the compiler, because it produces libzlib.dll.a or libzlibstatic.a for MinGW for example, and they are not the canonical names for MinGW. zlib build systems (CMake, autotools, NMake, MSBuild) are not consistent, that's the problem. It's explained in madler/zlib#652 |
yes, you basically shouldn't care if it's named |
To confirm, I am indeed also using non
@SSE4 We are using Conan's
|
I've opened conan-io/conan#12336. I believe that we can't do anything robust currently without such method. |
@SSE4 I might also not have been clear, but my issue is with other recipes that fail linking against zlib during build because they expect |
@Malacath-92 that sounds like discrepancy between the reality (how file could be named on disk) and conan's |
A bit "higher level" than this specific issue, but I love this idea. Having |
Here is a proposal: #13597 |
Good job @SpaceIm! |
Description
To elaborate on the title:
When building
zlib
on Windows with MSVC, the produced library is namedzlib.lib
, as intended by all generators which try to locate a file with basenamezlib
.If
zlib
is built with Conan 15 on Windows, the produced library is namesz.lib
instead, which breaks downstreams because they expectzlib
basename.Package and Environment Details
scoop install llvm
)Conan profile
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=clang
compiler.cppstd=20
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
*: cmake/3.24.1
[env]
CONAN_CMAKE_GENERATOR=Unix Makefiles
[conf]
tools.cmake.cmaketoolchain:generator=Unix Makefiles
Steps to reproduce
Build zlib:
Then locate the build package in the filesystem, and take a look under
lib/
folder. It will containz.lib
for Clang builds, andzlib.lib
for MSVC builds.Logs
Click to expand log
It is more of filename issue than a log error per se.
The text was updated successfully, but these errors were encountered: