Friday, February 10, 2012

Solving "error while loading shared libraries" in Linux

For some newly compiled and installed programs in Linux, when they are executed for first time, the following error comes out

"error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory"
It happens in my Ubunutu Linux 11.10 box.

The solution is pretty simple.
1.)  Edit  /etc/ld.so.conf


sudo nano /etc/ld.so.conf


2.)  Add the path of the *.so, usually custom libraries are installed in  "/usr/local/lib", so adding this line can solve most of the problems.

3.) Save (of course) and execute

sudo /sbin/ldconfig –v

The problem is then solved.




Friday, December 30, 2011

Using GCC (MingGW) in Matlab for Windows

Other than using Visual C++ 2010 in Matlab, we can also use MingGW, the GNU compiler for compiling c/c++ files in Matlab with mex in Windows Environment.

1.) Download gnumex, and install it as if a toolbox, and download the MingGW.
2.) run gnumex in Matlab command windows, a GUI is shown.
3.) Follow the on-screen instruction