xpam.pl

Love hate relationship with conan.io

Introduction

conan was supposed to finally solve the decade long issue of getting your build dependencies on Windows (and Linux but to a lesser extent because package managers have already solved that problem there).

Before that you either had to build from source or find pre-built binaries from sometimes questionable sources. Building from source is a major PITA because each dependency has different steps, requires different tooling, has it’s own dependencies.. Luckily most projects have finally standardized on using CMake (or Meson) so at least we’re heading in a good direction there.

When I started to get into conan my expectations were at the level of package managers I already knew: maven, which I consider the gold standard that has worked well for decades and npm, not because I consider it a great solution but because it’s relatively simple to understand and use.

Before we dive into my issues with conan, I must acknowledge that vcpkg exists and is supposedly easier to use but I’ve never tried it so I can’t comment on that.

conanfile.txt

Before you even begin you are given two choices, use a txt or a python file which is mistake number one, don’t give a choice but enforce a standard. Conanfile.txt is completely useless for anything more than a hello_world.cpp and should never have existed. As soon as you want to do anything remotely useful in a real world scenario you need to use conanfile.py. You usually find that out several hours into the project and then need to rewrite your .txt to .py.

Which bring me to my next point..

conanfile.py

I think having your dependencies described as a static configuration file like pom.xml or package.json makes more sense and is safer. It enforces a certain schema and order. Instead, you can basically write full python code and shoot yourself in the foot. Yes, it is powerful but why do you need all that power? A well designed schema should cover 95% of use cases which require no dynamic scripting, and the final 5% can be solved with other means like hooks and plugins.

Also, it requires you to learn some python which I have been trying to avoid all my life, somewhat successfully so far.

conan 2.0

It is not very confidence inducing when you have a v2 which breaks heavily with v1 and relatively early in project cycle. While the changes all seem good on paper, I am yet to dabble into truly advanced stuff so from my perspective, it breaks the cli compatibility, has a ton of missing packages which will take years to port and every time I search for something on google I am getting results for v1 because of historic google bias.

conan index

Index is backlogged for months (years?), pull requests going stale and lingering, not getting merged even if they are essentially ready. Many packages which were present in v1 are still missing in v2 and this will block you from upgrading to 2.0. Check if all your dependencies are ported before you upgrade!

Github stats are showing a slightly optimistic trend in that more pull requests are resolved than open each month so hopefully there will be some backlog resolution this year. It seems there are not enough reviewers available and I am not sure what the plan is to resolve that.

Another issue I have is that many build combinations are simply missing. I am not even talking any exotic architectures here, just normal targets like Windows amd64 or x86 with the latest Visual Studio or Debian stable on the Linux side. This is without any custom options for a specific package being set. I’d say that I am building packages locally more often than getting binaries. which kind of defeats the purpose of a package manager.

At least the local builds seem to work fine most of the time and my 16 core Ryzen doesn’t seem to care.

Too many ways you can integrate with CMake

In many ways when I started with v1, it felt like conan tried to be more than just a package manager but dictate how you should rework your CMake project to accommodate it into the workflow or even overlap with CMake functionality in certain areas.

2.0 promises to finally integrate with CMake without touching CMakeLists.txt or very close to that using presets. Yay!

Bizarre bugs

How can a recipe building for Windows host produce a libsomething.a but it is really just a .lib in hiding?

 

I hope I wasn’t being too harsh on conan and I am hoping some of the issues will improve through time. My next goal is to try and package up some of my old libraries and go through the submission process. I am certainly not giving up on conan anytime soon.

158 Total Views 2 Views Today


Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs

Posted

in

by

Tags: