Reputation: 443
My program uses the libuvc-library and therefore the libuvc.so.0.
But after successful compilation, i can't run the program, because:
root@Raspi_DataHarvest:~/Schreibtisch# g++ UVCCameraHandler.cpp `pkg-config --libs --cflags opencv` `pkg-config --libs --cflags libuvc` -o UVCCameraHandler.o
./UVCCameraHandler.o: error while loading shared libraries: libuvc.so.0: cannot open shared object file: No such file or directory
The reason is:
root@Raspi_DataHarvest:~/Schreibtisch# ldd UVCCameraHandler.o
linux-vdso.so.1 (0x7edff000)
/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f1a000)
libopencv_dnn.so.3.4 => /usr/local/lib/libopencv_dnn.so.3.4 (0x76bc7000)
libopencv_ml.so.3.4 => /usr/local/lib/libopencv_ml.so.3.4 (0x76b20000)
****** libuvc.so.0 => not found *******
...
The file is located in: /usr/local/lib/arm-linux-gnueabihf/libuvc.so.0.0.6
But I don't know how to link the .so file ...
Upvotes: 0
Views: 517
Reputation: 16404
You need to tell the run-time loader where to find your library, because this is not a normal path.
Use this command to run:
LD_LIBRARY_PATH="/usr/local/lib/arm-linux-gnueabihf:$LD_LIBRARY_PATH" ./a.out
Or you can export this LD_LIBRARY_PATH
as a environment variable, and run ./a.out
directly afterwards.
Upvotes: 2