# Installation Problem, JSON requirements | Windows

**URL:** <https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512>\
**Category:** Uncategorized\
**Created:** [March 9, 2018, 2:10pm UTC](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512 "2018-03-09T14:10:00Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [March 23, 2018, 8:50pm UTC](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512/21 "2018-03-23T20:50:42Z")

</div>

Yes, so that sounds like a similar problem. I’m guessing you’re compiling MRtrix with a non-default compiler? What might be happening is that the MRtrix executables are compiled for a certain version of the c++ standard library (matching your compiler), but at runtime, the system’s default version is used. It’s a similar issue in that the fix is likely to be to somehow modify the linker search path to include the non-default version first. But you probably also want to avoid other non-MRtrix commands using the custom version, so it’s probably not a good idea to make that the system-wide default. So it’s a tricky one to handle…

Thankfully, I reckon there might be a relatively easy fix – assuming I’ve got this right. Normally you’d be adding an entry to the `/etc/ld.so.conf` file (or `ld.so.conf.d/` folder) with the path to the folder containing your compiler’s libraries, but that’ll set it system-wide (all users). Another approach is to add that location to the `LD_LIBRARY_PATH` environment variable, which will set it for that session only – better, but other non-MRtrix commands in that session might be affected (and besides, that approach is generally frowned upon for security reasons). So still not ideal.

I think your best bet will be to create a _symbolic link_ to the right library in the MRtrix3 `lib/` folder – our executables are hard-coded to look there first, to make sure they find the right version of the MRtrix3 library (`libmrtix-3.0_RC2.so` or similar), which means that any libraries placed here will be used in preference to the system ones – but only for our executables, just what we want…

To do this, first check where your compiler is (it should say near the top of `configure.log`), and check what libraries are actually being used at runtime (e.g. `ldd bin/mrinfo`). I’m guessing you’ll find that it’s trying to use the `libstdc++.so` from the standard location (e.g. `/usr/lib`), when your compiler would have installed its version elsewhere (e.g. if the compiler used was `/usr/local/bin/g++`, I’d expect the library to be `/usr/local/lib/libstdc++.so`). If you figure out where it is exactly, you can try to create a _symbolic link_ to it within the MRtrix3 `lib/` folder like this:

```auto
cd lib
ln -s /usr/local/lib/libstdc++.so`
cd ..

```

At which point, check whether the command now works, and whether the linker finds the right version of the library this time (`ldd bin/mrinfo` once again).

Hope that at least points you in the right direction…

---

<div class="post-metadata">

**Author:** ![MrtnStnwk](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@MrtnStnwk](https://community.mrtrix.org/u/MrtnStnwk)\
**Post date:** [March 27, 2018, 2:00pm UTC](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512/22 "2018-03-27T14:00:50Z")

</div>

Hi JD,

Thank you for your detailed response. I guess my question was not entirely clear; this problem turns up right away when configuring.

```
[martijn@localhost mrtrix3]$ ./configure

MRtrix build type requested: release

Detecting OS: linux
Looking for compiler [clang++]: not found
Looking for compiler [g++]: g++ (GCC) 5.4.0
Checking for C++11 compliance: ok
Checking shared library generation: ok
Detecting pointer size: 64 bit
Detecting byte order: little-endian
Checking for variable-length array support: ok
Checking for non-POD variable-length array support: not found
Checking for ::max_align_t: 16 bytes
Checking for std::max_align_t: 16 bytes
Checking for Eigen3 library: 3.2.5
Checking for zlib compression library: 1.2.7
Checking for "JSON for Modern C++" requirements: 
ERROR: runtime error!
  
   Unable to configure JSON for modern C++

  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.

```

The configure.log tells me that the configuration process fails because of the following error.

```
REPORT: Checking for "JSON for Modern C++" requirements:

COMPILE /tmp/tmpWYwJ_R.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_WORD64 -DMRTRIX_NO_NON_POD_VLA -I/home/martijn/apps/mrtrix3/core /tmp/tmpWYwJ_R.cpp -o /tmp/tmpWYwJ_R.o
EXIT: 0
>>

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

EXEC <<
CMD: ./a.out
EXIT: 1
STDERR:
./a.out: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./a.out)
>>

ERROR: runtime error!
  
   Unable to configure JSON for modern C++

  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.

```

It should be said that I updated the system GCC to 5.4.0 because the default 4.8 is too old for compiling Mrtrix (that’s what the documentation said).

I also tried to compile with devtoolset 7, but then the configure script fails even earlier.

Best,  
Martijn

---

<div class="post-metadata">

**Author:** ![MrtnStnwk](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@MrtnStnwk](https://community.mrtrix.org/u/MrtnStnwk)\
**Post date:** [March 27, 2018, 2:22pm UTC](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512/23 "2018-03-27T14:22:06Z")

</div>

Okay, it turns out that the following command solved the issue:

```
LD_PRELOAD=/usr/local/lib64/libstdc++.so.6.0.21 MOC=/usr/bin/moc-qt5 QMAKE=/usr/bin/qmake-qt5 ./configure

```

Thanks for thinking with me.

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [March 27, 2018, 2:56pm UTC](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512/24 "2018-03-27T14:56:03Z")

</div>

Ok, good to hear. Bear in mind that this `LD_PRELOAD` will be needed for every MRtrix command invocation… I would still recommend placing a symbolic link to that library in the MRtrix `lib/` folder, which would avoid that.

Also, just realised that this trick only works at runtime, once the executables have already been built – you would indeed have needed other strategies to configure and build… If that trick works, all the better!

---

<div class="post-metadata">

**Author:** ![MrtnStnwk](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@MrtnStnwk](https://community.mrtrix.org/u/MrtnStnwk)\
**Post date:** [March 27, 2018, 2:57pm UTC](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512/25 "2018-03-27T14:57:48Z")

</div>

> Ok, good to hear. Bear in mind that this LD\_PRELOAD will be needed for every MRtrix command invocation… I would still recommend placing a symbolic link to that library in the MRtrix lib/ folder, which would avoid that.

Yes, that’s what I just found out. Thanks!

[Previous page](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512.md?page=1)
