Hello,
I hope I didn’t miss a documentation page or a message in this board in starting this thread.
I’m trying to install a fixed version of AFNI in a container (apptainer), so that no matter when and where I run my analysis, it doesn’t change. The apptainer contains other software too, and it’s based on ubuntu 20.04.
I tried to use neurodocker, but I encountered a couple of issues and limitations that made it not the best option for me (although I’m thinking about contributing to it once I solve my current issues). Equally, basing my container on AFNI’s dockerimage is not an option.
At first, I tried to install AFNI through the binaries, but I’m missing how to install a precise version using @update.afni.binaries, so I decided to go for the (painful) way of cloning from source.
Premise: I’m not so familiar with building from source, my experience comes mainly from building ANTs over and over.
I created the symlinks for libgsl, libXmu, and libXp.
I git cloned the repository on Github, copied the
Makefile.linux_ubuntu_16_64 file
as
Makefile
(to use it, if I understood correctly), set CC and CXX, and run
cmake
make
make install
That worked well, but then I realised most of the programs I needed (mainly, those based in R like 3dICC and 3dLMER) where missing. I’m also not sure I installed SUMA, as calling SUMA_paperplane I get:
SUMA_paperplane: error while loading shared libraries: libSUMA.so: cannot open shared object file: No such file or directory
On top of that, cmake states:
Comparison with build using the make system: programs not built: 'model_conv_PRF_6_BAD;3dBallMatch;3dCompareAffine;3dDiff;3dEdu_01_scale;3dmaxdisp;cifti_tool;cjpeg;djpeg;imcat;SurfLocalstat'
I then tried to follow the instructions in github, but (probably obviously, but not to me) running
cmake
make vastness
didn’t work. Instead, I copied again Makefile.linux_ubuntu_16_64 as Makefile, and used
make vastness
. This resulted in a bunch of errors like:
gcc: error: backspace.o: No such file or directory
and:
make[1]: *** [Makefile:39: libf2c.so] Error 1
make[1]: Leaving directory '/tmp/general_preproc_build_2023-01-05_12-39-30/source2/src/f2c'
/bin/mv: cannot stat 'libf2c.so': No such file or directory
make: *** [Makefile.INCLUDE:3073: libf2c.so] Error 1
I tried again what neurodocker does:
cp Makefile.linux_openmp_64 Makefile
perl -p -i -e 's/^LGIFTI.*/LGIFTI = -lexpat/' Makefile
perl -p -i -e 's/^USE_LOCAL_X_TREE/#USE_LOCAL_X_TREE/' Makefile
perl -p -i -e 's/XLIBS = \$\(XROOT\)\/lib64\/libXm.a -lXt/XLIBS = \$\(XROOT\)\/lib64\/libXm.a \$\(XROOT\)\/lib\/x86_64-linux-gnu\/libXm.a -lXt/' Makefile
perl -p -i -e 's/^# XLIBS =/XLIBS =/' Makefile
perl -p -i -e 's/^CCOLD.*/CCOLD = \$\(CC\)/' Makefile
perl -p -i -e 's/(^LFLAGS.*)/$1 -L\/usr\/lib\/x86_64-linux-gnu/' Makefile
perl -p -i -e 's/(^PLFLAGS.*)/$1 -L\/usr\/lib -L\/usr\/lib\/x86_64-linux-gnu/' Makefile
perl -p -i -e 's/-lXpm -lXext/-lXpm -lfontconfig -lXext/' Makefile
perl -p -i -e 's/(^SUMA_INCLUDE_PATH.*)/$1 -I\/usr\/lib\/x86_64-linux-gnu\/glib-2.0\/include/' Makefile
make INSTALLDIR="/opt/afni-latest" vastness
This gave me the following error (which was the reason I didn’t use neurodocker):
SUMA_Makefile:33: *** Recursive variable 'CC' references itself (eventually). Stop.
make[1]: Leaving directory '/tmp/general_preproc_build_2023-01-05_12-39-30/source2/src/SUMA'
/bin/cp: cannot stat 'SUMA/libgts.a': No such file or directory
/bin/cp: cannot stat 'SUMA/libgts.a': No such file or directory
make: *** [Makefile.INCLUDE:3833: libgts.a] Error 1
Finally, I tried one last time declaring the R path (if I’m not mistaken) in cmake, doing:
ln -s /usr/lib/x86_64-linux-gnu/libgsl.so.23 /usr/lib/x86_64-linux-gnu/libgsl.so.19
ln -s /usr/lib/x86_64-linux-gnu/libXmu.so.6 /usr/lib/x86_64-linux-gnu/libXmu.so
ln -s /usr/lib/x86_64-linux-gnu/libXp.so.6 /usr/lib/x86_64-linux-gnu/libXp.so
git clone https://github.com/afni/afni.git source
cd source || exit 1
git fetch --tags
git -c advice.detachedHead=false checkout AFNI_22.3.07
cp src/Makefile.linux_ubuntu_16_64 src/Makefile
export CC=$( which gcc )
export CXX=$( which g++ )
cmake -DCMAKE_INSTALL_RPATH='/usr/lib' .
make -j20
make install
I’m still missing 3dICC, 3dLMEr, and rPkgsinstall.
At this point, I’m a bit lost. What am I missing? Why I am not compiling the programs related to R?
I’m sorry if I’m not clear enough in reporting the steps, but I’m happy to write more and attach files, if needed.
Cheers,
Stefano