freesurfer / freesurfer

Neuroimaging analysis and visualization suite
Other
582 stars 243 forks source link

FreeView failure on rocky 8.7 #1082

Closed nadyawilliams closed 1 year ago

nadyawilliams commented 1 year ago

Installed freesurfer 7.3.2 from tar distro for CentOS8: freesurfer-linux-centos8_x86_64-7.3.2.tar.gz This distro has and empty lib/qt/ subdirectories. Download RPM distro freesurfer-CentOS8-7.3.2-1.x86_64.rpm and extract and install missing lib/qt (i cant install 3rd party RPM directly as it does not conform to our install rules).

Linked matlab MCR from R2021b: MCRv84 -> /data/opt/apps/MATLAB/R2021b at the top level of the install directory. Running freeview results in the following error:

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb. Aborted (core dumped)

I have tried to link to MCR R2014b that was previously used for freesurfer 7.1.1, and I am getting the same failure. The fs_install_mcr script seem to be an outdated version as it is checking for much older matlab MCR (newest 2019).

If i remove the MCR link, under all the same conditions and even the same sessions freeview starts and opens the GUI window.

Can you please suggest a fix for this? What needs to be done in order to use both MCR for a few free surfer modules and the ability to run freeview?

buildqa commented 1 year ago

If in fact the CentOS8 installer is the correct one for your system, https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-CentOS8-7.3.2-1.x86_64.rpm,

A better resource for this info is the freesurfer mail list and mail archive. We have not run into any issues with the .rpm installer or running the matlab script on CentOS8 systems, but we have not tested on rocky 8.7

buildqa commented 1 year ago

Sorry there should not be a ./ in front of fs_install_mcr, or it should be $ sudo FREESURFER_HOME=$FREESURFER_HOME fs_install_mcr R2019b

nadyawilliams commented 1 year ago

Rocky 8.7 is based on CentOS, however we are not installing any 3rd party RPMs from unknown builds. Only verified repos' RPMS can make it to the system or only those we build ourselves. Installing from RPM i dont think will do any difference anyway. The issue seem to be in incompatibility of some libraries that are in MCR, more specifically, somewhere in MCRv97/runtime/glnxa64 or MCRv97/bin/glnxa64. If these two paths are removed from the environment settings (were added to LD_LIBRARY_PATH) then freeviewer is working. Cant say anything about using MCR itself, the user have not tried using binaries without these two paths being added. According to the freesurfer docs one can use mCR from installed matlab via a link and this is exactly what i have done.

buildqa commented 1 year ago

If you look on the freesurfer help list and/or mail archives you will see postings about how users pre-setting LD_LIBRARY_PATH in their shell environments prevented binaries like freeview from finding the 3rd party libs included in the freesurfer distribution. For example, if you have a path in LD_LIBRARY_PATH that leads to Qt libraries in another software distribution, then freeview might find the wrong Qt libraries. We discourage people from using LD_LIBRARY_PATH, and we do not set it in users shell init files. Unfortunately however, to pull in the Matlab libraries I believe The Mathworks documentation says to set LD_LIBRARY_PATH. So after using the fs_install-mcr script to install the smaller matlab R2019b runtime environment (which is on purpose not a full Matlab release) , I think it should work to, $ export PATH=$PATH:$FREESURFER_HOME/MCRv97/bin $ export LD_LIBRARY_PATH=$FREESURFER_HOME/MCRv97/runtime/glnxa64:$FREESURFER_HOME/MCRv97/bin/glnxa64

But if you append other paths to LD_LIBRARY_PATH then we cannot guarantee things will work correctly. We do not officially support setting up or linking to Matlab distributions other than what can be setup by fs_install-mcr using the above settings.

nadyawilliams commented 1 year ago

We do not arbitrarily set environment variables. In fact, our modules carefully "follow" age freesurfer environment variables that are set via *Env.sh file.s We do use modules as they allow us to easily set and unset environments for many applications. As far as LD_LIBRARY_PATH goes, it is exactly as i reported in the beginning of this thread: If i add the following in a module to the LD_LIBRARY_PATH $FREESURFER_HOME/lib $FREESURFER_HOME/MCRv97/runtime/glnxa64 $FREESURFER_HOME/MCRv97/bin/glnxa64 i get and error: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland- xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Removing paths with MCR from LD_LIBRARY_PATH allows freeview to succeed. No other paths are in LD_LIBRARY_PATH. So there seem to be some issue between what is in MCRv*/bin/glnxa64 and what freeview needs.

buildqa commented 1 year ago

I don't see the release 7 freesurfer environment setup scripts SetUpFreeSurfer.{.sh,.csh} set LD_LIBRARY_PATH. If you need the entry $FREESURFER_HOME/lib in LD_LIBRARY_PATH to make things work - w/o using Matlab or adding Matlab paths to LD_LIBRARY_PATH - then something may already amiss in your environment (interfering with RPATH). I see no error running freeview on a CentOS8 system after a standard install of the .rpm, setting FREESURFER_HOME to the install path, and running the SetUpFreeSurfer script for the current shell. If you have not done so already, I would test that setup (w/o LD_LIBRARY_PATH set in the shell) on your system since that is the baseline.

nadyawilliams commented 1 year ago

The LD_LIBRARY_PATH with $FREESURFER_HOME/lib is "inherited" from a module that was created for fs 7.1.x I can easily remove this from LD_LIBRARY_PATH. Yet the addition of MCRv*/bin/glnxa64 to otherwise the same environment as one gets with sourcing SetUpFreeSurfer.sh creates an error with freeview. I am going to remove all 3 instances of libs settings from LD_LIBRARY_PATH. If this fails for running some other binaries for segmentation and fsfast tools with this setup then will create a separate module for freesurfer with those paths enabled. I see some scripts for these tools are setting LD_LIBRARTY_PATH others dont, and i dont have any specific knowledge about how to differentiate them. Perhaps having 2 separate modules will be the only answer. Thank you for your comments.

buildqa commented 1 year ago

There is now a development build for rocky8 linux which you can get from, https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/dev/

buildqa commented 1 year ago

Correction... I should have said that after you run the install script for matlab, e.g., "fs_install_mcr R2019b", the script will tell you what needs to be added to LD_LIBRARY_PATH in order to pick up the matlab libraries. However, we do not put that into the freesurfer environment via freesurfer's own setups scripts since matlab is not required. We leave it up to the user to decide how they want to setup those LD_LIBRARY_PATH settings, e.g., add to their shell init file. I have tried that with the rock8 distribution listed above and the matlab installation works as expected.

buildqa commented 1 year ago

You can post to the mail list, freesurfer@nmr.mgh.harvard.edu, if there is still an issue with matlab additions to LD_LIBRARY_PATH

nadyawilliams commented 1 year ago

Thank you for your comments. I will have to get back to this a bit later as other issues are taking the precedence.