Thursday, April 14, 2011

Winexe: To run code on windows machines from Linux

The instructions on this post are a summary of information collected from this link. And I made some changes to it as well

These are instructions of how to get winexe working on Ubuntu 10.04.1 LTS system

To begin with make sure your system has the required libraries:
sudo apt-get install build-essential autoconf checkinstall

You will also need the python development libraries and header files:
sudo aptitude install python python-all python-dev python-all-dev python-setuptools

Now get the source code of winexe using svn. And apply the first patch:
svn co
cd source
patch -p0 -i fix_winexe_service.diff

Now there is bug in the source/winexe/service.c file:
replace file


Save,close and you are ready to compile:
cd source/
make proto bin/winexe
sudo cp bin/winexe /usr/local/bin/

and now you can test that that winexe is working correctly by doing:
winexe -W WORKGROUP -U Administrator%SecretPassword // 'cmd.exe'

Friday, January 14, 2011

Compiling C/C++ code from Matlab on Ubuntu Linux machine

It seems that there is much easier way of compiling and running C/C++ from your Matlab application, than the one I was trying before.

Reproducing the instructions on this blog here:

My version of gcc (4.4) is too high for Matlab R2009b (4.3), and Matlab chokes on it. The solution is as follows:

Install gcc-4.3:

sudo apt-get install gcc-4.3
sudo apt-get install g++-4.3

In matlab, run mex -setup and select the GCC compiler.(Choose option 2). Next, at the command line:

sudo gedit ~/.matlab/R2009b/

Replace all instances of CC=’gcc’ with CC=’gcc-4.3′, and al instances of CXX='g++' with CXX='g++-4.3'.
And restart Matlab !

Compile gcc from souce on Ubuntu 10.04.1 LTS

To run C/C++ code using the mex utility of Matlab 7.11.0 (R2010b I needed to compile a different version of GCC than what was already installed on my machine. (I had the gcc version 4.4.1-4ubuntu9 and the currently supported version with mex is 4.3.4)

So I downloaded gcc-4.3 release from here.
Untarred the file: tar -jxvf gcc-4.3.4.tar.bz2

And now when I tried to use the ./configure from inside the gcc-4.3.4 folder, the system complained that it could not find two necessary API's namely GMP and MPFR.

The issue can be resolved by doing the following. We need to (1) download the GMP and MPFR libraries separately , (2) place them inside the GCC folder and then, (3) tell the configure script to look for it there.
tar -jxf gcc-4.3.2.tar.bz2
tar -jxf mpfr-2.3.2.tar.bz2
mv mpfr-2.3.2 gcc-4.3.2/mpfr
tar -jxf gmp-4.2.4.tar.bz2
mv gmp-4.2.4 gcc-4.3.2/gmp
cd gcc-4.3.2
./configure --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
make install

Hopefully, that should solve the issues !