Mac: i came across this problem in the process of install

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
For example:
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:

export EIGEN_CFLAGS="-isystem /usr/include/eigen3"

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.

@rsmith: agreed, can see how the ‘compiler error’ message might be confusing… We should look into changing that. More than happy to make the messages more verbose if you think that’ll help…

However, @zhangyan_yang: if you follow the recommended install instructions, you shouldn’t need to set the flags that @rsmith is talking about - unless you really want to avoid both macports and homebrew…?

i choose the homebrew method

zoeys-MacBook-Pro:mrtrix3 zoeyyang$ EIGEN_CFLAGS=“-isystem /Users/zoeyyang/Documents/Software/eigen-eigen-07105f7124f9” ./configure

Nice, now the configure is better, but still “Checking for non-POD variable-length array support: no”, what is the meaning of this sentence, and the log is bellow:

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: 3.2.8
Checking shared library generation: yes
Checking for Qt moc: moc (version 5.6.0)
Checking for Qt qmake: qmake (version 5.6.0)
Checking for Qt rcc: rcc (version 5.6.0)
Checking for Qt: 5.6.0

writing configuration to file ‘./release/config’: ok

Checking for non-POD variable-length array support: no

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.

The details:

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:

  • POD refers to plain old data - see here for brief details, or this post for an in-depth description.

  • 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.

  • g++ does support VLAs for all types as an extension to the standard. Likewise, clang++ also supports them, but only for POD types.

  • 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.

Hi Donald and all,

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.

Jonathan

Hi Jonathan,

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
source ~/.bashrc
fi

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.

Cheers,
Max

@Jonathan_Ashmore: any chance you could post the contents of configure.log produced when the script fails to find Eigen3? Just so we can figure out how to fix it properly.

Also, would you mind checking whether you have pkg-config installed and in your PATH? If not, try installing it and invoke ./configure again, see if that helps at all. I think the procedure would be:

$ brew install pkg-config

That should allow ./configure to query the correct settings for Eigen3…

I ran into someone with the exact same issue on Saturday as well! (that and heaps of existing (and new, after I encouraged them) MRtrix3 users, or interested-in-using)

… and how did you fix the problem for them? Did the pkg-config hint do the trick…?

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. :smiley:

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.

1 Like

Fantastic, thanks for confirming! Let’s add this to the documentation ASAP.

Hi Donald,
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
Jonathan

No problem, I think we’ve got enough confirmation from various sources now. We’ve now adjusted the documentation to match.
Thanks!