Slicer:Patches for the Mac
Configuring the X Server
There are two options you can use to address event processing issues (missed button presses) on the Mac and make slicer easier to use:
- activate focus follows mouse mode for X11 windows
defaults write com.apple.x11 wm_ffm true
or
- keep click to focus behavior, but passes the click event to the clicked window
defaults write com.apple.x11 wm_click_through true
Note: these remainder of these instructions refer to the steps needed to compile the 2.4 release of slicer. The current cvs version includes patches to genlib.tcl that perform these steps automatically.
Contents
XFilterEvent()
On Mac OSX 10.3 the X server seems to have a bug in processing certiain events.
You can address this by applying the following patch to the file generic/tkEvent.c in the tk release tagged core-8-4-6.
939a940,942 > > /* the XFilterEvent call causes a long delay on Mac OSX for no apparent benefit */ > #if 0 942a946 > #endif
This has the effect of removing a call to XFilterEvents().
The patch is also available on Xythos. To apply the patch, copy it into the directory slicer2/Lib/darwin-ppc/tcl/tk/generic and run the command:
patch -i tkEventPatch.diff
from that directory. To compile, create the directory slicer2/Lib/darwin-ppc/tcl-build, then change directories to slicer/Lib/darwin-ppc/tcl/tk/unix, and run:
./configure --with-tcl=/YourSlicerPath/slicer2/Lib/darwin-ppc/tcl-build/lib --prefix=/YourSlicerPath/slicer2/Lib/darwin-ppc/tcl-build make make install
ranlib
The ranlib command needs to be run manually on some tcl/tk libraries.
BLT
Currently, BLT does not compile for the mac. The error is:
ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option
followed by a list of symbols.
BLT needs to be manually commented out of the Scripts/genlib.tcl file, and vtkFMRIEngine will not build or run.
Alternatively, --with-cflags="-fno-common" can be added to the configure input to fix this 'common symbols not allowed' problem. But this necessitates linking the tcl,tk and X libs in certain files. Here's the Makefile.in diffs, in the src and src/shared directories, showing the additional $(LIBS). Also, a separate bug in src/shared/Makefile.in is that $(bltsh) must be added to the dependency list (see diffs below).
format: diff <newly changed file> <original file>
storm:nicks[/Users/Shared/pkgs/src/blt2.4z/src] diff Makefile.in $HOME/packages/blt2.4z/src/Makefile.in 173c173 < $(srcdir)/bltUnixMain.c $(tcl_only_lib_a) $(LIBS) --- > $(srcdir)/bltUnixMain.c $(tcl_only_lib_a) $(TCL_ONLY_LIBS) storm:nicks[/Users/Shared/pkgs/src/blt2.4z/src/shared] diff Makefile.in $HOME/packages/blt2.4z/src/shared/Makefile.in 148c148 < $(LIBS) $(SHLIB_LIB_SPECS) --- > $(SHLIB_LIB_SPECS) 155c155 < $(LIBS) $(SHLIB_TCL_ONLY_LIB_SPECS) --- > $(SHLIB_TCL_ONLY_LIB_SPECS) 159c159 < install-demo: $(bltwish) $(bltsh) --- > install-demo: $(bltwish)
This is the script I use that successfully builds and installs everything on Mac OS X Tiger:
cd blt2.4z make distclean ./configure --prefix="$PKGS_ROOT" --enable-shared --with-tcl="$PKGS_ROOT" --with-tk="$PKGS_ROOT" \ --enable-jpeg="$PKGS_ROOT" --x-includes="/usr/X11R6/include" --with-cflags="-fno-common" make make install
VTK
First let genlib run through the VTK checkout and let it attempt to build. It will fail with a message that it cannot find some opengl symbols. To compile vtk:
cd Lib/darwin-ppc/VTK-build ../CMake-build/bin/ccmake ../VTK in ccmake, hit 't' and add -lgl to the OPENGL_gl_LIBRARY so it reads: -framework OpenGL -lgl and turn ON VTK_USE_SYSTEM_ZLIB
Then run make to finish the build of VTK.
After VTK finishes building, re-run genlib.tcl to build ITK.