when i type ./configure, it says the compiler error
zoeys-MacBook-Pro:mrtrix3 zoeyyang$ ./configure
MRtrix build type requested: release
Detecting OS: darwin
Checking for C++11 compliant compiler [clang++]: 4.2.1 - tested ok
Detecting pointer size: 64 bit
Detecting byte order: little-endian
Checking for variable-length array support: yes
Checking for non-POD variable-length array support: no
Checking for zlib compression library: 1.2.5
checking for Eigen 3 library:
ERROR: compiler error!
Use the EIGEN_CFLAGS environment variable to set the path to
the Eigen3 include files and to set any required flags
EIGEN_CFLAGS="-isystem /usr/include/eigen3" ./configure
Are you following the instructions on the MacOSX installation page? Which option did you take? Homebrew? Macports? Or the manual approach? It should work OK using either of the first two. The manual install is a little bit more fiddly, although not too hard. But we need to know exactly what you’ve done so far…
@jdtournier I think the issue here is not anything specific to do with a Mac install, but the brevity of the message that the configure script provides when a test compilation fails. Those messages could be made more verbose, e.g. “The compiler was unable to find your Eigen3 installation” instead of “compiler error”. A number of people have also gotten stuck here because they delete the -isystem or -I flag when they insert their own path. Setting the environment variable on the one line rather than using an export call probably confuses some people as well.
@zhangyan_yang Firstly, you need to determine exactly where on your system the Eigen3 files have been installed. Then, you need to inform the MRtrix3 configure script of how it needs to pass this information to the compiler. A typical call would be something like:
This will store the string within the quotation marks into the environment variable called ‘EIGEN_CFLAGS’, which the MRtrix3 configuration script will read. However you need to replace /usr/include/eigen3 with the path to where Eigen is installed on your particular system. Once this is done, you should be able to run ./configure.
Can I just double-check: you ran brew install eigen before trying to invoke ./configure, and that didn’t work…? If that’s the case, we’ll need to double-check that the instructions are correct…
This is nothing to worry about, it’s a feature that g++ (the GNU compiler) supports, but isn’t available on clang++ (the compiler shipped with XCode). We just need to test for it since it affects how the code is configured. You should have no trouble building now, just type ./build and see how you go.
If you’re interested in what this is actually about, it’s a bit tricky to find a single source that really explains everything clearly, but the following links should be helpful:
a variable-length array (VLA) is an array created on the stack - i.e. without explicit memory allocation on the heap (see here for details on the stack/heap), whose length is determined at runtime. That makes it very fast to allocate/deallocate (essentially no overhead), and ideal for use in performance-critical code.
MRtrix3 does use VLAs when the compiler allows them, in specific circumstances where it’s safe to do so. When the compiler doesn’t allow them, we revert to a fixed-size array big enough to accommodate the data required. This takes up more space than required on the stack, so we prefer to use VLAs if possible. Hence the need to check whether they’re supported by the compiler, so we can set the appropriate flags in the code.
I just had the same issue setting up mrtrix on my new mac and did install eigen before running ./configure. Doing the suggestion of defining the path to eigen fixed the issue as stated above.
Also the step setting the path to mrtrix/reslease/bin didnt seem to work either. I found I had to set the paths in the .bash_profile file rather than the .bashrc file (I had no .bashrc file in my home directory). I had this issue when setting up on a macbook around 6 months ago too.
Just thought I would feedback from someone newly installing on mac.
Thanks for the feedback! You can just create those files if they don’t exist. Unfortunately, it depends on the terminal you are using and on which configuration files exist, which file is sourced (link). I personally have
if [ -f ~/.bashrc ]; then
in my .bash_profile
Donald changed the instructions for this already in our doctest branch which should make it into our documentation sooner than later.
I was there with little means and little time to do hands-on assisting (also, I’m not really a Mac-nifty person… but I remembered seeing this thread last week)… so I referred them to the forum; mentioning this very thread that we have going on this issue specifically.
But we do have quite a few potential users coming in, some of which are hitting this specific issue… so it’s definitely worth trying to fix it, or amend the documentation to help them out as good as possible.
Edit: so one of these people basically also mentioned having “downloaded” (cloned) MRtrix “a couple of weeks ago”, and nicely followed the documentation (back then as well), and got exactly the output @zhangyan_yang mentioned in the original post.
I can confirm that explicitly export EIGEN_CFLAGS="-isystem /where/you/extracted/eigen" is not required if the pkgconfig package is installed using MacPorts. Not sure about Homebrew but I think that this should also fix the problem.
apologies, I dropped off checking the responses on the forum but just picked it up now. Let me know if you still wanted to see my conifigure.log file and PATH definitions and I will post them