I am a noob with linux and I use Synaptic package manager to install all the software I need. I did so also for mathgl, the library for scientific graphs.
Recently a new version appeared online, but not in the package manager. I downloaded the sources and tried to install it manually. The instructions said:
cmake .
cmake .
make
make install
I did exactly the same, but then I realized that I forgot some build options. I did a web search to find a way how to uninstall the library, so that I can install it with the new settings, but I did not get a clear answer. What I found out is that when it comes to uninstalling under Linux, unless the developer provided an uninstall script, you are on your own and it is not trivial.
With this in mind I just tried to install the library without removing the misconfigured one.
cmake -D enable-all=on -D enable-langall=on .
cmake -D enable-all=on -D enable-langall=on .
make
make install
Everything seems to be fine. My question is this: is there any chance that the consequence of my action will come back to haunt me?
I am also concerned, because the old library was not removed as well as the old headers. Another strange thing is that the old headers are in
/usr/lib/mgl
while the new ones are in
/usr/local/lib/mgl2
Is there any explanation for this?
Maybe. Read on:
The new ("enable...:) configured libraries have overwritten the new misconfigured libraries you installed...no harm done.
The new libraries are installed under
/usr/local
because that's the default for a lot of Linux distributions, but not Ubuntu; Ubuntu puts them under/usr
. The former is OK for binaries (/usr/local/bin
), which Ubuntu has in its default path, and those will take precedence over any binaries installed in/usr/bin
, but this is not true for libraries, because/usr/local/lib
is not in the default path.Any programs that use this library will continue using the older headers/version in
/usr/lib
, unless you specifically tell those programs to use the new ones, e.g. by prefixing them withLD_LIBRARY_PATH=...
or by explicitly adding/usr/local/lib
to your path. For compiling things which depend on this library, you'll need to explicitly specify the/usr/local/lib
path to include the new headers.To fix this:
make install
step to give you a deb file that is easy to install and uninstall.-DCMAKE_INSTALL_PREFIX=/usr
directive before compiling.That should do it!
Well, the new one it is using the libs from
/usr/local/lib
(this is a common place for softwares installed by the user). This is actually good thing, the main ideea it is to not to corrupt the packages installed via package managers.The location of the libs are defined usually in the Makefile. I recommend to not to touch that unless you know what you are doing. The version compiled by yourself will use the libs from
/usr/local/lib
, the other version installed from repo will use the standard/usr/lib
location.