The most common way that people do this is installing the library on the compute nodes as well. Sometimes this means installing it on a subset of the nodes, marking those nodes with a feature, and then requiring that feature for the nodes that a specific job will use. Other times its installing the library everywhere so that you don't have to worry about it, but these are the most common approaches towards this problem.
If the versioning is too hard to manage on the compute nodes, then compiling the library statically into your program is probably the only option you have.