Build error on 32-bit Ubuntu 16.04: Eigen 3 memory alignment requirements

Dear experts,

I am having difficulties with building mrtrix3 on 32-bit Ubuntu 16.04. I am ending with

ERROR: memory alignment of default allocator is not sufficient for Eigen3 to operate correctly

Is it even possible to build mrtrix3 on 32 bit system?

Regards,
Antonin Skoch

My configure.log is as follows:

REPORT: 
MRtrix build type requested:

REPORT: release

REPORT: 

REPORT: Detecting OS: linux

REPORT: Checking for C++11 compliant compiler [g++]:
EXEC <<
CMD: g++ -dumpversion
EXIT: 0
STDOUT:
5.4.0
>>


REPORT: 5.4.0

COMPILE /tmp/tmptO0gbo.cpp:
---

struct Base {
    Base (int);
};
struct Derived : Base {
    using Base::Base;
};

int main() {
  Derived D (int); // check for contructor inheritance
  return (0);
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmptO0gbo.cpp -o /tmp/tmptO0gbo.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmptO0gbo.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT:  - tested ok

REPORT: Detecting pointer size:

COMPILE /tmp/tmp6nBnl_.cpp:
---

#include <iostream>
int main() {
  std::cout << sizeof(void*);
  return (0);
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmp6nBnl_.cpp -o /tmp/tmp6nBnl_.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmp6nBnl_.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
4
>>


REPORT: 32 bit

REPORT: Detecting byte order:

REPORT: little-endian

REPORT: Checking for variable-length array support:

COMPILE /tmp/tmp4zmA5_.cpp:
---


int main(int argc, char* argv[]) {
  int x[argc];
  return 0;
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmp4zmA5_.cpp -o /tmp/tmp4zmA5_.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmp4zmA5_.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT: yes

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

COMPILE /tmp/tmpVWuI0X.cpp:
---

#include <string>

class X {
  int x;
  double y;
  std::string s;
};

int main(int argc, char* argv[]) {
  X x[argc];
  return 0;
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmpVWuI0X.cpp -o /tmp/tmpVWuI0X.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpVWuI0X.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT: yes

REPORT: Checking for zlib compression library:

COMPILE /tmp/tmp8HnXdh.cpp:
---

#include <iostream>
#include <zlib.h>

int main() {
  std::cout << zlibVersion();
  return (0);
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmp8HnXdh.cpp -o /tmp/tmp8HnXdh.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmp8HnXdh.o -pthread -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
1.2.8
>>


REPORT: 1.2.8

REPORT: Checking for Eigen 3 library:
EXEC <<
CMD: pkg-config --cflags eigen3
EXIT: 0
STDOUT:
-I/usr/include/eigen3
>>


COMPILE /tmp/tmpv_Yzk_.cpp:
---

#include <Eigen/Core>
#include <iostream>

int main (int argc, char* argv[]) {
  std::cout << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << "\n";
  return 0;
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -isystem /usr/include/eigen3 /tmp/tmpv_Yzk_.cpp -o /tmp/tmpv_Yzk_.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpv_Yzk_.o -pthread -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
3.2.92
>>


REPORT: 3.2.92

REPORT: Checking Eigen 3 memory alignment requirements:

COMPILE /tmp/tmp8r6ESu.cpp:
---

#include <iostream>
#include <Eigen/Core>

int main (int argc, char* argv[]) 
{
#ifdef EIGEN_DEFAULT_ALIGN_BYTES
  size_t default_align = std::numeric_limits<size_t>::max();
  for (size_t n = 0; n < 100; ++n) {
    struct alignas(64) X { double c[8]; };
    X* x = new X;
    size_t align = reinterpret_cast<size_t>(x) & 63U;
    if (align && align < default_align)
      default_align = align;
  }
  std::cout << "allocator memory alignment: " << default_align << ", Eigen3 needs: " << EIGEN_DEFAULT_ALIGN_BYTES << "\n";

  return default_align < EIGEN_DEFAULT_ALIGN_BYTES;
#else
  return 0;
#endif
}


---
EXEC <<
CMD: g++ -c -v -std=c++11 -mno-avx -pthread -fPIC -march=native -isystem /usr/include/eigen3 /tmp/tmp8r6ESu.cpp -o /tmp/tmp8r6ESu.o
EXIT: 0
STDERR:
Using built-in specs.
COLLECT_GCC=g++
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
COLLECT_GCC_OPTIONS='-c' '-v' '-std=c++11' '-mno-avx' '-pthread' '-fPIC' '-march=native' '-isystem' '/usr/include/eigen3' '-o' '/tmp/tmp8r6ESu.o' '-shared-libgcc'
 /usr/lib/gcc/i686-linux-gnu/5/cc1plus -quiet -v -imultiarch i386-linux-gnu -D_GNU_SOURCE -D_REENTRANT -isystem /usr/include/eigen3 /tmp/tmp8r6ESu.cpp -march=core2 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=core2 -quiet -dumpbase tmp8r6ESu.cpp -mno-avx -auxbase-strip /tmp/tmp8r6ESu.o -std=c++11 -version -fPIC -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cc2uEcEz.s
GNU C++11 (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (i686-linux-gnu)
	compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/i386-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/i686-linux-gnu/5/../../../../i686-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/eigen3
 /usr/include/c++/5
 /usr/include/i386-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/i686-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/i686-linux-gnu/5/include-fixed
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
GNU C++11 (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (i686-linux-gnu)
	compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 427d6507e583781294a191f5962a1495
COLLECT_GCC_OPTIONS='-c' '-v' '-std=c++11' '-mno-avx' '-pthread' '-fPIC' '-march=native' '-isystem' '/usr/include/eigen3' '-o' '/tmp/tmp8r6ESu.o' '-shared-libgcc'
 as -v --32 -o /tmp/tmp8r6ESu.o /tmp/cc2uEcEz.s
GNU assembler version 2.26.1 (i686-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.26.1
COMPILER_PATH=/usr/lib/gcc/i686-linux-gnu/5/:/usr/lib/gcc/i686-linux-gnu/5/:/usr/lib/gcc/i686-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/5/:/usr/lib/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/5/:/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/5/../../../../lib/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i686-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-v' '-std=c++11' '-mno-avx' '-pthread' '-fPIC' '-march=native' '-isystem' '/usr/include/eigen3' '-o' '/tmp/tmp8r6ESu.o' '-shared-libgcc'
>>

EXEC <<
CMD: g++ /tmp/tmp8r6ESu.o -pthread -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 1
STDOUT:
allocator memory alignment: 8, Eigen3 needs: 16
>>


ERROR:  memory alignment of default allocator is not sufficient for Eigen3 to operate correctly!

  Please report this to the MRtrix3 developer team, providing the full "configure.log" file

I’m assuming you’re trying to install version 0.3.16? This particular test is no longer performed on subsequent versions, as of this commit. Can you try installing 3.0_RC1, see if that works?

Dear @jdtournier,

thanks for the suggestion. I eventually found that my repository was not in the up-to-date state, evidently there was older ./configure code remaining. I do not understand why this was the case, since I did git pull and git status showed that I am on branch master. Do you have any idea what could be wrong? My knowledge of git is still very basic.

I finally started from the scratch, removed all files, did new git clone and ./configure and ./build was without errors.

Btw, I think that documentation page on particular available mrtrix versions (git tags and branches) and how to switch between them would be useful for general users.

That’s a good suggestion… I’ll make a note of that - although the chances of my finding the time are relatively slim…