handmade.network » Forums » C/C++ virtual environment/package manager, how to deal with external libraries?
hugoA
Hugo
1 posts
#11634 C/C++ virtual environment/package manager, how to deal with external libraries?
2 months, 2 weeks ago

Hello everyone!

This is my first post in the forum and I wonder if I'm posting it in the right place... please correct me if I'm wrong.

I was trying to compile MotionBox (for dev, the distribution package works as a charm), in my arch linux system, and I found many problems with unmatched dependencies, just to mention a couple: I had a version of Qt but some header files were missing, I had a different version of libtorrent, etc.

Now, this is question is not really about MotionBox, I notice this is one of most bigger pains for me when it came to programming (or at least contributing) to projects in C/C++, having system wide libraries which are also dependencies for a lot of the software that's installed in the system (meaning if I change the "global" Qt version I might break other software).

I thought about using docker or something like that, but I can see some disadvantages of this approach when it comes to low level programming. Googling around I also found this: http://blog.conan.io/2016/08/04/C...-Manage-your-C-and-C++-tools.html

Anyway, I bet there is probably a solution for this problem but I never figured it out, how you deal with this sort of stuff?.

Thanks a lot in advance!
mmozeiko
Mārtiņš Možeiko
1349 posts
1 project
#11641 C/C++ virtual environment/package manager, how to deal with external libraries?
2 months, 2 weeks ago

In ArchLinux typical way to deal with older package versions is just to create alternative packages which gets installed in parallel with normal packages.

If package has ABI version number in its name, then it can be installed in regular /usr prefix. That's for example what is done with older ncurses or libstdc++ libraries.

Alternative option is simply to install files to alternative location, typically /opt/something. And then make your package to look for files in this folder instead of /usr/... For example, that's how you can install Qt 5.1 in parallel to your regular Qt 5 libraries: qt51-base.