Mrtrix3 configuration problem on Windows Subsystem for Linux (WSL)

Hi,

I’m having trouble with the configuration step on WSL. Please find below details from the generated configure.log file. Thanks for your help.

Vinny

MRtrix build type requested: release

Detecting OS: linux
Looking for compiler [clang++]: not found
Looking for compiler [g++]: g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Checking for C++11 compliance: ok
Checking for ::max_align_t: ok
Checking for std::max_align_t: not found
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: yes
Checking for zlib compression library: 1.2.8
Checking for TIFF library: not found - TIFF support disabled
Checking for Eigen 3 library: 3.2.0
Checking JSON for Modern C++ requirements:
ERROR:  error compiling JSON test application!

  MRtrix3 was unable to compile a test program involving JSON for Modern C++. Your compiler may not be sufficiently up-to-date.

  See the file 'configure.log' for details. If this doesn't help and you need
  further assistance, please post on the MRtrix3 community forum
  (http://community.mrtrix.org/), and make sure to include the full contents of
  the 'configure.log' file.

Hi Vinny,

The compiler version (g++ 4.8.4) is inadequate. Although this version claims to be C++11 compatible, and a basic test program may compile, it is not fully C++11 compliant, and many features will not compile or will not run properly. The contents of the file configure.log should provide more information about this.

Note also that if compiling within WSL, you will not be able to use the GUI commands, so will need to request a command-line only configuration using the -nogui option. We recommend instead installing using MSYS2 on Windows systems for this reason.

Cheers
Rob

Hi Rob,

I am installing ANTsR, which requires a number of Linux-dependent packages such as FSL and FreeSurfer,. Since I have a Windows 10 OS, I’m using WSL to get ANTsR… https://github.com/stnava/ANTsR/wiki/Installing-ANTsR-in-Windows-10-(along-with-FSL,-Rstudio,-Freesurfer,-etc).

Mrtrix3 is a required as part of the ANTsR installation. So, I’m guessing that MSYS2 would not be used with ANTsR in general? How would I request a command-line only configuration using the -nogui option?

Thanks for your help,

Vinny

Mrtrix3 is a required as part of the ANTsR installation. So, I’m guessing that MSYS2 would not be used with ANTsR in general?

I haven’t touched WSL (or Windows 10), so I don’t know whether or not binaries / paths can be shared across subsystems. But given the dependencies you list, I’m guessing that ANTsR would not be possible to install within MSYS2.

How would I request a command-line only configuration using the -nogui option?

By using the -nogui option when you run the configure script. Simple as that :stuck_out_tongue:

All it does is disable the Qt tests during the configuration, and instruct the build script to not attempt to compile any GUI-related components of MRtrix3, including the commands mrview and shview.

Rob

Hi Rob,

I ran the command ./configure -nogui but still got an error. Please see below details from the configure.log file.

Thanks,
Vinny

REPORT: 

MRtrix build type requested:


REPORT: release


REPORT:  [command-line only]


REPORT: 


REPORT: Detecting OS: linux


REPORT: Looking for compiler [clang++]:

EXEC 
<<

CMD: clang++ --version

error invoking command "clang++": No such file or directory

>>



REPORT: not found


REPORT: Looking for compiler [g++]:

EXEC <<

CMD: g++ --version

EXIT: 0


STDOUT:

g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

>>



REPORT: g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4


REPORT: Checking for C++11 compliance:


COMPILE /tmp/tmpM3jw40.cpp:

---


#include <cstddef>

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 -pthread -fPIC /tmp/tmpM3jw40.cpp -o /tmp/tmpM3jw40.o

EXIT: 0

>>


EXEC <<
CMD: g++ /tmp/tmpM3jw40.o -pthread -o a.out

EXIT: 0

>>


EXEC <<
CMD: ./a.out

EXIT: 0

>>


REPORT: ok


REPORT: Checking for ::max_align_t:


COMPILE /tmp/tmpJPG5V8.cpp:

---


#include <cstddef>

using ::max_align_t;

int main() {
 
 return 0;

}


---

EXEC 
<<
CMD: g++ -c -std=c++11 -pthread -fPIC /tmp/tmpJPG5V8.cpp -o /tmp/tmpJPG5V8.o

EXIT: 0

>>

EXEC <<

CMD: g++ /tmp/tmpJPG5V8.o -pthread -o a.out

EXIT: 0

>>


EXEC <<
CMD: ./a.out

EXIT: 0

>>



REPORT: ok


REPORT: Checking for std::max_align_t:


COMPILE /tmp/tmpKnD5Iu.cpp:

---


#include <cstddef>

using std::max_align_t;

int main() {

  return 0;

}


---

EXEC <<

CMD: g++ -c -std=c++11 -pthread -fPIC /tmp/tmpKnD5Iu.cpp -o /tmp/tmpKnD5Iu.o

EXIT: 1

STDERR:

/tmp/tmpKnD5Iu.cpp:3:12: error: std::max_align_t has not been declared

 using std::max_align_t;

            ^

>>


error deleting temporary file "/tmp/tmpKnD5Iu.o": No such file or directory

REPORT: not found


REPORT: Detecting pointer size:


COMPILE /tmp/tmpUBpB2C.cpp:

---


#include <iostream>

int main() {
 
 std::cout << sizeof(void*);

 return (0);

}


---

EXEC <<

CMD: g++ -c -std=c++11 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED /tmp/tmpUBpB2C.cpp -o /tmp/tmpUBpB2C.o

EXIT: 0

>>


EXEC <<

CMD: g++ /tmp/tmpUBpB2C.o -pthread -o a.out

EXIT: 0

>>


EXEC <<

CMD: ./a.out

EXIT: 0

STDOUT:

8

>>



REPORT: 64 bit


REPORT: Detecting byte order:


REPORT: little-endian


REPORT: Checking for variable-length array support:


COMPILE /tmp/tmpsjCfSO.cpp:

---



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

 return 0;

}


---

EXEC <<

CMD: g++ -c -std=c++11 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED -DMRTRIX_WORD64 /tmp/tmpsjCfSO.cpp -o /tmp/tmpsjCfSO.o

EXIT: 0

>>


EXEC <<

CMD: g++ /tmp/tmpsjCfSO.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/tmptjZbq8.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 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED -DMRTRIX_WORD64 /tmp/tmptjZbq8.cpp -o /tmp/tmptjZbq8.o

EXIT: 0

>>


EXEC <<

CMD: g++ /tmp/tmptjZbq8.o -pthread -o a.out

EXIT: 0

>>


EXEC <<

CMD: ./a.out

EXIT: 0

>>



REPORT: yes


REPORT: Checking for zlib compression library:


COMPILE /tmp/tmpmmh1jS.cpp:

---


#include <iostream>

#include <zlib.h>


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

}


---

EXEC <<

CMD: g++ -c -std=c++11 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED -DMRTRIX_WORD64 /tmp/tmpmmh1jS.cpp -o /tmp/tmpmmh1jS.o

EXIT: 0

>>


EXEC <<

CMD: g++ /tmp/tmpmmh1jS.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 TIFF library:


COMPILE /tmp/tmpLVgebs.cpp:

---


#include <iostream>

#include <tiffio.h>


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

}


---

EXEC <<

CMD: g++ -c -std=c++11 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED -DMRTRIX_WORD64 /tmp/tmpLVgebs.cpp -o /tmp/tmpLVgebs.o

EXIT: 1

STDERR:

/tmp/tmpLVgebs.cpp:3:20: fatal error: tiffio.h: No such file or directory
 
 #include <tiffio.h>
                    
                    ^
compilation terminated.

>>


error deleting temporary file "/tmp/tmpLVgebs.o": No such file or directory

REPORT: not found - TIFF support disabled


REPORT: Checking for Eigen 3 library:

EXEC <<

CMD: pkg-config --cflags eigen3

EXIT: 0

STDOUT:

-I/usr/include/eigen3

>>



COMPILE /tmp/tmpJ3qqH5.cpp:

---


#include <cstddef>

#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 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED -DMRTRIX_WORD64 -isystem /usr/include/eigen3 /tmp/tmpJ3qqH5.cpp -o /tmp/tmpJ3qqH5.o

EXIT: 0

>>


EXEC <<

CMD: g++ /tmp/tmpJ3qqH5.o -pthread -lz -o a.out

EXIT: 0

>>


EXEC <<

CMD: ./a.out

EXIT: 0

STDOUT:
3.2.0

>>



REPORT: 3.2.0


REPORT: Checking JSON for Modern C++ requirements:

COMPILE /tmp/tmpk_jRJb.cpp:

---


#include "file/json.h"


int main (int argc, char* argv[])
{
 
 nlohmann::json json;
 
 json["key"] = "value";

}



---

EXEC <<

CMD: g++ -c -std=c++11 -pthread -fPIC -DMRTRIX_STD_MAX_ALIGN_T_NOT_DEFINED -DMRTRIX_WORD64 -I/home/Vinit/mrtrix3/core /tmp/tmpk_jRJb.cpp -o /tmp/tmpk_jRJb.o

EXIT: 1

STDERR:

In file included from /tmp/tmpk_jRJb.cpp:2:0:

/home/Vinit/mrtrix3/core/file/json.h:67:10: error: 
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"

         #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
          
          ^

>>


error deleting temporary file "/tmp/tmpk_jRJb.o": No such file or directory

ERROR:  error compiling JSON test application!

 
 MRtrix3 was unable to compile a test program involving JSON for Modern C++. Your compiler may not be sufficiently up-to-date.

 
 See the file 'configure.log' for details. If this doesn't help and you need
 
 further assistance, please post on the MRtrix3 community forum
 
 (http://community.mrtrix.org/), and make sure to include the full contents of
 
 the 'configure.log' file.

Vinny

The -nogui option will only solve the inevitable issues that you would encounter if trying to compile GUI commands within WSL. However this does not do anything to solve the fundamental issue regarding the out-of-date version of GCC.

As you can see in file configure.log, the final error provides this:

#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"

The link provided by the error message describes that GCC 4.8 is unsupported due to bugs in C++11 support, as I mentioned previously. Therefore the only way you will be able to install MRtrix3 is by updating the compiler. If doing a “normal” system update within WSL does not achieve this, you may need to explicitly search for a package that will install “GCC version 5” (I believe I encountered this in the past on Ubuntu, so WSL may be the same).

Cheers
Rob

Hi Rob,

I installed GCC version 5 using the following commands from https://gist.github.com/beci/2a2091f282042ed20cda:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g+±5

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g+±5

The configuration (including GUI) and binaries building proceeded without incident followed by setting the path. However, when I typed ‘mrview’ I got the following error message:

X Error: BadRequest (invalid request code or no such operation) 1
Extension: 143 (Uknown extension)
Minor opcode: 34 (Unknown request)
Resource id: 0x800037
mrview: [WARNING] unable to determine OpenGL version - operation may be unstable if actual version is less than 3.3
mrview: [ERROR] GLSL log [vertex shader]: 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, and 1.00 ES

mrview: [ERROR] error compiling OpenGL vertex shader ID 1
QWidget: Must construct a QApplication before a QPaintDevice
Aborted (core dumped)

Thanks,
Vinny

Hi again Rob,

When I run glxinfo | grep “OpenGL version”, the output is:
OpenGL version string: 2.1 Mesa 10.1.3

From what I see in previous posts, openGL drivers on a Linux platform are problematic to use.

Thanks,

Vinny

There’s a bunch of issues with running on the WSL that you’ve hit on in this thread…

Some of them actually relate to the specific version of Ubuntu that you have running, and so most of the warnings on the Linux install page are relevant, in particular issues with using too old a compiler, as mentioned by @rsmith. This might actually be fixed simply by using a later version such as 16.04.

The other issue is that as far as I know, WSL comes without an X server, so the GUI components can’t run. You’ll have no trouble building them as long as the compile-time dependencies are installed, but it’ll fail to detect a suitable graphics environment at runtime, and give an error message such as cannot connect to X server (as per this post).

In your case, I expect you’ve installed a separate X server, as mentioned in other posts?
If so, then you’ve hit the exact same problem as they did:

which is that you’re very unlikely to find any X server on Windows that will support modern OpenGL (version 3.0 and above). At the moment, the only way to get mrview to run on Windows is the MSYS2 route, as @rsmith mentioned…

No problem running the command-line tools though, and as @rsmith suggested, you should be able to run the two installs side-by-side, so you can use the MSYS2 version of MRView when needed. Not ideal, but that’s probably the best we can do at the moment if you absolutely need to use the WSL…

Just as a side note: there is a chance that GUI support might eventually make it to the Windows Subsystem for Linux if they implement support for Wayland (X11 is being phased out in general), as per this issue. mrview runs just fine on Wayland thanks to Qt5 supporting it out of the box. Watch this space…

1 Like

Hi,

Thank you very much for the clarification! I had done a config -nogui and everything went fine on WSL, so all the image processing would be done in the bash environment. So for MSYS2, I’ll have to install and build this separately on my Windows 10 platform. Do I have to transfer the outputs from bash to Windows in order to view with mrview? I’m not sure how to use these side-by-side.

Thanks,
Vinny

Neither do I - I’ve never looked at the WSL. But the Microsoft WSL FAQ seems to answer some of your questions…?

I’ll take a look at that link. Also, I came across this post by someone… MRtrix, FSL, ANTS, ... on the Windows subsystem for Linux. Suggests to have both terminals (Ubuntu and MinGW) opened in the same path/folder. I’ll give this a try and see if it works. Thanks again for all your help!

This should indeed work. I’ve briefly tested/used it successfully myself before. Both environments have their own system folder structure somewhere as a bunch of folders in windows’ filesystem, but they can go to any path… so simply choose an easy/short location for your data, and you can easily do side-by-side processing and viewing. You can even leave the viewer opened, and open image files or other results from there. Purely for the processing side of things, I can happily recommend the WSL over MSYS2. Much more robust to install all dependencies (and e.g. FSL, ANTS, …). Now if they only get to implementing that Wayland support… :crossed_fingers:

WSL can run GUIs. You just need to have an x server (I’ve used both Xming and mobaxterm) running and to set your DISPLAY variable. You can also install Debian or other distros if you’d prefer them over Ubuntu. “mrview” works fine.

Wow, that’s great news! I’ll give that a try later. I knew it was possible to run X11 apps on WSL with a separate X server, but I didn’t think they’d support OpenGL 3.3 – this would be awesome, and we likely change our recommended install instructions if that holds up. Thanks for the tip!

I’m just getting started with mrtrix, so I may have spoken too soon. I only tried running mrview with some simple images, and that works fine. Would that even need opengl? Maybe I just haven’t tried the thing that doesn’t work.

OK, tried WSL with Ubuntu 18.04, mobaxterm does work, but with software rendering only – hardware rendering is limited to OpenGL 3.0. I tried XMing briefly, that failed straight away, but I’m using the free version, which is probably quite outdated. I’d need to pay to install the latest version, but I’d rather know that it works before I do that… Can you confirm that you get mrview to display with Xming? And if so, which version exactly?

I’ll try later when I’m not in the middle of other work, but I suspect I’ll get the same result as you. I was speaking of guis generally when I said they worked with xming (I thought you were saying that wsl didn’t support guis at all). I only tried mrview with mobaxterm.

OK, I’ve gone and donated to the XMing project to get access to their latest version. It works if using software rendering (the default), but fails when forcing hardware rendering (the highest version officially supported is 1.4, for the same reason as for regular X11 forwarding: that’s the highest that the GLX supports).

So it looks like the simplest approach for display within WSL is mobaxterm (it’s free and works well), but with the limitations that it’s software-only, so performance won’t be as good as it could be with proper hardware acceleration (which you do get with our ‘official’ MSYS2 instructions). But that does mean that WSL can be used, making it much easier to inter-operate with FSL and ANTs, amongst others. I think that’s a very appealing solution for that reason alone, even if display performance is suboptimal…

[EDIT] note that for this to work, you need to compile against Qt4 - for some reason Qt5 doesn’t seem to detect the correct version of OpenGL…

For reference, this is what (I think) I did on a fresh Ubuntu 18.04 Windows Subsystem for Linux install:

sudo apt-get install python git gcc libeigen3-dev libfftw3-dev libtiff-dev libqt4-opengl-dev 
git clone https://github.com/MRtrix3/mrtrix3.git
cd mrtrix3
./configure
./build
./set_path

Then close the terminal, start mobaxterm, start a fresh Ubuntu terminal, and run:

export DISPLAY=:0 
mrview

Assuming that works, you’ll want to add that export DISPLAY=:0 line to your ~/.bashrc file to make it permanent.

2 Likes