Package Management in C/C++ and its Application in SOA Automotive Software Development

*Author: KimChan

Why consider C/C++ package management?

Since the concept of software-defined cars became popular in the industry, it has been clear that software will play a very important role in future car product development.

Different from traditional MCU development, when proposing SOA-oriented service architecture based on heterogeneous SoC development, it can be anticipated that there will be more and more applications deployed in the form of packages.

Regarding the focus or difficulty of automotive software development, you can read the previously published article: Automotive SOA Architecture Technology Points and Challenges.

Especially as a low-level software supplier or system integration supplier (maybe OEM itself), such a large-scale project based on C/C++, if still managed in a traditional way, it will definitely encounter problems including but not limited to:

  • Complicated build systems: gcc, clang, qcc, Ninja, cmake, makefiles, etc.

  • Dizzying build settings: operating system, architecture, compiler type/version, etc.

  • Dependency invisibility: unable to build dependencies in a modular way.

Unlike js with npm, python with pypi, etc., C/C++ seems to be difficult to answer a user-friendly and reliable package manager for you.

Especially, testing and verification in automotive software development often deal with hardware, which consumes a lot of time. We must consider how to efficiently use the CI/CD system during the transition to SOA architecture for development and verification. Developers cannot refer to various dependencies and repeat builds for changes to a package.

Conan

Let’s first see how the official introduction explains it:# Conan: A Dependency and Package Manager for C and C++ languages

Conan is a free and open-source package manager for C and C++ languages. It works on various platforms including Windows, Linux, OSX, FreeBSD, Solaris, and more, and is suitable for developing for different targets such as embedded, mobile (iOS, Android), and bare metal. It integrates well with popular build systems like CMake, Visual Studio (MSBuild), Makefiles, SCons, and proprietary ones.

Similar to NPM for js, Conan has Jfrog Artifactory to avoid unnecessary package builds. However, companies could establish their own private servers if required.

Building Binary Packages

You can specify your source code and some build variables to generate the corresponding output files as shown below.

If you use different build systems, you only need to write the corresponding build info.

When you set different build options based on the same source code, you can get different packages generated by a recipe.

 ## Management of Binary Packages

One of the most important features of Conan is that it can create and manage compiled binary files for any platform and configuration only, which avoids redundant building and saves a lot of time for development and continuous integration. At the same time, it also provides good reproducibility and file traceability.

These package configurations are written in “connanfile.py”, which needs to define package dependencies, source code (path), build method, etc. A recipe can generate many binary files, each of which corresponds to a specific operating system, architecture, compiler, build type, etc.

That is to say, if your colleague needs to build the project as well, if you have already uploaded the corresponding binary file “mylib”, then when he builds with the same configuration, Conan can help your colleague directly obtain it from the server without spending time rebuilding:

Installation of Conan

There are multiple installation methods for Conan, but the officially recommended one is to use pip:

pip install conan

In addition, you need to ensure that the Python version on your computer is >= 3.5.

Please stay tuned for more articles on how to use Conan.

Application in Automotive Software Development

As mentioned at the beginning of the article, now every car manufacturer is striving to develop its own automotive operating system. When application developers get the SDK, they can quickly establish an application development project, write code logic, and build binary files for subsequent integration testing, deployment, and updates with the help of Conan’s functionality. This will be particularly helpful for managing internal or multiple vendor apps.

This article is a translation by ChatGPT of a Chinese report from 42HOW. If you have any questions about it, please email bd@42how.com.