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:
- How do you package and deploy shared libs with Conan and version them correctly on the deployment machine?
- How do you package your applications which use the shared libraries?
- 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.
conan installdoes what you need. It's also possible to use virtualenv if defining install path prefix is not enough.systemddetail 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.deployersto 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.