Search code examples
c++linkershared-librariesprotocol-buffersldd

how to link shared library from non existing(in compile time) folder


i'm trying to link shared library to another shared library(protobuf) with -rpath option, the problem is that the lib is in another direcory in compile time than in runtime, and -rpath option requires an existing in compile time path. (so i get an "No such file or directory" error) Is there any workaround for that? I would rather not to use LD_LIBRARY_PATH variable to solve this problem.


Solution

  • I found an answer here Can I change 'rpath' in an already compiled binary?

    Changing rpath after compilation solves my problem.

    [edited] There is another, better approach: how to link to shared lib from shared lib with relative path