Conan-center-index: [zlib] zlib/1.2.11: Build failed with apple clang 12

Created on 22 Sep 2020  路  10Comments  路  Source: conan-io/conan-center-index

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: zlib/1.2.8
  • Operating System+version: MacOS 10.15.4
  • Compiler+version: Apple clang 12.0.0
  • Conan version: conan 1.29.2
  • Python version: Python 3.7.7

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

Put your profile output here

Configuration for profile default:

[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

Try to build zlib 1.2.11 version with apple clang 12 (Xcode 12)

Logs (Include/Attach if Applicable)

Same issue as reported here: https://github.com/madler/zlib/pull/509

Put your log output here

https://github.com/madler/zlib/pull/509

bug

All 10 comments

Which revision of zlib recipe? Seems that this issue should have been fixed by https://github.com/conan-io/conan-center-index/pull/2403

conan install -u zlib/1.2.11@ -b outdated

@nikhiljain217
~You might have closed madler/zlib#509 too soon as its CMakeLists.txt is incorrect.
It requires the same include checks, as the autotools script does.~

I'm running into the exact same problem ...
This is one of the dependencies I'm trying to build:
zlib/1.2.11@conan/stable

@KaoCC @nikhiljain217
Can you try adding applying the following patch?

--- a/recipes/zlib/1.2.11/conanfile.py
+++ b/recipes/zlib/1.2.11/conanfile.py
@@ -88,6 +88,8 @@
         for patch in self.conan_data["patches"][self.version]:
             tools.patch(**patch)

+        os.unlink(os.path.join(self._source_subfolder, "zconf.h"))
+
         with tools.chdir(self._source_subfolder):
             # https://github.com/madler/zlib/issues/268
             tools.replace_in_file('gzguts.h',
@@ -96,7 +98,7 @@

             is_apple_clang12 = self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "12.0"
             if not is_apple_clang12:
-                for filename in ['zconf.h', 'zconf.h.cmakein', 'zconf.h.in']:
+                for filename in ['zconf.h.cmakein', 'zconf.h.in']:
                     tools.replace_in_file(filename,
                                           '#ifdef HAVE_UNISTD_H    '
                                           '/* may be set to #if 1 by ./configure */',
--- a/recipes/zlib/1.2.8/conanfile.py
+++ b/recipes/zlib/1.2.8/conanfile.py
@@ -46,6 +46,7 @@
             os.chmod(configure_file, st.st_mode | stat.S_IEXEC)

     def build(self):
+        os.unlink(os.path.join(self._source_subfolder, "zconf.h"))
         if self.settings.os != "Windows":
             with tools.chdir(self._source_subfolder):
                 env_build = AutoToolsBuildEnvironment(self)

Which revision of zlib recipe? Seems that this issue should have been fixed by #2403

conan install -u zlib/1.2.11@ -b outdated

I have created a conanfile to install the dependency. I am adding this "zlib/1.2.11@conan/stable" to the self.requires. I did not realize that "zlib/1.2.11@conan/stable" is not cci recipe. Changing the recipe to use "zlib/1.2.11" worked. If it works for other people here. You can close this issue.

@username/channel is optional for a while now.

All packages in the Conan Center Index don't have a @username/channel anymore. Packages with a @username/channel do come from places like conan-community (@conan)) and Bincrafters (@bincrafters)) .

If packages are both in Conan Center Index AND in conan-community or Bincrafters, only the recipe in Conan Center Index is still maintained, so you should migrate to those recipes.

Short version: Use zlib/1.2.11 instead of zlib/1.2.11@conan/stable

@KaoCC
Is the problem still present from you?
https://github.com/conan-io/conan-center-index/issues/2986#issuecomment-698013724 says it is fixed.
If it is not for you, are you sure you're using the latest zlib version?
If it is still not working after that, can you try https://github.com/conan-io/conan-center-index/issues/2986#issuecomment-698010142?

@madebr I will try again now. The thing is that I was not building zlib directly, but restinio/0.6.10 which transitively depends on zlib in one of its dependencies.

@madebr Hi, I changed in the [requires] the depended boost library from 1.70 to 1.73, which seemingly depends on zlib/1.2.11 (the cci version according to what is said on top) , and now it can be built correctly.

@KaoCC
Thanks for checking!

@nikhiljain217
You can close this issue now.

Was this page helpful?
0 / 5 - 0 ratings