Skip to content

[bug] CMakeDeps throws error for package(s) defined as platform_requires #3908

@kambala-decapitator

Description

@kambala-decapitator

Describe the bug

macOS 14.7, Conan 2.9.2, apple-clang 15

I declared some libs as platform_requires (Apple OSs have them preinstalled in the system), everything built fine. But at the final moment when CMakeDeps starts its work it throws an error:

ERROR: Error in generator 'CMakeDeps': error generating context for 'ffmpeg/7.0.1': ffmpeg/7.0.1: component 'avcodec' required 'zlib::zlib', but 'zlib' is not a direct dependency

Also, had to tune a few other recipes a bit that they don't throw an error when trying to access the platform_requires libs from self.dependencies, see here. Is it to be considered a bug or should be adjusted on a recipe basis?

Previously in Conan v1 I wrote wrapper recipes for these libs and there was no such issue. Oh, actually I faced one issue that resembles the self.dependencies one described above for which I provided a PR conan-io/conan-center-index#23478, but no issues with CMakeDeps.

P.S. Also asked this on Slack

P.P.S. One more example of such error, but no full log at hand at the moment:

ERROR: sdl_mixer/2.8.0: Error in generate() method, line 227
	deps.generate()
	ConanException: error generating context for 'openssl/3.3.2': openssl/3.3.2: component 'crypto' required 'zlib::zlib', but 'zlib' is not a direct dependency

How to reproduce it

conanfile.txt

[requires]
ffmpeg/7.0.1

[generators]
CMakeToolchain
CMakeDeps

Build profile (basically the detected one):

[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=15
os=Macos

[platform_tool_requires]
cmake/3.31.0
ninja/1.12.1

Host profile: same as build (used include) with the addition of

[platform_requires]
bzip2/1.0.8
libiconv/1.17
sqlite3/3.47.0
zlib/1.2.11

Command used:

conan install . -pr:b default -pr:h 'default copy' -of 1 -b missing

Full log: log.txt.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions