In the native Linux environment compiled well, can be run on this machine, but due to the field installation, the program directly copied past, found that the program run error. For example
/usr/lib/libstdc++.so.6:version ' glibcxx_3.4.9 ' not found
/usr/lib/libstdc++.so.6:version ' glibcxx_3.4.11 ' not found
/lib/libc.so.6:version ' glibc_2.7 ' not found (required by/usr/lib/libcrypto.so.10)
Use the command LDD to view the library files that the program depends on:
We can see that these library files are under the/lib/path, especially ld-linux.so.2, where the ld-linux.so.2 determines the default path of the program lookup Library. Other machines also have these libraries, but the program does not run because of the library file version. If we copy these libraries to other machines, the program relies on these versions of the library and there is no problem. So we can do this:
(1) Copy these library files to a new folder under/home/dynamic/.
(2) then modify the Makfile file,makefile g++ compile option Finally, add the following options to specify the dynamic library's preferred search path and dynamic linker:-wl,--rpath=/home/dynamic/-wl,-- Dynamic-linker=/home/dynamic/ld-linux.so.2, recompile. Using the LDD command to view the compiled program, you can see that the path to the dependent library file has been modified.
(3) If you deploy the program to another machine, create a new/home/dynamic/on the other machine and copy the library files that were just on the compiler's machine to the past. So the program will work.
You can also refer to the article http://tech.ddvip.com/2013-11/1384435922205976.html
Linux publishing programs under different machines