3

I am creating a custom Builder Image using S2i dotnet core. This will run in OpenShift linux container

I have modified the custom builder image and included few lines to copy few dlls and ".so" files

When running the container in OpenShift I am facing the below error

error says

"unable to load shared library 'CustomCppWrapper' or one of its dependencies. In order to help diagnose loading problems, 
consider setting the LD_DEBUG environment variable: libWrapperName: cannot open shared object file: No such file or directory"

I have set the LD_DEBUG environment variable and found below few errors

/lib64/libstdc++.so.6: error: version lookup error: version `CXXABI_1.3.8' not found (required by /opt/app-root/app/libCWrappeNamer.so) (fatal)
/lib64/libstdc++.so.6: error: version lookup error: version `CXXABI_1.3.8' not found (required by ./libCWrappeNamer.so) (fatal)

I did below command and found below

ldd libCWrappeNamer.so

./libCWrappeNamer.so: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./libCWrappeNamer.so)
./libCWrappeNamer.so: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /ab/sdk/customlib/gcc540/lib/libabc.so)
./libCWrappeNamer.so: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /ab/sdk/customlib/gcc540/lib/libxmlc.so)

Below is my Custom Docker file builder image

FROM dotnet/dotnet-31-runtime-rhel7
# This image provides a .NET Core 3.1 environment you can use to run your .NET
# applications.

ENV PATH=/opt/app-root/src/.local/bin:/opt/app-root/src/bin:/opt/app-root/node_modules/.bin:${PATH} \
    STI_SCRIPTS_PATH=/usr/libexec/s2i

LABEL io.k8s.description="Platform for building and running .NET Core 3.1 applications" \
      io.openshift.tags="builder,.net,dotnet,dotnetcore,rh-dotnet31"

# Labels consumed by Red Hat build service
LABEL name="dotnet/dotnet-31-rhel7" \
      com.redhat.component="rh-dotnet31-container" \
      version="3.1" \
      release="1" \
      architecture="x86_64"

#-------------------------- COPY CPP LIBS

COPY CustomCppWrapper.lib /opt/app-root/app
COPY libCWrappeNamer.so /opt/app-root/app


#----------------------------------


# Labels consumed by Eclipse JBoss OpenShift plugin
LABEL com.redhat.dev-mode="DEV_MODE:false" \
      com.redhat.deployments-dir="/opt/app-root/src"

# Switch to root for package installs
USER 0

# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH.
COPY ./s2i/bin/ /usr/libexec/s2i

RUN INSTALL_PKGS="rh-nodejs10-npm rh-nodejs10-nodejs-nodemon rh-dotnet31-dotnet-sdk-3.1 rsync" && \
    yum install -y --setopt=tsflags=nodocs --disablerepo=\* \
      --enablerepo=rhel-7-server-rpms,rhel-server-rhscl-7-rpms,rhel-7-server-dotnet-rpms \
      $INSTALL_PKGS && \
    rpm -V $INSTALL_PKGS && \
    yum clean all -y && \
# yum cache files may still exist (and quite large in size)
    rm -rf /var/cache/yum/*

# Directory with the sources is set as the working directory.
RUN mkdir /opt/app-root/src
WORKDIR /opt/app-root/src

# Trigger first time actions.
RUN scl enable rh-dotnet31 'dotnet help'

# Build the container tool.
RUN /usr/libexec/s2i/container-tool build-tool

# Since $HOME is set to /opt/app-root, the yum install may have created config
# directories (such as ~/.pki/nssdb) there. These will be owned by root and can
# cause actions that work on all of /opt/app-root to fail. So we need to fix
# the permissions on those too.
RUN chown -R 1001:0 /opt/app-root && fix-permissions /opt/app-root

ENV ENABLED_COLLECTIONS="$ENABLED_COLLECTIONS rh-nodejs10" \
# Needed for the `dotnet watch` to detect changes in a container.
    DOTNET_USE_POLLING_FILE_WATCHER=true

# Run container by default as user with id 1001 (default)
USER 1001

# Set the default CMD to print the usage of the language image.
CMD /usr/libexec/s2i/usage
user804401
  • 1,990
  • 9
  • 38
  • 71

1 Answers1

1

Your code depends on libstdc++.so.6 but it would seem that version isn't installed

In your Dockerfile, add the yum install command that should do it. It would depend on what operating system you're using, but for RHEL 7, for example, you could do:

RUN yum install -y libstdc++

With more details of the operating system I can give a more specific command

In this specific examples the Dockerfile could look something like this:

FROM centos:7

RUN yum install -y libstdc++

CMD ["/bin/bash"]