Building Liquid State Machine on Centos 4 64-bit

12 November, 2008

download the lsm toolbox from here:

unpack it to your working directory

Before trying to build the lsm toolbox you need to check that you have access to the gcc4 compiler from within your working environment, you can check this by:

$gcc -v

Which should return something similar to this

Using built-in specs.

Target: x86_64-redhat-linux

Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –with-gxx-include-dir=/usr/include/c++/3.4.3 –enable-libgcj-multifile –enable-languages=c,c++,java,f95 –enable-java-awt=gtk –disable-dssi –with-java-home=/usr/lib/jvm/java-1.4.2-gcj- –with-cpu=generic –host=x86_64-redhat-linux

Thread model: posix

gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)

Should you not have the gcc4 complier installed you need to install the package gcc4-4.1.2-14.EL4 and usually create a sim link in your ~/bin folder to ensure that the version 4 compiler will be picked up first.

cd ~/bin
ln -s /usr/bin/gcc4 gcc
export PATH=/home/<username>/bin:$PATH

Now that the build environment is sorted out its onto the actual process of building the lsm toolbox. So, edit the Makefile in lsm/csim/src change the default build rule to

default: version.i filepermissions csim.mexga64 install.m

The default build rule should be around line 135 in the Makefile. Depending on where matlab is installed the file paths which are hardcoded in the build file may need to be changed. In this example using the vim regular_expression to change the path from /usr/local/matlab to /opt/matlab/ins


Now move to the csim directory and run the make command as normal.

Should an error similiar to the quote below occur,

Invalid MEX-file ‘/home/<username>/<working directory>/lsm/csim/csim.mexa64′: /opt/matlab_sp3_64/ins/bin/glnxa64/../../sys/os/glnxa64/ version `GCC_4.2.0’ not found (required by /usr/lib64/

The solution to seems to be to move the file out of the way so that matlab will use the system one first. The file can be moved via the normal unix command ‘mv’ as shown below.



Missing Matlab menu’s with ubuntu

30 April, 2008

After installing matlab 7.4.0 on ubuntu hardy (8.04), I got the following stack trace on the gnome output console;

patrickd@battlestar:~$ Locking assertion failure. Backtrace:
#0 /usr/lib/ [0xb5ac0767]
#1 /usr/lib/ [0xb5ac08b1]
#2 /usr/lib/ [0xb5e2c1bd]
#3 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa090826a]
#4 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ee352]
#5 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ee599]
#6 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ee7a4]
#7 [0xadcbdb8b]
#8 [0xadcb7a7b]
#9 [0xadcb7a7b]
#10 [0xadcb5157]
#11 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb294f8ec]
#12 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb2a3e378]
#13 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb294f71f]
#14 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb29a7ebb]
#15 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/ [0xb2f422cd]
#16 [0xadcbd43b]
#17 [0xadcb79a4]
#18 [0xadcb5157]
#19 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb294f8ec]
Locking assertion failure. Backtrace:
#0 /usr/lib/ [0xb5ac0767]
#1 /usr/lib/ [0xb5ac081e]
#2 /usr/lib/ [0xb5e2b518]
#3 /usr/lib/ [0xb5e220a6]
#4 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ed227]
#5 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ed4b8]
#6 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ee6e0]
#7 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/ [0xa08ee7a4]
#8 [0xadcbdb8b]
#9 [0xadcb7a7b]
#10 [0xadcb7a7b]
#11 [0xadcb5157]
#12 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb294f8ec]
#13 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb2a3e378]
#14 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb294f71f]
#15 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/ [0xb29a7ebb]
#16 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/ [0xb2f422cd]
#17 [0xadcbd43b]
#18 [0xadcb79a4]
#19 [0xadcb5157]

Which appears to be causing the standard menus in matlab not to display, after trying various solutions found around the great wide inter web, the one that finally worked for me was to edit the matlab startup script at <$matlab_home>/bin/matlab and insert the following at the top of the file;

export AWT_TOOLKIT=MToolkit

After editing the matlab startup script it now looks like;

patrickd@battlestar:~$ head /opt/matlab/bin/matlab
export AWT_TOOLKIT=MToolkit
# Name:
# matlab script file for invoking MATLAB
# Usage:
# matlab [-h|-help] | [-n | -e]

Note: This doesn’t actually appear to stop the error message above from appearing in the terminal window, it does however allow the menus to display which for now is all I need to fix. If I later discover that the error message is causing something else not to work in Matlab then I ‘ll update this post.