bene51 / omero_3Dscript

OMERO.web app to animate multi-dimensional microscopy using 3Dscript, directly from within the OMERO environment.
GNU General Public License v3.0
4 stars 0 forks source link

Use Docker to build the server #4

Open glyg opened 2 years ago

glyg commented 2 years ago

Hi!

I'm trying to build a docker image from the omero-web-standalone image (based on CentOS7) with omero-3Dscript installed. I managed to install the tool and open the 3D-script page, but got stuck with the following error:

/usr/local/share/Fiji.app/lib/linux64/libOpenCLRaycaster.so: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/share/Fiji.app/lib/linux64/libOpenCLRaycaster.so)
java.lang.UnsatisfiedLinkError: /usr/local/share/Fiji.app/lib/linux64/libOpenCLRaycaster.so: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/share/Fiji.app/lib/linux64/libOpenCLRaycaster.so)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at animation3d.renderer3d.OpenCLRaycaster.<clinit>(OpenCLRaycaster

I tried to get around that by installing a newer gcc (as advised on the internet), but I don't know how to point to the new libstdc++.so -- the "just to a symlink" strategy failed. I'm not familiar with Java nor CentOS so I'm a bit lost here.

Bellow is the content of the DockerFile:

# https://github.com/ome/omero-web-docker/blob/master/Dockerfile
FROM openmicroscopy/omero-web-standalone:5

USER root
RUN yum install -y \
    ffmpeg \
    wget \
    unzip \
    ocl-icd \
    opencl-headers \
    scl-utils \
    scl-utils-build \
    centos-release-scl

RUN yum install -y \
    devtoolset-8-gcc \
    devtoolset-8-gcc-c++

RUN scl enable devtoolset-8 -- bash
RUN ln -s /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so /usr/lib64/libstdc++.so

ENV FIJI_HOME=/usr/local/share/Fiji.app
RUN mkdir $FIJI_HOME
WORKDIR /usr/local/share/
RUN wget https://downloads.imagej.net/fiji/latest/fiji-linux64.zip
RUN unzip fiji-linux64.zip
WORKDIR $FIJI_HOME
RUN ./ImageJ-linux64 --update add-update-site 3Dscript "https://romulus.oice.uni-erlangen.de/updatesite/"
RUN ./ImageJ-linux64 --update add-update-site 3Dscript-server "https://romulus.oice.uni-erlangen.de/imagej/updatesites/3Dscript-server/"
RUN ./ImageJ-linux64 --update update

RUN /opt/omero/web/venv3/bin/python -m pip install omero-3Dscript
USER omero-web
ADD omero-web-apps.omero /opt/omero/web/config/

It is invoked with:

docker run --name omero-web-3dscript -e OMEROHOST=omero.example.com -p 4080:4080 omeroweb-3dscript

I'd be happy to share the dockerfile (and even the built image) once it's running.

Thanks for any hint!

Guillaume

bene51 commented 2 years ago

Dear Guillaume,

there are actually two issues here, as far as I understand. Let me start with your actual question, but before you spend too much time with it, you might want to scroll down for the 2nd issue.

According to https://stackoverflow.com/questions/46172600/rhel7-usr-lib64-libstdc-so-6-version-cxxabi-1-3-8-not-found the devtoolset-x packages on CentOS don't really solve the problem, and you need a completely new version of gcc (it's not entirely clear to me, to be honest, I really just followed the suggestions there). You could modify your Dockerfile accordingly:

RUN yum install -y \
    gmp-devel \
    mpfr-devel \
    libmpc-devel

RUN mkdir /gcc && \
    cd /gcc && \
    wget https://ftp.mpi-inf.mpg.de/mirrors/gnu/mirror/gcc.gnu.org/pub/gcc/snapshots/8.5.0-RC-20210507/gcc-8.5.0-RC-20210507.tar.gz && \
    tar -zxf gcc-8.5.0-RC-20210507.tar.gz && \
    cd gcc-8.5.0-RC-20210507 && \
    ./configure --disable-multilib --enable-languages=c,c++ --prefix=/opt/gcc8 && \
    make -j5 && \
    make -j install

ENV LD_LIBRARY_PATH=/opt/gcc8/lib64/

I haven't tested this fully, but I compiled gcc inside the container and executing ldd libOpenCLRaycaster.so shows that it would indeed use the right libstdc++.so library.

If you plan to give this a try, be prepared that compiling gcc took some time for me.

However, there is another issue, which in my eyes is much worse:

Do you have GPU access from within your container environment?

You can easily test this by running clinfo (you might need to yum install clinfo). In my test case, it showed 0 available platforms...

I did some research about this some time ago, and unfortunately, I don't have any references at hand, but there seems to be no general solution for having GPU access from within your container. It depends which graphics hardware you are using, Intel, AMD or NVIDIA.

So it seems to be not so trivial to provide a Dockerfile or Docker image which will make 3Dscript available, sadly...

However, if you find some contrary information, I'm happy to learn ;)

Best wishes,

Bene

glyg commented 2 years ago

Hi Bene, thanks a lot for the detailed answer,

I wish I could avoid to re-compile gcc in the container, but it looks like I'll have to! As for OpenCL, I installed the docker nvidia runtime on the host, hopefully it will do the trick! I'd like to be able to access GPUs from a container anyhow so it's time well spent :)

I'll report here after further investigation.

Thanks again!

Guillaume