Debugging MantidPlot

From MantidProject

(Redirected from DebuggingMantidPlot)
Jump to: navigation, search

Windows

By default, the build of MantidPlot and the MantidQt libraries compiles the release versions. Compiling a debug version is easy - you simply type nmake debug (or nmake all to build release and debug at the same time) instead of simply nmake.

The debug build assumes that you have built the Mantid framework itself using Visual Studio rather than Scons, and installs everything in the same place as the Visual Studio debug build (trunk\Code\Mantid\debug).

There are a number of additional steps required before MantidPlot will build in debug:

  1. You will need a debug version of the Python dll (instructions taken from here)
    • Download the python-2.5.tgz from python’s website. Make sure you take exactly the same version as the one you already have installed.
    • Decompress the archive and open the pcbuild.sln in the PCbuild8 directory using Visual Studio 2005.
    • Select the debug configuration and build just the python and pythoncore projects.
    • You will now have python25_d.dll and python25_d.lib in the PCbuild8\win32debug directory. Copy these into your main C:\Python25 and C:\Python25\libs directories respectively.
  2. Next build sip with debugging symbols (see the \doc of your sip directory for full instructions):
    • Go into your sip directory and run python configure.py -u
    • Then run nmake and nmake install
  3. Go into your PyQt directory and use the same set of commands as for sip to build PyQt with debug symbols. (Note: you also have to have qpydesigner built in debug, acheived by running qmake then nmake debug in the qpy/QtDesigner directory, otherwise you will get linker errors )
  4. The final third-party library that you need to build a debug version of is QScintilla. By default a debug build of this results in a library with the same name as the release one, which isn't helpful. The following is one way around this (and the one that the qtiplot.pro is set up for):
    • Modify qscintilla.pro in the Qt4 directory of your QScintilla download as follows:
      • Change the CONFIG line to: CONFIG += qt warn_off debug_and_release build_all dll thread
      • Add the line: CONFIG(debug, debug|release) { TARGET = $$join(TARGET,,,d) }
    • Run qmake, nmake and nmake install. This should not touch your existing release libraries, but you will now have a qscintilla2d.lib & dll in you Qt installation's lib directory.
    • Before running MantidPlot, you need to manually copy qscintilla2d.dll to your Qt installation's bin directory.
  5. You should now be able to build MantidPlot in debug using the commands given above (nmake debug or nmake all).
  6. The debug executable will now be found in your Code\Mantid\debug directory.
  7. You can then run this, which will also give a console window in which 'QDebug' messages may allegedly appear, and attach to the process in the Visual Studio debugger.

N.B. At the moment (9 June 2010) there's a bug which means that if Mantid picks up any Python algorithms it will crash on startup, so you need to remove any or point the pythonalgorithms.directories somewhere where it won't find any.

Linux (and Mac)

The default gives a release build. If anyone wants to provide instructions on how to compile in debug, they're very welcome to put them here!

Personal tools
Create a book