I am currently analyzing retinotopic map data with freesurfer, and while I was trying to run “preproc-sess” function, I encountered the following error:
3dvolreg.afni: error while loading shared libraries: libXp.so.6:
cannot open shared object file: No such file or directory
ERROR: 3dvolreg.afni
I am currently using Ubuntu 18.04.3. I also tried on Mac Catalina, and at all times I had the same type of error. I also tried to extract this function directly from Afni and substitute in the Freesurfer respective folder, but it also didn’t work.
Has anyone here also had the same problem at some point? Or does anyone have any idea how I could solve that?
MacOS Catalina is still a bit of a pain to work with for much of the scientific software community due to “improvements” in GateKeeper and App Signing requirements, not to mention the kernel changes.
Hmm, that’s unfortunate. Just to doublecheck, are you getting the same error message about libXp.so.6? (And did you try restarting/logging out-and-back-in after those installs?)
My system is Ubuntu 18.04:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
… and if I search for libXp, I get the following results:
(when I run the preproc-sess form freesurfer)
3dvolreg.afni -verbose -dfile 001/fmcpr.mcdat -1Dmatrix_save 001/fmcpr.mat -base 001/tmp.mc-afni2.7063/tempvol.nii.gz -prefix 001/tmp.mc-afni2.7063/outvol.nii.gz 001/tmp.mc-afni2.7063/invol.nii.gz
3dvolreg.afni: error while loading shared libraries: libXp.so.6: cannot open shared object file: No such file or directory
ERROR: 3dvolreg.afni
Invalid null command.
(when I run only the function from afni)
$ 3dvolreg.afni
3dvolreg.afni: error while loading shared libraries: libXp.so.6: cannot open shared object file: No such file or directory
$ sudo apt-get install -y libxp6
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libxp6
(expected given the version, I guess)
And as you suggested:
$ locate libXp
/usr/lib/x86_64-linux-gnu/libXpm.so.4
/usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0
I tried that as well, but the error persists.
I was suspicious about my data too, but I guess I would have a different error.
We have similar library locations, but I actually noticed with a long listing that the “plain” libXpm.so file is actually just a link to my specific version:
(I edited my skype-based ones out of the output; those should be irrelevant for this)
I kind of wonder if that should be the same on your system? It would be possible to try making that link; but I would like to make sure first that doing the above apt-get installs doesn’t do that for you (or, even better, doing the full apt-get install list from the AFNI install page for Ubuntu 18.04, in case one of those does).
Yes, I had run apt-get install.
We found a work around here that I still don’t know if it is perfectly reliable. I’ve just made a copy of libXpm.so.4 and call it libXp.so.6. It ran perfectly. But as I said, I don’t know if it is really doing the same job. I am trying to run the analysis on a subject whose data a colleague analyzed before and I will check if I have the same results as his.
I’m glad it is working for you. Just be aware that libXpm (for pixmaps) is a completely different library from libXp (for printing). It is likely that any ELF formatted library would work for 3dvolreg, because those functions will never be called.
Just to provide a little background…
Our ubuntu 16 version of 3dvolreg does not link to libXp. The FreeSurfer one does because it links to openmotif from RedHat, and that requires libXp. That 3dvolreg version was built on an old system (14 years?), which was easy to use on most newer ones, but as you see, some of the libraries are no longer on every system.
Since FreeSurfer’s linux download is based on CentOS 6, maybe we can suggest a more appropriate version for them to distribute. Something we can ponder…
Thanks for the enlightment. It was really helpful.
This would be really nice, thanks. I’ve just started working with this, so my setup is new (Ubuntu 18 + newest version of free surfer) and I have encountered some of these problems of incompatibility with new versions.
For now, do you think that setting up another machine (or container) with this specific version of Linux would help? I am not sure about what I should do next to make the functions from freesurfer work.
While I would not suggest setting up another machine or container just for this 3dvolreg.afni problem, if there are many issues that are piling up, it might be worth considering. But this one program is simple enough to solve without giving yourself more work to do.
Your current solution of faking libXp should be sufficient to appease the version of 3dvolreg that FreeSurfer is distributing. The program should never attempt to access functions in that library, so it should not actually matter.
Alternatively, we could give you a version that would not have the current issues, if you prefer to overwrite 3dvolreg.afni from FS with something more suitable to Ubuntu 18. For that there might be 3 choices (none of which would require you to install libXp):
Use the Ubuntu 16 version of 3dvolreg that is currently distributed with AFNI. This might require some apt-get commands, but it should be simple.
Use a lighter-weight version of the above that I could build for you. This might also require apt-get, but it would presumably be fewer than the above, and it might be none at all.
Use a lighter-weight version that is based on the version FS is including.
For example, here is a link for case 3 that you could try:
If that file were downloaded (and you have write access to $FREESURFER_HOME), you could try backing up the current version, putting the new one in place, then testing it:
Thanks a lot for finding some time to provide me such a nice support.
I will get back to it this week, and see which option seems more reasonable. But so far all these instructions were super helpful.
Thanks once more
Best,