Debugging Qt on Mac

If you want to run VisIt with a debug version of Qt on the Mac, you will have to build Qt as libraries instead of frameworks.

Qt is built with both debug and release but the _debug version of its frameworks. However, each version of the library is installed within the non-debug framework directory. That is, the QtCore framework will contain both QtCore and QtCore_debug. When both debug and non-debug libraries exist within the same framework, the Apple linker will prefer the non-debug versions. In short, it does not seem possible to use debug versions of the Qt libraries when frameworks are used. The solution is to not build Qt as a set of frameworks.

Building Qt

Edit src/svn_bin/bv_support/bv_qt.sh and tell the Qt build that it should be built in debug mode without using frameworks.

Change line

qt_flags=""

to:

qt_flags="-debug -no-framework"

After making the change, run build_visit

cd src/svn_bin
./build_visit --console --no-visit --no-thirdparty --thirdparty-path /path/to/thirdparty_shared --makeflags -j4 --qt

Running

When you try to run VisIt linked with non-framework Qt, you'll run into the following error. Note that this error used to come up with static builds of Qt but the build system has a fix for it that installs the nib files automatically. Since we're not building statically, you'll have to copy the nib files manually.

% ./visit -o ~/data/noise.silo -gdb viewer -xterm
Running: gui -dv -o /Users/whitlock2/data/noise.silo -gdb viewer -xterm
Qt internal error: qt_menu.nib could not be loaded. The .nib file should be placed in 
QtGui.framework/Versions/Current/Resources/  or in the resources directory of your 
application bundle.

The solution is to do this:

cd src
cp -R include/qt_menu.nib exe/gui.app/Contents/Resources/
cp -R include/qt_menu.nib exe/viewer.app/Contents/Resources/