question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package dependency collision

See original GitHub issue

I’m trying to add some conan packages to my cmake project namely opencv & boost. When I do so using the following two cmake function calls:

conan_cmake_run(REQUIRES opencv/4.3.0@channel/user
        BASIC_SETUP CMAKE_TARGETS
        BUILD missing
        PROFILE_AUTO ALL)
conan_cmake_run(REQUIRES boost/1.73.0@channel/user
        BASIC_SETUP CMAKE_TARGETS
        BUILD missing
        PROFILE_AUTO ALL)

I get an error in the second call that looks like this:

 add_library cannot create imported target "CONAN_LIB::zlib_z" because
  another target with the same name already exists.

It seems the problem is that both opencv & boost have a zlib dependency which is being added a second time in the setup of the boost package. It seems quite a common occurrence that multiple packages have a dependency for the same package. What is the recommend way to deal with this in cmake-conan?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Timencommented, Feb 4, 2022

thanks for the info! I think this is probably something to add to the Readme, I may open a pr for that later on once I have some more familiarity.

0reactions
Timencommented, Feb 4, 2022

That would probably work as-well but seems less convenient I’ll just stick to either using:

conan_cmake_configure(REQUIRES opencv/4.3.0@channel/user
                                                             boost/1.73.0@channel/user 
                                            GENERATORS cmake_find_package_multi)

or

conan_cmake_configure(REQUIRES opencv/4.3.0@channel/user
                                            GENERATORS cmake_find_package_multi)

Depending on the build configuration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Dependencies - Everything You Need to Know
An example of a transitive dependency conflict would be when multiple packages depend on different versions of dependency C. The rest of this ......
Read more >
How to identify and resolve a dependency conflict
Find Divio's how-to guide to identifying and resolving a dependency conflict. Learn what steps to take if a deployment in the cloud or...
Read more >
Dependency Resolution - pip documentation v22.3.1
Dependency Resolution#. pip is capable of determining and installing the dependencies of packages. The process of determining which version of a dependency ......
Read more >
How to Resolve a Version Collision of Artifacts in Maven
Version collision happens when multiple dependencies link to the same artifact, but use different versions. As a result, there may be errors in ......
Read more >
The Nine Circles of Python Dependency Hell - Medium
Circle 5: Internal transitive dependency conflict. You may run into a situation where two of your internal dependencies are demanding non-overlapping versions ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found