meta data for this page
Compiling m-files to Linux binaries
There are some stuff that do not work well in compiled programs.
version function, you'll get a compile time warning about
Compiling does reveal bugs that would otherwise remain unfound.
Try to compile your demo like this:
mcc -m -B sgl gmmb_demo01
It generates C code and tries to compile it, linking with
sgl graphics library.
If you get warnings, study them carefully, usually you find never-seen-before but
still so-very-stupid bugs. Some other things you just cannot fix.
If you get a binary, you try to run it with something like LD_LIBRARY_PATH=“/opt/local/matlabR13/bin/glnx86:/opt/local/matlabR13/extern/lib/glnx86:/opt/local/matlabR13/sys/os/glnx86” ./gmmb_demo01
Use ldd to check that all required libraries are found.
Compiling m-files to p-files
p-files are binary matlab files that can't be edited. They are handy when distributing your program but not you code.
Compiling is easy like this: pcode *.m It generates .p file of each and every .m file it can find in current directory.
Overriding Matlab libraries
If for example the following error occurs:
../../sys/os/glnx86/libgcc_s.so.1: version `GCC_3.3' not found (required by /usr/lib/libstdc++.so.6).
It typically means that your gcc version is newer than what is supported by the libraries coming along with Matlab. Thus, you need to pre-load the latest libraries. This can be achieved, e.g., by
[[jkamarai@betelgeuse|base03]]$ locate libgcc_s.so /usr/lib/gcc/i386-redhat-linux/4.0.1/libgcc_s.so /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/libgcc_s.so /lib/libgcc_s.so.1 [[jkamarai@betelgeuse|base03]]$ export LD_PRELOAD=/usr/lib/gcc/i386-redhat-linux/4.0.1/libgcc_s.so [[jkamarai@betelgeuse|base03]]$ nice matlab -nojvm
The first library corresponds to the current gcc version and the second one the older. Check by “gcc -v”.