[Mrtrix-discussion] Compiling and running MRtrix on Mac OS X

Donald Tournier d.tournier at brain.org.au
Thu May 19 07:20:40 PDT 2011


Hey Jon,

Thanks for your instructions, I'm sure others will find them useful. I'll
include these along with Michael's in the documentation for the next
release, along with a ready to use darwin.py config file and the patch you
included.

Also glad to hear that I'm not alone in finding it fiendishly difficult to
compile GTK and dependencies from source...

On the topic of building command-line only applications, if anyone wants to
do that, you can simply remove the mrview.cpp and disp_profile.cpp files
from the cmd/ folder before invoking ./build (they're the only GUI
applications in MRtrix). However, since the remaining programs still rely on
glibmm and gsl, so you'll still need to install some dependencies, so not
sure how much work you'll be saving yourself by doing this...

Cheers,

Donald.


On 19 May 2011 14:40, Jon Clayden <j.clayden at ucl.ac.uk> wrote:

> Dear all,
>
> Just to follow up on the earlier thread quoted below (I wasn't on the
> mailing list when it was sent, so I can't directly continue it), I thought
> it might be useful to post my experiences of compiling MRtrix on Mac OS X.
>
> I've had problems with Fink in the past, and I don't particularly like its
> approach of creating a whole software ecosystem separate from the rest of
> the system, so instead I used Homebrew <http://mxcl.github.com/homebrew/>
> to sort out the dependencies, which I find much cleaner. (I did - foolishly
> - attempt to build the dependencies by hand initially, but got stuck with
> pango and gave up.) So the steps were
>
> 1. Install Homebrew as per <
> https://github.com/mxcl/homebrew/wiki/installation>:
>
>  $ ruby -e "$(curl -fsSLk
> https://gist.github.com/raw/323731/install_homebrew.rb)"
>
> (Xcode and X11 from the OS X install DVD are also needed, if they're not
> already installed.)
>
> 2. Get and build the dependencies:
>
>  $ brew install gtkglext gtkmm gsl
>
> (The rest should be picked up automagically as dependencies of these
> three.)
>
> 3. Patch MRtrix. A sysconf/darwin.py file needs to be created, as Michael
> says (mine is attached - it only includes the "-mtune" change), and since
> I'm using the system OpenGL library rather than something provided by Fink,
> some .cpp/.h files need modifying. A patch using conditional compilation
> directives (to avoid breaking other platforms) is at the end of this e-mail.
> It should be safe to incorporate this into the main code-base.
>
> 4. Run ./build and proceed as normal.
>
> This seems to result in working binaries. Naturally, most OS X systems
> won't have the run-time dependencies installed, so unless the whole lot gets
> bundled up together I wouldn't expect the binaries to be portable.
>
> If it's not too much work, though, it might be helpful to provide an
> alternative to the "build" script which only builds the command-line
> applications. Presumably the dependencies are far fewer in that case, so it
> might represent a simple "way in" for OS X users...
>
> All the best,
> Jon
>
>
>
>
> --
> diff -r mrtrix-0.2.9/src/dwi/render_frame.cpp
> mrtrix-0.2.9-patched/src/dwi/render_frame.cpp
> 27a28,30
> > #ifdef __APPLE__
> > #include <OpenGL/glu.h>
> > #else
> 28a32
> > #endif
> diff -r mrtrix-0.2.9/src/mrview/pane.cpp
> mrtrix-0.2.9-patched/src/mrview/pane.cpp
> 22a23,25
> > #ifdef __APPLE__
> > #include <OpenGL/glu.h>
> > #else
> 23a27
> > #endif
> diff -r mrtrix-0.2.9/src/mrview/pane.h
> mrtrix-0.2.9-patched/src/mrview/pane.h
> 25a26,28
> > #ifdef __APPLE__
> > #include <OpenGL/glu.h>
> > #else
> 26a30
> > #endif
> diff -r mrtrix-0.2.9/src/mrview/sidebar/tractography/roi_list.cpp
> mrtrix-0.2.9-patched/src/mrview/sidebar/tractography/roi_list.cpp
> 27a28,30
> > #ifdef __APPLE__
> > #include <OpenGL/glext.h>
> > #else
> 28a32
> > #endif
> diff -r mrtrix-0.2.9/src/mrview/sidebar/tractography/track_list_item.cpp
> mrtrix-0.2.9-patched/src/mrview/sidebar/tractography/track_list_item.cpp
> 30a31,34
> > #ifdef __APPLE__
> > #include <OpenGL/gl.h>
> > #include <OpenGL/glext.h>
> > #else
> 32a37
> > #endif
> diff -r mrtrix-0.2.9/src/mrview/sidebar/tractography/track_list_item.h
> mrtrix-0.2.9-patched/src/mrview/sidebar/tractography/track_list_item.h
> 41a42,44
> > #ifdef __APPLE__
> > #include <OpenGL/gl.h>
> > #else
> 42a46
> > #endif
> diff -r mrtrix-0.2.9/src/mrview/texture.h
> mrtrix-0.2.9-patched/src/mrview/texture.h
> 26a27,29
> > #ifdef __APPLE__
> > #include <OpenGL/gl.h>
> > #else
> 27a31
> > #endif
> diff -r mrtrix-0.2.9/src/use_gl.h mrtrix-0.2.9-patched/src/use_gl.h
> 25a26,28
> > #ifdef __APPLE__
> > #include <OpenGL/gl.h>
> > #else
> 26a30,31
> > #endif
> >
>
>
>
> > Hi Michael,
> >
> > This is great news, and doesn't even sound too complicated! I'll add your
> > instructions to the documentation and make sure they're available for the
> > next release. In the meantime, I'd be interested to hear how things are
> > going with the Mac version, and whether you've encountered any issues
> with
> > it so far.
> >
> > Thanks,
> >
> > Donald.
> >
> >
> > On 26 February 2011 13:19, Michael Zeineh <mmzeineh at gmail.com> wrote:
> >
> >> Got it working! At least the basics ... mrview and mrconvert etc. Didn't
> test tractography yet ..
> >>
> >> I tried copying from one machine (10.6.5) to another (10.6), but this
> didn’t work, so I don’t think it is worth putting binaries anywhere ...
> >>
> >> Here is what I had to do
> >>
> >> Install fink per webpage in /sw64
> >>
> >> Download tarball
> >>
> >> tar -xvzf fink-0.29.19.tar.gz
> >>
> >> cd  fink-0.29.19
> >>
> >> ./bootstrap sw64 (puts fink in /sw64)
> >>
> >> fink install python glib gtk+ glibmm2.4 gtkmm2.4 gtkglext1 gsl
> >>
> >> at some point it bottoms out, so just repeat it, and it works
> >>
> >> copy linux.py Darwin.py
> >>
> >> modify Darwin.py cpp flags to read –mtune=native rather than
> –march=native
> >>
> >> modify darwin.py to add to the cpp flags: '-L/sw64/lib',
> '-I/sw64/include'
> >>
> >> ./build
> >>
> >> copy to /usr/local/mri
> >>
> >> change permissions so all users can read
> >>
> >> change path to include /usr/local/mri/bin
> >>
> >> export DYLD_LIBRARY_PATH="/usr/local/mrtrix/lib"
> >>
> >> Then things work!
> >>
> >> One time, it was complaining regarding the freetype library, and this
> required copying the /usr/x11/bin/libfreetype.6.dylib to
> /sw64/lib/freetype219/lib, though it didn’t require it the second time.
>
>
> _______________________________________________
> Mrtrix-discussion mailing list
> Mrtrix-discussion at www.nitrc.org
> http://www.nitrc.org/mailman/listinfo/mrtrix-discussion
>
>


-- 
Jacques-Donald Tournier (PhD)
Brain Research Institute, Melbourne, Australia
Tel: +61 (0)3 9035 7033
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.nitrc.org/pipermail/mrtrix-discussion/attachments/20110519/19828366/attachment.html


More information about the Mrtrix-discussion mailing list