# Building mrtrix3 on RHEL 7

**URL:** <https://community.mrtrix.org/t/building-mrtrix3-on-rhel-7/1558>\
**Category:** Uncategorized\
**Tags:** installation\
**Created:** [March 29, 2018, 6:35pm UTC](https://community.mrtrix.org/t/building-mrtrix3-on-rhel-7/1558 "2018-03-29T18:35:10Z")\
**Posts on this page:** 1\
**Showing post:** 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 29, 2018, 7:36pm UTC](https://community.mrtrix.org/t/building-mrtrix3-on-rhel-7/1558/2 "2018-03-29T19:36:13Z")

</div>

Yes, that looks like a similar problem to [this thread](https://community.mrtrix.org/t/installation-problem-json-requirements-windows/1512/20?u=jdtournier), which is basically an incomplete compiler installation. In your case, the compiler executable is in a non-standard location, and when it tried to link the final executable with the c++ libraries, it can’t find the correct version of it because their location isn’t in the linker search path. Working with custom compilers can be a bit tricky from that point of view, and getting it right would require setting the correct `CXX`, `CFLAGS`, and `LDFLAGS`, in your case _probably_ like this:

```auto
export CXX=/usr/local/bin/gcc
export CFLAGS="-isystem /usr/local/include"
export LDFLAGS="-L/usr/local/lib"

```

You _may_ find that’s sufficient to compile – but probably not to run anything you’ve just compiled, which is still required for the configure step. For that, you’d need to set the path for the dynamic linker. The simplest way to do this is probably:

```auto
export LD_LIBRARY_PATH=/usr/local/lib

```

With that, you might be able to run through the configure and build steps.

If that works, you’ll also need to set the `LD_LIBRARY_PATH` variable before invoking any of the newly generated executables… However, as I’d hinted in the previous thread, that’s generally discouraged, the better way to set the linker search path is by adding an entry to `/etc/ld.so.conf.d/`, as explained e.g. [here](http://howtolamp.com/articles/adding-shared-libraries-to-system-library-path/).

If all else fails, you could try [this script](https://gist.github.com/jdtournier/cf06ab4136efbca6b4ccca32b50b2891), which I’ve put together based on [these instructions](http://mrtrix.readthedocs.io/en/latest/installation/hpc_clusters_install.html#installation-of-mrtrix3-and-dependencies-from-source) (from @rsmith), which might get you most of the way - but it does involve building _all_ dependencies from source, which is a fair bit more involved than might be required in your case…

---

_[View the full topic](https://community.mrtrix.org/t/building-mrtrix3-on-rhel-7/1558)._
