google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.46k stars 5.15k forks source link

//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line #3132

Closed tom-doerr closed 2 years ago

tom-doerr commented 2 years ago

System information (Please provide as much relevant information as possible) Docker environment, base image: FROM nvidia/cuda:10.1-cudnn8-devel-ubuntu18.04.

Describe the problem: I'm trying to build the mediapipe Python package with tensorflow support, but the build (RUN python3 setup.py install --link-opencv) is failing.

Provide the exact sequence of commands / steps that you executed before running into the problem:

# Copyright 2019 The MediaPipe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#FROM ubuntu:18.04
#FROM nvidia/cudagl:10.1-base

FROM nvidia/cuda:10.1-cudnn8-devel-ubuntu18.04
#FROM tensorflow/serving:2.8.0-devel-gpu
#FROM tensorflow/tensorflow:latest-devel-gpu
#FROM tensorflow/tensorflow:1.14.0-gpu-py3
#FROM tensorflow/tensorflow:2.0.0-gpu-py3
#FROM tensorflow/serving:2.0.0-devel-gpu
#FROM tensorflow/serving:2.8.0-devel-gpu

MAINTAINER <mediapipe@google.com>

WORKDIR /io
WORKDIR /mediapipe

ENV DEBIAN_FRONTEND=noninteractive

#RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y \
        build-essential \
        gcc-8 g++-8 \
        ca-certificates \
        curl \
        ffmpeg \
        git \
        wget \
        unzip \
        python3-dev \
        python3-opencv \
        python3-pip \
        libopencv-core-dev \
        libopencv-highgui-dev \
        libopencv-imgproc-dev \
        libopencv-video-dev \
        libopencv-calib3d-dev \
        libopencv-features2d-dev \
        software-properties-common && \
    add-apt-repository -y ppa:openjdk-r/ppa && \
    apt-get update && apt-get install -y openjdk-8-jdk && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

#RUN apt-get remove  python3-apt && apt-get install python3-apt

RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-8
RUN pip3 install --upgrade setuptools
RUN pip3 install wheel
RUN pip3 install future
RUN pip3 install six==1.14.0
RUN pip3 install tensorflow==1.14.0
RUN pip3 install tf_slim

RUN ln -s /usr/bin/python3 /usr/bin/python

# Install bazel
ARG BAZEL_VERSION=4.2.1
RUN mkdir /bazel && \
    wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\
azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
    wget --no-check-certificate -O  /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \
    chmod +x /bazel/installer.sh && \
    /bazel/installer.sh  && \
    rm -f /bazel/installer.sh

# install OpenGL
RUN apt-get update && apt-get install -y mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev
RUN apt-get update && apt-get install -y mesa-utils

RUN apt-get update && apt-get install -y protobuf-compiler python3-dev
RUN apt-get update && apt-get install -y libprotobuf-dev
RUN pip3 install scikit-build
#RUN pip3 install skbuild

RUN apt-get update && apt-get install -y cmake 

# install libm
RUN apt-get update && apt-get install -y libmms0 libmms-dev

RUN apt-get update && apt-get install -y libc6

RUN pip3 install --upgrade setuptools pip
RUN pip3 install opencv-python

#COPY mediapipe /mediapipe/
#COPY mediapipe_opengl /mediapipe/
COPY mediapipe_tensorflow /mediapipe/

RUN pip3 install -r requirements.txt

ENV CFLAGS=" -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -funroll-all-loops";

RUN python3 setup.py gen_protos
RUN python3 setup.py install --link-opencv

Complete Logs:

Traceback:

ERROR: /mediapipe/mediapipe/framework/tool/BUILD:107:10: Linking mediapipe/framework/tool/encode_as_c_string [for host] failed: (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc @bazel-out/host/bin/mediapipe/framework/tool/encode_as_c_string-2.params
/usr/bin/ld: bazel-out/host/bin/external/com_google_absl/absl/strings/libstrings.a(charconv.o): undefined reference to symbol 'nan@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Target //mediapipe/modules/face_detection:face_detection_short_range_cpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 115.310s, Critical Path: 30.59s
INFO: 1033 processes: 369 internal, 664 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
/usr/local/lib/python3.6/dist-packages/setuptools/dist.py:511: UserWarning: The version specified ('dev') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % version
/usr/local/lib/python3.6/dist-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
generating binarypb: mediapipe/modules/face_detection/face_detection_short_range_cpu
The command '/bin/sh -c python3 setup.py install' returned a non-zero code: 255
sureshdagooglecom commented 2 years ago

Hi @tom-doerr , can you provide steps to reproduce this issue?

tom-doerr commented 2 years ago
  1. Save the content of the dockerfile into a file called Dockerfile Dockerfile:
    
    # Copyright 2019 The MediaPipe Authors.
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #      http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.

FROM ubuntu:18.04

FROM nvidia/cudagl:10.1-base

FROM nvidia/cuda:10.1-cudnn8-devel-ubuntu18.04

FROM tensorflow/serving:2.8.0-devel-gpu

FROM tensorflow/tensorflow:latest-devel-gpu

FROM tensorflow/tensorflow:1.14.0-gpu-py3

FROM tensorflow/tensorflow:2.0.0-gpu-py3

FROM tensorflow/serving:2.0.0-devel-gpu

FROM tensorflow/serving:2.8.0-devel-gpu

MAINTAINER mediapipe@google.com

WORKDIR /io WORKDIR /mediapipe

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \

RUN apt-get update && apt-get install -y \ build-essential \ gcc-8 g++-8 \ ca-certificates \ curl \ ffmpeg \ git \ wget \ unzip \ python3-dev \ python3-opencv \ python3-pip \ libopencv-core-dev \ libopencv-highgui-dev \ libopencv-imgproc-dev \ libopencv-video-dev \ libopencv-calib3d-dev \ libopencv-features2d-dev \ software-properties-common && \ add-apt-repository -y ppa:openjdk-r/ppa && \ apt-get update && apt-get install -y openjdk-8-jdk && \ apt-get clean && \ rm -rf /var/lib/apt/lists/*

RUN apt-get remove python3-apt && apt-get install python3-apt

RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-8 RUN pip3 install --upgrade setuptools RUN pip3 install wheel RUN pip3 install future RUN pip3 install six==1.14.0 RUN pip3 install tensorflow==1.14.0 RUN pip3 install tf_slim

RUN ln -s /usr/bin/python3 /usr/bin/python

Install bazel

ARG BAZEL_VERSION=4.2.1 RUN mkdir /bazel && \ wget --no-check-certificate -O /bazel/installer.sh "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/b\ azel-${BAZEL_VERSION}-installer-linux-x86_64.sh" && \ wget --no-check-certificate -O /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ chmod +x /bazel/installer.sh && \ /bazel/installer.sh && \ rm -f /bazel/installer.sh

install OpenGL

RUN apt-get update && apt-get install -y mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev RUN apt-get update && apt-get install -y mesa-utils

RUN apt-get update && apt-get install -y protobuf-compiler python3-dev RUN apt-get update && apt-get install -y libprotobuf-dev RUN pip3 install scikit-build

RUN pip3 install skbuild

RUN apt-get update && apt-get install -y cmake

install libm

RUN apt-get update && apt-get install -y libmms0 libmms-dev

RUN apt-get update && apt-get install -y libc6

RUN pip3 install --upgrade setuptools pip RUN pip3 install opencv-python

COPY mediapipe /mediapipe/

COPY mediapipe_opengl /mediapipe/

COPY mediapipe_tensorflow /mediapipe/

RUN pip3 install -r requirements.txt

ENV CFLAGS=" -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -funroll-all-loops";

RUN python3 setup.py gen_protos RUN python3 setup.py install --link-opencv


2.  Build it using the command 

docker build . -t mediapipe_image ```

sureshdagooglecom commented 2 years ago

Did you get a chance to check this closed issue https://github.com/google/mediapipe/issues/1400

tom-doerr commented 2 years ago

I saw in other issues that OpenGL currently isn't working in docker, that's why I try to run it with Tensorflow.

sureshdagooglecom commented 2 years ago

Hi @tom-doerr , MediaPipe calculator is not setup for CUDA ,we depend on OpenGl.

google-ml-butler[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

google-ml-butler[bot] commented 2 years ago

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] commented 2 years ago

Are you satisfied with the resolution of your issue? Yes No