I found a library, libjson
, that I am trying to build as a shared library and use in a project. Building is simple enough; after fixing a Makefile bug,
# SHARED=1 make install
will compile and install a .so
in /usr/lib
. The problem is that my system (Arch Linux) already has a library named libjson
, which the Makefile thoughtlessly overwrites for me! Arch's library was installed as a dependency, so it can't be replaced. Presumably other distros would have a similar problem if they had a library named libjson
.
What can I do about this? I could rename the library (libjson-mine
or something), but dynamic linking is only a couple steps away from magic, so I have no idea if this will break something. How can I rename the library?
The other option is to drop the library's source code into my current project's source tree and have the builder make a static library instead. (Obviously this makes my code's repository a bit messier, hence the undesirability.) If I went this route, I'd need to make the linker prefer my libjson.a
instead of searching /usr/lib
for a "suitable" (read: wrong) library. How do I make the linker prefer my version?
Or, is there a third option that I'm not aware of?