Thứ Năm, 2 tháng 1, 2014

PATH: all you need to know

Hi all,
Previously, I write a blog about LD_LIBRARY_PATH [1]. Continuing this series, I write this blog about another important environment variable in Linux which is PATH.
PATH is the environment that contains paths to executable files. For example, /home/tranlaman/bin, /usr/local/sbin, /usr/local/bin/, /usr/sbin, or /bin.
Otherwise, LD_LIBRARY_PATH contains dynamic library for other programs.

MATLAB options file in Linux 64

Happy new year 2014,
I am writing this blog to notice you a trick to change option files in Matlab in Linux, which is very useful. When you want to use MEX to compile a C/Fortran source in MEX interface, you need to modify option files mexopts.sh in Linux because the default file contains errors in Linux. Why is it important so? The answer is that options files control which compiler to use, the compiler and link command options, and the runtime libraries to link against.
Then, where the file locate in Linux? The default file mexopts.sh locates in /home/tranlaman/.matlab/R2012a. But there is another default root file lie in /home/tranlaman/MATLAB/R2012a/bin which overrides the file in /home/tranlaman/.matlab/R2012a. So, modifying the mexopts.sh in /home/tranlaman/MATLAB/R2012a/bin would change everything.
Finally, how do we modify this file? The answer is to change some compiling and linking flag such as CC, CFLAGS, CLIBS, LD, LDFLAGS. Please refer to [1] as a complete flag for custom building MEX files.
Wish everyone has a good year.