0

To give a brief overview of my situation. I have a monorepo consisting of 4 libraries and N executables using these libraries. I am using Conan 2.x with the incubating workspaces feature to manage to monorepo builds. As all of my applications will use the same 4 libraries I'd like these libraries to be shared. All of the libraries and applications are packaged with Conan and pushed to artifactory. My question is what is the standard C++ way of shipping software with shared libraries. Conan gives you great flexibility as I can theoretically run app/1.0.0 which depends on lib/0.0.1 and app/1.1.0 which depends on lib/0.0.2 for example. However, shared libraries need some information regarding where to be found when deployed on a machine. What is the preferred way and idiom for deployment (not into system libs locations please). I need to be able to have multiple versions of the same shared library on the same machine. Multiple versions of the same binary on the same machine which can potentially use the 2 or more version of the shared library. In reality this scenario will not happen that often, however, for testing purposes I will be running 2 versions of the shared library and 2 version of the application. How can this be deployed? So far using CMake I have come up with maybe using:

set_target_properties(app_one PROPERTIES
  INSTALL_RPATH "$ORIGIN/../lib"
)

However this solved the case where we have one version of the library on the machine. If we have multiple versions I am unsure how to correctly deploy? I'd like to ensure that we do not need to bake in the version of the library in the CMake of the app as this is prone to errors when operating CMake + Conan. If we bake the version of the library in the path and somebody forgets to update the Conan file or vice-versa the application will still use the wrong library. I'd like your input on:

  1. How do you package and deploy shared libs with Conan and version them correctly on the deployment machine?
  2. How do you package your applications which use the shared libraries?
  3. How do you keep the environment in a semi-clean state AKA perform maintenance task like cleaning up old library / app versions which are unused?

For the record I have to run the applications on bare metal instances without container solution so anything using Docker is out of question for managing environment.

4
  • But Conan does exactly that what you are asking for, nope? The whole point of that package manager is manage dependencies to different versions of libraries. It's all described in the docs, the basic example is using both shared and static libraries. Not sure how to answer your points, simple conan install does what you need. It's also possible to use virtualenv if defining install path prefix is not enough. Commented May 21 at 13:28
  • Maybe I am over complicating it. Yes conan install does that I struggle to conceptualize when I deploy to a remote server lets say ec2. My applications need to run as systemd services. If I install them using conan install (and I specify build=never to ensure we only get already build binaries by the CI) will the app automagically use the correct paths for the shared libraries. Since the application will be built on a build server and the package has to then be deployed on a different server. So we need to ensure correct paths are preserved for deployment purposes. Commented May 21 at 13:53
  • systemd detail might be important here. Seems that the problem can be narrowed down to how you should provide correct environment to your systemd app, e.g. libraries paths. Commented May 21 at 14:07
  • It seems this question is mostly unrelated to Conan, in the sense that Conan versions "development" packages, but the mechanisms to deploy in different platforms are wildly different, from Debian packages, Windows Msis installers, etc. etc. Conan implements the deployers to be able to extract artifacts like executables, shared libraries and licenses out of the Conan packages for the final deployment. But how those artifacts are deployed, versioned, updated, etc in the final deployment target depends on such target. Commented May 21 at 14:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.