Error while loading shared libraries



hi i’m using affdex SDK and raspberry pi 3B running raspbian stretch i got this error while running after compiling :
./test-app: error while loading shared libraries: cannot open shared object file: No such file or directory
this is my compile script :
export LD_LIBRARY_PATH=$HOME/pi/affdex-sdk/lib
g++ main.cpp -laffdex-native -std=c++11 -I/usr/include/ImageMagick-6 -I$HOME/affdex-sdk/include -L$HOME/affdex-sdk/lib -I$HOME/affdex-sdk/include Magick++-config --cppflags --cxxflags --ldflags --libs -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -o test-app
thanks for helping me


Hi, check that your LD_LIBRARY_PATH includes $HOME/pi/affdex-sdk/lib at runtime (I’m assuming it did at compile time, since it compiled).


thank you for your quick response ,
sorry i’m a beginner could you please explain further.


Ah, a colleague here at Affectiva spotted a problem I missed. In your compile/link command, you specified


but in your LD_LIBRARY_PATH you specified

export LD_LIBRARY_PATH=$HOME/pi/affdex-sdk/lib <-- note the “pi” directory in the middle

Presumably the first one is correct, so you should change your LD_LIBRARY_PATH command to:

export LD_LIBRARY_PATH=$HOME/affdex-sdk/lib


thanks the problem was with LD_LIBRARY_PATH when i run echo $LD_LIBRARY_PATH i found that it was empty
export LD_LIBRARY_PATH=$HOME/affdex-sdk/lib
but i have an other problem when i run the script w this first photo i got this error :
_terminate called after throwing an instance of ‘Magick::ErrorResourceLimit’_
_ what(): test-app: memory allocation failed `download.png’ @ _
_ error/png.c/ReadOnePNGImage/2341_
_ Aborted_
an the second error is :
Segmentation fault
thank you for your help


Hi, I’m closing this topic, as the issue is also being discussed on StackOverflow.