Sunday, May 06, 2012

IDA Pro 6.2 + Ubuntu 12.04 AMD64

Installing IDA Pro on Linux (AMD64) can be a pain. In previous versions of Ubuntu what I had to do to achieve such task, is to build a IA32 chroot environment (following this guide). While effective, this is in my opinion not ideal.

Fortunately, in the latest version of Ubuntu it is possible to install almost all the IA32 dependencies by hand following a simple scheme.

First we need to see which dynamic libraries are not found by the loader. To do so we can use the `ldd` command to print all the dynamic libraries missing:

$ ldd idaq | grep found
libXext.so.6 => not found
libfreetype.so.6 => not found
libSM.so.6 => not found
libXrender.so.1 => not found
libfontconfig.so.1 => not found

Once we have the list of missing libraries, we need to see from which packaged they come from. One simple way is to use `dpkg`. So for each of the missing libraries we proceed like this:

$ dpkg -S libXext.so.6
libxext6: /usr/lib/x86_64-linux-gnu/libXext.so.6
As we can see, the file is provided by `libxext6`, but we need to take into account that we need the IA32 versions of the libraries.
Fortunately, Ubuntu does allow us to install both versions and it is just a matter of adding ":i386" at the end of the package name.

$ sudo apt-get install libXext6:i386
Once we have installed each one of the libraries IDA Pro will fire up, but we will receive a dissapointing message the the IDAPython plugin is not working due to missing dependencies.
dlopen(/home/agustin/opt/idapro/plugins/python.plx): libpython2.6.so.1.0: cannot open shared object file: No such file or directory/home/agustin/opt/idapro/plugins/python.plx: can't load file
We need to proceed in the same way as we did before, but there is a slight difference. We need a dynamic library that comes from Python 2.6 and as the release notes says, Python 2.6 has been deprecated.

In a previous iteration of this blog entry what I did was to download these packages from an old Ubuntu repository. This was not ideal since I always ended up breaking some dependencies and the package manager was not happy about it.
So I took another way and tried to build it from the source. The steps you need to follow are described bellow and need to be issued in the Python2.6 source directory:

$ CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \
-L`pwd`/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" \
 ./configure --prefix=/opt/pym32 --enable-shared
$ make -j 8
$ sudo make install
This will install python in the directory `/opt/pym32` along with all the needed shared libraries for IDAPython to run.
The last step is to tell the loader where those libraries are. There are multiple options but for simplicity sake I choose to export the environment variable `LD_LIBRARY_PATH` and make it point to `/opt/pym32/lib`
$ export LD_LIBRARY_PATH="/opt/pym32/lib"
$ /home/agustin/opt/ida/idaq64
And that's it, now you have a running version of IDA Pro all with IDAPython running as it should. 



3 comments:

Unknown said...

Hey thanks man...Your post saved my day...!!!

Unknown said...

Thanks for the post..you saved my day.!!

Anonymous said...

Thanks bro, after spending hours on the internet to find struff about libraries I did not understand, finally a clear explanation with all the usefull cmd lines!!