Error after installation

Hi, I just installed the Matrix3. However, I got the error message after running mrview from command line:

dyld: Library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib
  Referenced from: /usr/local/mrtrix3/lib/libmrtrix.dylib
  Reason: Incompatible library version: libmrtrix.dylib requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
/usr/local/bin/mrview: line 7:  8190 Abort trap: 6           "${f}"/MRView.app/Contents/MacOS/mrview "$@"

Similar error message was received for other commands:

dyld: Library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib
  Referenced from: /usr/local/bin/dwi2mask
  Reason: Incompatible library version: dwi2mask requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
Abort trap: 6

It seems the installation is incomplete. Can anyone help?

Hello,

It seems the installation is complete, but you have an older version of the xz compression library installed in the /usr/local/opt/xz/ folder that isn’t compatible with the version that MRtrix was compiled for, and that version happens to be the first one that the system comes across when trying to launch our commands.

To figure this out, can you tell us:

  • how did you install MRtrix? From source, or using one of our precompiled installers? If the latter, which one?

  • if from source, can you post the contents of your config file (in the MRtrix source folder)?

  • we need to figure out why /usr/local/opt/xz/, a non-standard location, is included in the library search path (i.e. why does it even try to load a library from there, rather than the standard system one?). Maybe you installed some other piece of software that needed it?

    If you can’t think of a reason, we need to figure out how to instruct the system not to look there. I suspect this will be due to having set some environment variables. Can you post the output of:

    echo $DYLD_LIBRARY_PATH
    echo $DYLD_FALLBACK_FRAMEWORK_PATH
    echo $DYLD_FALLBACK_LIBRARY_PATH
    

    I suspect one of these will list the problematic folder. You’d then need to figure out how to get rid of it. It will probably have been set in one of your shell startup files, e.g. ~/.profile, ~/.bashrc, ~/.zshrc, or something.

Thank you for the response. Please see my answers below:

  1. I installed Matrix3 by using
    sudo bash -c “$(curl -fsSL https://raw.githubusercontent.com/MRtrix3/macos-installer/master/install)”
  2. n/a
  3. “echo $DYLD_LIBRARY_PATH” -> /Applications/MNE-2.7.3-3268-MacOSX-i386/lib:/Applications/freesurfer/lib/gcc/lib
    The ‘DYLD_FALLBACK_FRAMEWORK_PATH’ and ‘DYLD_FALLBACK_LIBRARY_PATH’ don’t exist.

It seems the FreeSurfer uses the variable ‘DYLD_LIBRARY_PATH’ . After switching off the FreeSurfer, all the 3 environment variables don’t exist. However, I am still unable to launch ‘mrview’ after switching of the FreeSurfer:

dyld: Library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib
  Referenced from: /usr/local/mrtrix3/lib/libmrtrix.dylib
  Reason: Incompatible library version: libmrtrix.dylib requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
/usr/local/bin/mrview: line 7: 10458 Abort trap: 6           "${f}"/MRView.app/Contents/MacOS/mrview "$@"

Any idea?

OK, a quick search throws up this similar issue. This suggests your XZ library comes from homebrew, and the suggested solution is to run brew update and brew upgrade.

Alternatively, you could simply try removing that package from your homebrew install (though only if nothing else depends on it!), or removing homebrew altogether (but only if you don’t need it!).

To get to the bottom of this, it could help to look at the output from:

otool -l /usr/local/mrtrix3/bin/MRView.app/Contents/MacOS/mrview

mrview should be loading the liblzma library that comes bundled with macOS. The fact that it tries to load a version from homebrew, might be an indication that there is something unorthodox about your set up.

More generally, otool should show up only loading libraries that ship with macOS (i.e. from /usr/lib/ and /System/Library/Frameworks/) or libraries that are bundled with MRtrix (i.e. from @rpath/).

For reference, these are the libraries (and their locations!) that mrview should be loading:

@rpath/libmrtrix.dylib
/usr/lib/libz.1.dylib
/usr/lib/liblzma.5.dylib
@rpath/libQt5OpenGL.5.dylib
@rpath/libQt5Svg.5.dylib
@rpath/libQt5Widgets.5.dylib
@rpath/libQt5Gui.5.dylib
@rpath/libQt5Network.5.dylib
@rpath/libQt5Core.5.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
/System/Library/Frameworks/AGL.framework/Versions/A/AGL
/usr/lib/libc++.1.dylib
/usr/lib/libSystem.B.dylib

Thank you. I have tried ‘brew update’ and ‘brew upgrade’ but the error persisted. I also tried uninstalling the brew but didn’t work either.
I checked the loading libraries and found:

…
Load command 14
cmd LC_LOAD_DYLIB
cmdsize 56
name /usr/lib/liblzma.5.dylib (offset 24)
time stamp 2 Wed Dec 31 19:00:02 1969
current version 6.3.0
compatibility version 6.0.0
…

The mrtrix3 indeed loaded the liblzma.5.dylib from the correct location. It’s not clear why the error message showed something else.

Ok, then I think it is an outdated macos version. Which macos version are you running? I don’t think our binaries support anything below 10.13 (High Sierra)

Could you share the entire output of otool?

So:

otool -l /usr/local/mrtrix3/bin/MRView.app/Contents/MacOS/mrview > otool_report.txt

I see. My macos is indeed High Sierra (10.13.6). I will update the OS and try again.

High Sierra should work! We just have not been able to test it ourselves… Probably we have to change our binary release to also include liblzma… If you can hold off updating, I can repackage our binary release with liblzma included.

On High Sierra, could you please try:

  1. Download https://drive.google.com/uc?export=download&id=1QZvjErNF66_B8mO4iCFqt6rzKy2LrAHP
  2. cd ~/Downloads (assuming that is where you downloaded the file to)
  3. sudo tar xvf mrtrix3-macos-3.0.2.tar.gz -C /usr/local

This should download a modified version of our binary package that does not depend on lzma.

In the meanwhile, we have updated the installer to fix the issue, you should be able to re-install by pasting this in the Terminal:

sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/MRtrix3/macos-installer/master/install)"

Can you confirm that this resolves your issue?

Yes! The MRView pops up now. Thank you so much for the efforts!!

1 Like