Reputation: 12522
I want to make a quick fix to one of the project's .so libraries. Is it safe to just recompile the .so and replace the original? Or I have to rebuild and reinstall the whole project? Or it depends?
Upvotes: 5
Views: 1699
Reputation: 84832
It depends. Shared library needs to be binary-compatible with your executable.
For example,
The rule of thumb (for production releases) is that, if you are not consciously aware that you are maintaining binary compatibility, or not sure what binary compatibility is, you should recompile.
Upvotes: 4
Reputation: 70204
If you don't change your library binary interface, it's ok to recompile and redeploy only the shared library.
Good references:
Upvotes: 1
Reputation: 6129
It depends yes.
However, I assume you have the exact same source and compiler that built the other stuff and now if you only change in a .cpp
file something, it is fine.
Other things e.g. changing an interface (between the shared lib and the rest of the system) in a header file is not fine.
Upvotes: 1
Reputation: 229128
If you have not changed the ABI of the shared library, you can just rebuild and replace the library.
Upvotes: 1
Reputation: 81694
That's certainly the intent of using dynamic libraries: if something in the library needs updating, then you just update the library, and programs that use it don't need to be changed. If the signature of the function you're changing doesn't change, and it accomplishes the same thing, then this will in general be fine.
There are of course always edge cases where a program depends on some undocumented side-effect of a function, and then changing that function's implementation might change the side-effect and break the program; but c'est la vie.
Upvotes: 1