neurodocker icon indicating copy to clipboard operation
neurodocker copied to clipboard

AFNI build failing because R_io.so target fails

Open verdurin opened this issue 6 years ago • 1 comments

I am trying to build AFNI from source, master branch.

make[1]: Leaving directory '/opt/afni-master/src/ptaylor'
echo PKG_CPPFLAGS = -I.  -I/usr/include -Inifti/nifti2 -Inifti/niftilib -Inifti/nifticdf -Inifti/znzlib -I3DEdge/src -Irickr -DHAVE_ZLIB -DHAVE_GIFTI -If2c  > Makevars ;            \
echo PKG_LIBS =  -L. -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lmri -lf2c -lXm -lXt -lXft -lXp -lXpm -lfontconfig -lXext -lXmu -lSM -lICE -lX11  -lpng -ljpeg -lz -lexpat -lm  -ldl -lc  >> Makevars ;
( if which R >/dev/null ; then \
R CMD SHLIB -o R_io.so R_io.c ; \
else echo WARNING: Cannot build R_io.so because R is not installed;\
fi ; )
make[1]: Entering directory '/opt/afni-master/src'
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/include -Inifti/nifti2 -Inifti/niftilib -Inifti/nifticdf -Inifti/znzlib -I3DEdge/src -Irickr -DHAVE_ZLIB -DHAVE_GIFTI -If2c     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c R_io.c -o R_io.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o R_io.so R_io.o -L. -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lmri -lf2c -lXm -lXt -lXft -lXp -lXpm -lfontconfig -lXext -lXmu -lSM -lICE -lX11 -lpng -ljpeg -lz -lexpat -lm -ldl -lc -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lXp
/usr/bin/ld: cannot find -lXmu
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'R_io.so' failed
make[1]: *** [R_io.so] Error 1
make[1]: Leaving directory '/opt/afni-master/src'
Makefile.INCLUDE:3995: recipe for target 'R_io.so' failed
make: *** [R_io.so] Error 1
FATAL:   failed to execute %post proc: exit status 2
FATAL:   While performing build: while running engine: while running /usr/libexec/singularity/bin/starter: exit status 255

verdurin avatar Dec 18 '19 15:12 verdurin

I've been trying to install AFNI version 2011_12_21_1014 and had to make a few changes, including solving this issue. After a bit of trial and error, I ended up with this. I'm not sure why I had to do a second apt-get install to get those libraries to "stick" but it worked for building on Ubuntu 16. (Note: I made all the chained commands separate RUN calls to ease debugging.)

# Generated by: Neurodocker version 0.7.0
# Timestamp: 2021/03/30 18:36:31 UTC
# 
# Thank you for using Neurodocker. If you discover any issues
# or ways to improve this software, please submit an issue or
# pull request on our GitHub repository:
# 
#     https://github.com/ReproNim/neurodocker

FROM ubuntu:16.04

USER root

ARG DEBIAN_FRONTEND="noninteractive"

ENV LANG="en_US.UTF-8" \
    LC_ALL="en_US.UTF-8" \
    ND_ENTRYPOINT="/neurodocker/startup.sh"
RUN export ND_ENTRYPOINT="/neurodocker/startup.sh"
RUN apt-get update -qq
RUN apt-get install -y -q --no-install-recommends \
           apt-utils \
           bzip2 \
           ca-certificates \
           curl \
           locales \
           unzip
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
RUN dpkg-reconfigure --frontend=noninteractive locales
RUN update-locale LANG="en_US.UTF-8"
RUN chmod 777 /opt && chmod a+s /opt
RUN mkdir -p /neurodocker
RUN if [ ! -f "$ND_ENTRYPOINT" ]; then \
         echo '#!/usr/bin/env bash' >> "$ND_ENTRYPOINT" \
         && echo 'set -e' >> "$ND_ENTRYPOINT" \
         && echo 'export USER="${USER:=`whoami`}"' >> "$ND_ENTRYPOINT" \
         && echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT"; \
    fi
RUN chmod -R 777 /neurodocker && chmod a+s /neurodocker

ENTRYPOINT ["/neurodocker/startup.sh"]

ENV PATH="/opt/afni-2011_12_21_1014:$PATH" \
    AFNI_PLUGINPATH="/opt/afni-2011_12_21_1014"
RUN apt-get update -qq
RUN apt-get install -y -q --no-install-recommends \
           curl \
           ed \
           g++ \
           gcc \
           git \
           libglib2.0-dev \
           libglu1-mesa-dev \
           libgsl-dev \
           libmotif-dev \
           libnetpbm10-dev \
           libnlopt-dev \
           libxext-dev \
           libxi-dev \
           libxmu-headers \
           libxpm-dev \
           libxt-dev \
           m4 \
           make \
           mesa-common-dev \
           python \
           r-base \
           r-base-dev \
           tcsh \
           zlib1g-dev
RUN curl -sSL --retry 5 -o /tmp/toinstall.deb http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb
RUN dpkg -i /tmp/toinstall.deb
RUN rm /tmp/toinstall.deb
RUN curl -sSL --retry 5 -o /tmp/toinstall.deb http://snapshot.debian.org/archive/debian-security/20160113T213056Z/pool/updates/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb
RUN dpkg -i /tmp/toinstall.deb
RUN rm /tmp/toinstall.deb
RUN apt-get install -f -y
RUN apt-get install -y -q --no-install-recommends \
          libxmu-dev \                                                            # <--- provides the Xmu.h in Ubuntu 16
          r-cran-rcpp \                                                           # <--- provides the Xp.h
          libglw1-mesa-dev                                                  # <--- provides GL/GLwDrawA.h for SUMA
RUN git clone https://github.com/afni/afni.git /opt/afni-2011_12_21_1014
WORKDIR /opt/afni-2011_12_21_1014
RUN git checkout dab76581b2ddef36dd4d5974f122e9759732c5c5  # <--- the git treeish for version 2011_12_21_1014 🙄 
WORKDIR /opt/afni-2011_12_21_1014/src
RUN cp Makefile.linux_ubuntu_16_64 Makefile              # <--- neurodebian _insists_ on using the wrong Makefile for Ubuntu         
RUN make INSTALLDIR="/opt/afni-2011_12_21_1014" vastness
RUN /opt/afni-2011_12_21_1014/rPkgsInstall -pkgs ALL

# Finally, clean up
RUN apt-get clean                                                          # <--- remove these lines from above because they will force you 
RUN rm -rf /var/lib/apt/lists/*                                         #         to run `apt-get update` before EVERY `apt-get install`

WORKDIR /opt/afni-2011_12_21_1014

USER root

RUN echo '{ \
    \n  "pkg_manager": "apt", \
    \n  "instructions": [ \
    \n    [ \
    \n      "base", \
    \n      "ubuntu:16.04" \
    \n    ], \
    \n    [ \
    \n      "afni", \
    \n      { \
    \n        "version": "latest", \
    \n        "method": "source", \
    \n        "install_r": "true", \
    \n        "install_r_pkgs": "true", \
    \n        "install_python2": "true", \
    \n        "install_path": "/opt/afni-2011_12_21_1014" \
    \n      } \
    \n    ], \
    \n    [ \
    \n      "workdir", \
    \n      "/opt/afni_2011_12_21_1014" \
    \n    ], \
    \n    [ \
    \n      "user", \
    \n      "root" \
    \n    ] \
    \n  ] \
    \n}' > /neurodocker/neurodocker_specs.json

dmwelch avatar Mar 30 '21 20:03 dmwelch

since this is a very old issue, I will close it now, but please reopen if this is still an issue

djarecka avatar Feb 17 '23 19:02 djarecka