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:
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…