Freesurfer - 3dvolreg.afni: error while loading shared libraries: libXp.so.6

Hello!

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 have seen on freesurfer forum that someone had this problem some years ago. However, trying to follow that solution didn’t solve mine (https://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg41791.html).

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?

Thanks in advance

Best,

Camila

Not currently running Ubuntu 18.04, but in the past you were able to install the dependencies with
sudo apt-get install -y libxp6

You shouldn’t have any issues if you replace the binary with the AFNI official one built for Ubuntu 16+.

You can also try the general AFNI install instructions.

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.

1 Like

Howdy-

On Ubuntu 18.04, I believe it is the “libxpm4” package that contains that file.

So, running:

sudo apt-get update
sudo apt-get install libxpm4

(which is part of the AFNI setup instructions for Ubuntu 18.04 Pete pointed to, above) should do the trick.

–pt

2 Likes

… and on a Mac, well, I’m not sure, but I’m guessing it is the “X11” part of the install, so when you do the Xquartz (or maybe Xcode) installation here:
AFNI installation on a Mac: install-xcode-and-xquartz

I don’t think I’ve seen that error on a Mac, but I guess that performing that part of the installation would help (if not be necessary).

–pt

2 Likes

Hi guys!

Thanks a lot for your help. The library installation still didn’t work on my version, but I will try, as suggested, a different version of Ubuntu.

best,
Camila

Hi-

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:

$ locate libXp
/snap/skype/107/usr/lib/x86_64-linux-gnu/libXpm.so.4
/snap/skype/107/usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0
/snap/skype/109/usr/lib/x86_64-linux-gnu/libXpm.so.4
/snap/skype/109/usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0
/usr/lib/x86_64-linux-gnu/libXpm.a
/usr/lib/x86_64-linux-gnu/libXpm.so
/usr/lib/x86_64-linux-gnu/libXpm.so.4
/usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0

… of which I think the latter 4 are probably the useful ones. What is the case on your system?

Also, did you try the full set of "apt-get"s for Ubuntu 18.04 on the AFNI install page:
AFNI apt-get list for Ubuntu
?

–pt

1 Like

Hey!!

Thanks for the message.

The errors I get are, for example:

(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.

Best,
Camila

Hi, Camila-

OK, but just to be sure, did you run this apt-get install? On Ubuntu 18.04, I believe this is the package that contains libXp:

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install libxpm4

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:

$ ls -l `locate libXp`
-rw-r--r-- 1 root root 126108 Dec 22  2016 /usr/lib/x86_64-linux-gnu/libXpm.a
lrwxrwxrwx 1 root root     16 Dec 22  2016 /usr/lib/x86_64-linux-gnu/libXpm.so -> libXpm.so.4.11.0
lrwxrwxrwx 1 root root     16 Sep 22 14:38 /usr/lib/x86_64-linux-gnu/libXpm.so.4 -> libXpm.so.4.11.0
-rw-r--r-- 1 root root  72520 Dec 22  2016 /usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0

(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).

–pt

2 Likes

Hey pt,

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.

Thank you very much for the help.
Best,
Camila

Hi Camila,

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…

  • rick
2 Likes

Hi Rick,

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.

Thanks a lot!

Hi Camila,

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

  1. 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.

  2. 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.

  3. 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:

https://afni.nimh.nih.gov/sscc/staff/rickr/pub/3dvolreg.2020.0131.xorg7_64.light

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:

 mv $FREESURFER_HOME/bin/3dvolreg.afni $FREESURFER_HOME/bin/3dvolreg.afni.orig
 cp 3dvolreg.2020.0131.xorg7_64.light $FREESURFER_HOME/bin/3dvolreg.afni

 3dvolreg.afni -help

What seems reasonable? Again, you probably do not need to do anything, now that libXp has been faked.

  • rick
1 Like

Hey Rick,

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,