Compilation problem

Dear experts,

I have a problem compiling the latest MRtrix checkout from git due to zlib issues.
At the linkerstep of (433), I get the error regarding linking against non-shared libraries, suggesting I should recompile with the fPIC option.

It links to /usr/local/lib/libz.a and mentions the R_X86_64_32S symbol cannot be used making a shared object. I have multiple libz libraries (e.g. with fsl) on my system,
but how can I point the linker to use this libz instance?

(I have also tried to run configure with the -static option, yet this doesn’t work due to a Qt error)

This is a multicore server running ubuntu 20.04 (release versions of are running without problems). However, I would like to use some new features only available in the recent devekopment version.

Many thanks,


HI @jbcmarsman,

This may come too late to be of any use to you, but just in case:

If you have manually set your PATH to include $FSLDIR/bin, this will cause all kinds of issues – see e.g. this post for some details into the issue. You can check by typing:

echo $PATH

Basically, the FSL team recommends your FSL setup should be done by setting $FSLDIR and invoking the $FSLDIR/etc/fslconf/ script – which will take care of setting up the PATH appropriately. You may find all it takes for MRtrix to compile properly is to rectify this…

All the best,