error while loading shared libraries: libcapnp-0.5

2019-09-04 04:12发布

问题:

I think this is a generic problem not specifically related to Cap'n Proto.

My project's build succeeds but on run I get:

error while loading shared libraries: libcapnp-0.5.3.so: cannot open shared object file: No such file or directory

Maybe I am missing something in CMake?

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lcapnp -lkj")

I verified libcapnp-0.5.3.so exists in /usr/local/lib

I also tried adding:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/lib/libcapnp-0.5.3.so")

回答1:

/usr/local/lib needs to be added to /etc/ld.so.conf

then run sudo ldconfig to load the changes.