Description
What is your question?
Hi, I would like to start using conan, but I already struggle with the first tutorial. I had some issues initially because I am using the MSYS64 clang64 toolchain on Windows, but I have resolved those now, and can at least get the conan install
working, after having tweaked my profile and global.conf
.
However, now I am running into a new problem when trying to build:
CMake Error at build/cmakedeps_macros.cmake:67 (message):
Library 'zlib' not found in package.
I have already looked at the two issues conan-io/conan#13963 and conan-io/conan#15473, but unfortunately, they weren't of much help, as they also had slightly different errors than mine.
I have also tried @memsharded's comment conan-io/conan#13963 (comment), but that yielded the exact same result.
I am on Windows 11 and am using the following tools:
- Conan v2.2.2 (installed via
pip
) - CMake v3.29.0
- Ninja v1.11.1
- Clang v18.1.2 (Target:
x86_64-w64-windows-gnu
; Thread model:posix
) - PowerShell v7.4.1 in Windows Terminal
I am trying to finish the first tutorial, and haven't changed any of the files in the examples2/.../simple_cmake_project
repo after having cloned it. I am also using presets, but I have tried it using the "manual command" with -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
as well -- without success.
Here is the output of my command line:
Transcript
=> conan install . --output-folder=build --build=missing
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=18
os=Windows
[conf]
tools.build:compiler_executables={'c': 'C:/msys64/clang64/bin/clang.exe', 'cpp': 'C:/msys64/clang64/bin/clang++.exe'}
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:powershell=True
tools.microsoft.msbuild:installation_path=""
[buildenv]
PATH+=(path)C:/msys64/clang64/bin
[runenv]
PATH+=(path)C:/msys64/clang64/bin
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=18
os=Windows
[conf]
tools.build:compiler_executables={'c': 'C:/msys64/clang64/bin/clang.exe', 'cpp': 'C:/msys64/clang64/bin/clang++.exe'}
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:powershell=True
tools.microsoft.msbuild:installation_path=""
[buildenv]
PATH+=(path)C:/msys64/clang64/bin
[runenv]
PATH+=(path)C:/msys64/clang64/bin
======== Computing dependency graph ========
zlib/1.2.11: Not found in local cache, looking in remotes...
zlib/1.2.11: Checking remote: conancenter
zlib/1.2.11: Downloaded recipe revision fca992a7d96a1b92bd956caa8a97d18f
Graph root
conanfile.txt: C:\Users\Marcel\source\c-and-cpp\examples2\tutorial\consuming_packages\simple_cmake_project\conanfile.txt
Requirements
zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f - Downloaded (conancenter)
======== Computing necessary packages ========
Requirements
zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f:f31972e2002aeb6fb3f7f5bb889b52794c5199af - Build
======== Installing packages ========
zlib/1.2.11: Sources downloaded from 'conancenter'
zlib/1.2.11: Calling source() in C:\Users\Marcel\.conan2\p\zlibdb1c5346ffee7\s\src
-------- Installing package zlib/1.2.11 (1 of 1) --------
zlib/1.2.11: Building from source
zlib/1.2.11: Package zlib/1.2.11:f31972e2002aeb6fb3f7f5bb889b52794c5199af
zlib/1.2.11: Copying sources to build folder
zlib/1.2.11: Building your package in C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\b
zlib/1.2.11: Calling generate()
zlib/1.2.11: Generators folder: C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\b\build\Release\generators
zlib/1.2.11: CMakeToolchain generated: conan_toolchain.cmake
zlib/1.2.11: CMakeToolchain generated: CMakePresets.json
zlib/1.2.11: CMakeToolchain generated: ..\..\..\src\CMakeUserPresets.json
zlib/1.2.11: Generating aggregated env files
zlib/1.2.11: Generated aggregated env files: ['conanbuild.ps1', 'conanrun.ps1']
zlib/1.2.11: Calling build()
zlib/1.2.11: Apply patch (conan): separate static/shared builds, disable debug suffix, disable building examples
zlib/1.2.11: Apply patch (portability): fix condition for WIDECHAR usage
zlib/1.2.11: Running CMake.configure()
zlib/1.2.11: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\b\src"
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Using Conan toolchain: C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The C compiler identification is Clang 18.1.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/clang64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
-- C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/b/src/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- Configuring done (2.8s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/b/build/Release
zlib/1.2.11: Running CMake.build()
zlib/1.2.11: RUN: cmake --build "C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\b\build\Release" -- -j16
[1/16] Building C object CMakeFiles/zlib.dir/uncompr.c.obj
C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/b/src/uncompr.c:27:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
27 | int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
| ^
C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/b/src/uncompr.c:86:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
86 | int ZEXPORT uncompress (dest, destLen, source, sourceLen)
| ^
2 warnings generated.
[... A bunch of warnings generated ...]
22 warnings generated.
[16/16] Linking C static library libz.a
zlib/1.2.11: Package 'f31972e2002aeb6fb3f7f5bb889b52794c5199af' built
zlib/1.2.11: Build folder C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\b\build\Release
zlib/1.2.11: Generating the package
zlib/1.2.11: Packaging in folder C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\p
zlib/1.2.11: Calling package()
zlib/1.2.11: Running CMake.install()
zlib/1.2.11: RUN: cmake --install "C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\b\build\Release" --prefix "C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/p"
-- Install configuration: "Release"
-- Installing: C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/p/lib/libz.a
-- Installing: C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/p/include/zconf.h
-- Installing: C:/Users/Marcel/.conan2/p/b/zlibdb7ac87753258/p/include/zlib.h
zlib/1.2.11: package(): Packaged 2 '.h' files: zconf.h, zlib.h
zlib/1.2.11: package(): Packaged 1 '.a' file: libz.a
zlib/1.2.11: package(): Packaged 1 file: LICENSE
zlib/1.2.11: Created package revision 208eb55526fe962745b4b162cc7e378e
zlib/1.2.11: Package 'f31972e2002aeb6fb3f7f5bb889b52794c5199af' created
zlib/1.2.11: Full package reference: zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f:f31972e2002aeb6fb3f7f5bb889b52794c5199af#208eb55526fe962745b4b162cc7e378e
zlib/1.2.11: Package folder C:\Users\Marcel\.conan2\p\b\zlibdb7ac87753258\p
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated: 'cpp_info.names' used in: zlib/1.2.11
======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to C:\Users\Marcel\source\c-and-cpp\examples2\tutorial\consuming_packages\simple_cmake_project\build
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(ZLIB)
target_link_libraries(... ZLIB::ZLIB)
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: Preset 'conan-release' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-release' if using CMake>=3.23
conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G Ninja -DCMAKE_TOOLCHAIN_FILE=C:\Users\Marcel\source\c-and-cpp\examples2\tutorial\consuming_packages\simple_cmake_project\build\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
conanfile.txt: CMakeToolchain generated: CMakePresets.json
conanfile.txt: CMakeToolchain generated: ..\CMakeUserPresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.ps1', 'conanrun.ps1']
Install finished successfully
=> cmake --preset conan-release
Preset CMake variables:
CMAKE_BUILD_TYPE="Release"
CMAKE_POLICY_DEFAULT_CMP0091="NEW"
CMAKE_TOOLCHAIN_FILE:FILEPATH="C:\Users\Marcel\source\c-and-cpp\examples2\tutorial\consuming_packages\simple_cmake_project\build\conan_toolchain.cmake"
Preset environment variables:
PATH="C:\Program Files\PowerShell\7;D:\dev_tools\python\Scripts\;D:\dev_tools\python\;D:\dev_tools\VulkanSDK\Bin;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\windows\system32\openssh\;c:\program files (x86)\gnupg\bin;D:\dev_tools\git\bin;c:\msys64\usr\bin;c:\msys64\clang64\bin;D:\dev_tools\cmake\bin;D:\dev_tools\ninja\bin;D:\dev_tools\node;D:\dev_tools\jdk\bin;D:\dev_tools\Android\cmdline-tools\latest\bin;D:\dev_tools\Android\platform-tools;D:\dev_tools\Android\emulator;D:\dev_tools\watchman\bin;c:\program files\dotnet\;C:\Program Files\PowerShell\7\;C:\Users\Marcel\AppData\Local\Microsoft\WindowsApps;C:\Users\Marcel\AppData\Local\Programs\oh-my-posh\bin;C:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\bin;;C:\Users\Marcel\AppData\Local\Programs\oh-my-posh\bin;C:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Marcel\.dotnet\tools;C:/msys64/clang64/bin"
-- Using Conan toolchain: C:/Users/Marcel/source/c-and-cpp/examples2/tutorial/consuming_packages/simple_cmake_project/build/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 20 with extensions OFF
-- The C compiler identification is Clang 18.1.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/clang64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Conan: Target declared 'ZLIB::ZLIB'
CMake Error at build/cmakedeps_macros.cmake:67 (message):
Library 'zlib' not found in package. If 'zlib' is a system library,
declare it with 'cpp_info.system_libs' property
Call Stack (most recent call first):
build/ZLIB-Target-release.cmake:23 (conan_package_library_targets)
build/ZLIBTargets.cmake:24 (include)
build/ZLIBConfig.cmake:16 (include)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
If you would need any further information, please let me know. I hope someone could help me resolve this issue, thanks in advance!
Have you read the CONTRIBUTING guide?
- I've read the CONTRIBUTING guide