http://www.cnblogs.com/bourneli/archive/2012/04/27/2474103.html
When gcc compiles and links the dynamic library, it is very likely that the compilation will pass, but when executing, the dynamic link library cannot be found. That is
Because the path specified by the -L option is only valid at compile time, the compiled executable file does not know the value after the -L option.
Of course I can't find it. You can use ldd <your_execute> to see if there is 'not found' behind the library you linked,
The solution is to pass -Wl,rpath=<your_lib_dir> to make execute remember the location of the link library