Build fails on Mac

output of configure is OK, but build fails. How to proceed?

Thanks,

Pim

output of configure:

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.4.0)
Checking for Qt qmake: qmake (version 5.4.0)
Checking for Qt rcc: rcc (version 5.4.0)
Checking for Qt: 5.4.0

build output:

( 1/412) [CC] release/cmd/tckgen.o
( 2/412) [CC] release/cmd/dirmerge.o
( 3/412) [CC] release/lib/formats/pipe.o
( 4/412) [CC] release/src/dwi/tractography/mapping/gaussian/mapper.o
( 6/412) [CC] release/src/gui/opengl/shader.o
( 5/412) [CC] release/src/dwi/tractography/seeding/gmwmi.o
( 7/412) [CC] release/cmd/tsfdivide.o
( 8/412) [CC] release/cmd/mesh2pve.o
ERROR: ( 2/412) [CC] release/cmd/dirmerge.o
ERROR: ( 3/412) [CC] release/lib/formats/pipe.o
ERROR: ( 6/412) [CC] release/src/gui/opengl/shader.o
ERROR: ( 7/412) [CC] release/cmd/tsfdivide.o
ERROR: ( 8/412) [CC] release/cmd/mesh2pve.o
ERROR: ( 5/412) [CC] release/src/dwi/tractography/seeding/gmwmi.o
ERROR: ( 4/412) [CC] release/src/dwi/tractography/mapping/gaussian/mapper.o
ERROR: ( 1/412) [CC] release/cmd/tckgen.o

ERROR: ( 2/412) [CC] release/cmd/dirmerge.o

clang++ -c -std=c++11 -DMRTRIX_MACOSX -fPIC -DMRTRIX_WORD64 -DMRTRIX_NO_NON_POD_VLA -isystem /usr/local/include/Eigen -Wall -O2 -DNDEBUG -Isrc -Icmd -I./lib -Icmd -isystem /usr/local/include/Eigen cmd/dirmerge.cpp -o release/cmd/dirmerge.o

failed with output

In file included from cmd/dirmerge.cpp:17:
In file included from ./lib/command.h:22:
In file included from ./lib/app.h:28:
In file included from ./lib/cmdline_option.h:28:
In file included from ./lib/mrtrix.h:30:
/usr/local/include/Eigen/array:8:4: error: The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.
#error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.
^

Haven’t come across that one before… As far as I can tell, what’s happening is that the compiler tried to use the Eigen/Array header instead of the desired C++ standard array header. I’m not entirely sure how that could happen, but I notice that the path to the Eigen headers is provided explicitly to the compiler. Did you set this yourself at the configure stage? Maybe you used something like this?

$ EIGEN_CFLAGS="-isystem /usr/local/include/Eigen/" ./configure

In which case, it looks like that last Eigen bit is causing trouble. Try this instead:

$ EIGEN_CFLAGS="-isystem /usr/local/include/" ./configure

If that’s not what happened, then I don’t see how that path could have ended up there…

Actually, it looks to me like you don’t need to set the EIGEN_CFLAGS at all, given that ./configure worked when it seemed to be set incorrectly. Have you tried running just a straight ./configure…?

Hi Donald,

it worked after several attempts. What I did:

  1. download Eigen3 and unzip
  2. copy directories Eigen/ and unsupported/ to /usr/local/include/
  3. set EIGEN_CFLAGS="-isystem /usr/local/include/"
  4. ./configure and ./build
  5. I had to echo PATH=$(pwd)/release/bin:$(pwd)/scripts:\$PATH >> ~/.bash_profile instead of .bashrc

That all sounds a little messy… I’m sure there must be a simpler way. Have other MacOSX users also found installation to be that complicated…?

Works for me…

I am on Mac OS X 10.11.3 with Xcode 7.2 and current macports.

Eigen 3 was installed through macports (sudo port install eigen3).
Qt 5.5 was installed through its official installer.

./configure output:

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.5.0)
Checking for Qt qmake: qmake (version 5.5.0)
Checking for Qt rcc: rcc (version 5.5.0)
Checking for Qt: 5.5.0

writing configuration to file './release/config': ok

./build output:

 (  1/412) [CC] release/cmd/tckgen.o
 ...
 (412/412) [LB] release/bin/sh2amp

Works like a charm:

$ release/bin/mrinfo -version
== mrinfo 0.3.13-779-gb0423106 ==
64 bit release version, built Mar 17 2016, using Eigen 3.2.8
...

Can you provide detail about your setup and how you installed the dependencies?

Cheers,
Ben

From your eigen3 path, I assume you used homebrew to install eigen3?

In my experience, macports is much more mature and offers a much smoother experience… In any case, make sure you are using only one of both systems.

@jdtournier: I am not sure about the other Mac OS X developers, but I would vouch for removing the homebrew references and sticking to just macports. With the current instructions, what I have seen happening on quite a few occasions is this: 1) people try macports first, but for some unrelated reason they didn’t manage to build the software on the first go; 2) they try homebrew instead hoping that this might fix their initial problem; 3) the duplicated and incompatible dependencies will cause havoc

Hi Ben,

I didn’t use homebrew, I just downloaded the source code for eigen3. Installed Qt via the official installer.

Perhaps change the installation instructions to use macports as default?

Mac 10.11.3/Qt 5.4/Xcode 6.3
mrinfo -version == mrinfo 0.3.13-777-g4e727e7c == 64 bit release version, built Mar 17 2016, using Eigen 3.2.8

Pim

Actually, I think Pim’s issue might be more related to him installing from source, which is currently the “recommended” way on the Wiki. Apparently, this may require special care of the include-path.

Personally, I never experienced any issues with Eigen when installing through Homebrew. Just recently, on a clean system, I did brew install eigen, and then plain and simple ./configure and ./build. No need to set any environment variables. Worked straight out of the box.

I agree with @bjeurissen that Macports and Homebrew don’t work well together, but I would refrain from favouring one over the other on the wiki. Many users might already have one of both installed, and would want to work with that. If they don’t, I would personally recommend Homebrew (that’s just me, plenty of port vs brew debates on the web already).

Therefore, I would suggest expanding the build instructions for both Homebrew and Macports, but remove or at least discourage the option of installing from source.

Pim,

Using the source code it also works fine on my machine. Just unpack the archive and pass the eigen path to the configure script using:

EIGEN_CFLAGS="-isystem /where/you/extracted/eigen" ./configure

@dchristiaens: I didn’t know unpacking the source was recommended. In that case I would favour a single option: unpacking the source and remove the homebrew and macports stuff. Developers will go their own way, but for users it is just too confusing at the moment and I think we should hold their hand and point them to the single solution.

exactly what I did :wink:

Pim, are you sure you didn’t do EIGEN_CFLAGS="-isystem /where/you/extracted/eigen/Eigen" ./configure ? I think Donald was on to something…

I tried to clarify some of the OS X installation instructions here: https://github.com/MRtrix3/mrtrix3/pull/471. I only use homebrew, against which I have tested it. So let me know or feel free to change it if any of the other ways don’t work.

@bjeurissen: Fine with me too, as long as it’s properly documented. Maybe just add the command of your last post to the docs?

On a more general note, I am wondering if we could automate the Eigen install altogether (ideally for all systems)? I assume the licence doesn’t allow to simply ship Eigen with MRtrix. However, if configure doesn’t detect an existing installation, it could clone the latest version into, say, mrtrix3/Eigen and proceed from there. Main issue is that Eigen uses Mercurial instead of git, which is not installed by default. Thoughts?

Very nice Max. I like how you separate 3 main options, and then advise to install both Eigen and Qt in that same way.

Pretty sure I was… :wink:

In the code, we’d include the Eigen headers as #include <Eigen/Array>, etc. The correct path to add to the CFLAGS is therefore that enclosing the main Eigen folder, not the Eigen folder itself. There shouldn’t have been a conflict using the correct path.

As to how to fix the instructions, I think providing clear instructions for the 3 different approaches is probably the best, with a solid default recommendation. @maxpietsch tells me you can install all the dependencies including Qt5 via homebrew, so this seems like the simplest and least likely to trip up users. No idea whether Qt5 can be installed via macports, but assuming it can’t, the requirement to also install the massive Qt5 installer (and remember where it was installed) makes the overall installation process more complex, and hence more error-prone. So that would argue for macports not being the default option. But given that many people will swear by macports, we need to provide instructions for it. The direct download route should probably be the last resort…

Hi Donald,

Been following this thread pretty loosely, so apologies if I’m repeating information. Just wanted to say you can install Qt5 via MacPorts, it’s documented here.

Disclaimer: I haven’t actually used this, I did my installation with homebrew which worked a charm : )

Qt5 via MacPorts is just a matter of port install qt5, so it is equally well supported…

OK, I guess that answers that question then… I think we should move the conversation over to the relevant GitHub issue - I can’t keep track of the discussion on two fronts at once…