Transferred from: http://blog.csdn.net/david_xtd/article/details/7625626
Premise: Ubuntu-debug machine on the PDU-IVT submitted to SVN, want to verify the success of the direct make on other ordinary machine, the compiled user program can run.
The work PC is equipped with VMware, which has the same Ubuntu version as the Ubuntu-debug machine, which is the Ubuntu 11.10 version.
VMware's home directory has a directory pdu-ivt, which is updated from SVN and copied directly.
On the Ubuntu-debug machine, make succeeds, and the generated binary executable PDU can also run and connect successfully with switch;
But when you run make in VMware, the working PC, you are prompted with an error:
[CPP]View Plaincopyprint?
- /usr/bin/ld:cannot FIND-LCISCOENERGYWISESDK
- Collect2:ld returned 1 exit status
- Make: * * [PDU] Error 1
Analysis Reason: The LD prompt cannot find the library file, and the library file is in the current directory.
The default directory for the linker ld is/lib and/usr/lib, and if you put it on a different path, you need to let LD know where the library file is.
Method 1:
Edit the/etc/ld.so.conf file and add the directory where the library file is located in a new line;
Run Ldconfig to update the/etc/ld.so.cache file;
Method 2:
Create a new file with a. conf suffix in the/etc/ld.so.conf.d/directory, and add the directory where the library file is located in the file;
Run Ldconfig to update the/etc/ld.so.cache file;
I think the second method is more convenient, the original system is the smallest change. Because the content of the/etc/ld.so.conf file is include/etc/ld.so.conf.d/*.conf
Therefore, any file with a. conf suffix that is added to the/etc/ld.so.conf.d/directory can be identified.
[CPP]View Plaincopyprint?
- My Practice:
- 1. Put all the users need to use the library to/usr/loca/lib;
- 2. Create a new file usr-libs.conf in the/etc/ld.so.conf.d/directory, with the content:/usr/local/lib
- 3. #sudo Ldconfig
The Ld.so.cache update is incremental, just like the path system environment variable, not re-established from scratch, but cumulatively.
The Ld.so.cache file is created from scratch, unless the power is turned back on.
Error resolution errors while loading shared Libraries:libxxx.so.x:cannot open Shared object file:no such file