DevOps Implementation For C and C++ Projects
Take a look at how you can apply DevOps specifically for the C and C++ languages using the Conan Center for package management.
Join the DZone community and get the full member experience.
Join For FreeC and C++ communities are sitting on the world’s most extensive codebases. Many algorithms written and shared online are done in C. They’re necessarily the “universal languages” of programming languages. With an estimation of 4.5 million C++ programmers and 2 million C programmers, C and C++ are two of the world’s most popular programming languages. With an over 40-year legacy, C and C++ have been used to build every type of application, from embedded systems to mobile apps. C and C++ are also among the top five most popular languages and emphasizes the influence they still have today.
There are hundreds of programming languages in the market today, but when it comes to performance, nobody can challenge C and C++. Most notable software giants use C++ as their primary language for various purposes. Companies like Google, Facebook, SAP, Adobe, Oracle, PayPal, LinkedIn, and entire industries like automotive or manufacturing heavily rely on the power of this language. C++ is used in many real-world applications such as games, GUI based applications, embedded systems, smart cars, enterprise software, robotics, compilers, and operating systems.
You may also enjoy: Best Automated Testing Tools (Top 10) for DevOps and Continuous Delivery
Developers are always looking for ways to make things faster with C and C++ with the help of modern tools and technologies. Releasing builds faster is the biggest concern when it comes to C and C++; the community didn't even have a proper package management system until Conan was introduced.
C and C++ Are the First Choices of Developers
- According to Tiobe’s top 10 languages this April, C, and C++ gained back their top positions.
- In the IEEE Spectrum’s fifth annual interactive ranking of the top programming languages, C and C++ kept their rankings on top by beating all other hyped languages.
- Indeed, identified the most widespread programming languages at US Unicorns, and it is found that C and C++ stand out on the list.
What Is a Package Manager?
A package is an archive that holds binaries of software, configuration files, and information about dependencies, metadata, descriptions, etc. The package manager helps in the efficient reuse of the existing resources and saves a ton of time reusing others’ code (as binaries). With this, developers can easily promote all the dependencies as a bundle to the next level in the software development life cycle and collaborate for more efficiency.
A typical flow or architecture of Linux package management is shown below.
Why Package Management for C and C++?
- As C and C++ binaries cannot be built for one platform and reused in other different platforms, it is necessary to have a package manager.
- Every time you rebuild a binary, you run the risk of rebuilding it wrong.
- Sharing your binaries in version control systems as Git is a bad practice as it makes your checkout times longer.
- C and C++ projects can be huge, building from source all the time becomes unfeasible, and managing all the binaries and libraries for different platforms will be very difficult. Hence, binary package management is a must for scale.
- C and C++ have different compilers and different build systems in every single platform, and a package manager has become a necessity, something that can handle any build system
Conan, the C and C++ Package Manager
While package managers for other languages were there, C and C++ had no support for this for a very long time and this caused a lot of problems in the community and the language felt ignored from a DevOps and automation standpoint.
As discussed before, in C and C++, accomplishing binary compatibility is complicated because applications target a diversity of platforms and configurations, and each one needs its own binaries. Conan Center is an open-source C and C++ package manager, providing a solution for developers to reduce the binary compatibility problem while simultaneously supporting all major systems. Conan helps firms build applications and automate their dependencies across platforms.
The Conan package manager is a decentralized package manager for C and C++ that empowers developers to share packages through a push-pull model similar to Git. Conan uses “recipes,” structured Python scripts that outline how to build a library by explicitly calling any build system. To manage the different configurations and the ABI compatibility, Conan uses “settings,” so when a setting is changed, Conan generates a modified binary version for the same library. This way, Conan handles the binaries and helps developers working on C and C++ to upload the already built binaries to Artifactory or Bintray easily so they can be shared among the teams efficiently.
ConanCenter is the place to find and share C and C++ Conan packages for popular open source libraries. Itenables access to a multitude of configurations for each version of packages.
You start by selecting an operating system, an architecture, and a compiler to drill-down on the available binaries and find any number of configuration options.
DevOps for C/C++ projects
Continuous integration for C and C++ projects is hard due to the specific characteristics of C/C++ and the compilation to native code process, with code in header files (or even source files) being inlined, and the different linkage types for static and dynamic libraries.
C and C++ projects usually face a problem of upgrading dependencies, and it affects the CI process and from that point to the whole DevOps process. Hence, there are ongoing efforts by the OSS Conan package manager to implement tools for it and help the C/C++ community do DevOps and automation seamlessly.
Having a well-supported package management system implies having a common language and libraries that are supported uniformly by all significant compilers on all standard operating systems. Conan works great for embedded, and even bare metal. This helps to manage dependencies and binaries, so the DevOps processes are smooth and well-organized. Conan is helping C/C++ projects embrace DevOps and now with Artifactory’s support for the Conan C/C++ package manager and a fine integration with Jenkins, it is feasible to define an effective and automated DevOps workflow for C and C++ projects. This will efficiently support and manage binary creation, testing, and re-utilization, crucial in typical massive projects developed in C and C++, as well as binary generation and reuse for multiple platforms, compilers, and configurations. Conan can be used with many other technologies to accelerate your C/C++ applications, such as OpenShift. You can easily Dockerize your C++ applications and streamline the deployment using Artifactory.
Give a boost to your C/C++ projects, try the new ConanCenter, the central repository for C/C++ packages.
Further Reading
5 Free Courses to Learn C++ Programming in Depth
Published at DZone with permission of Pavan Belagatti, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments