Douglas Ferreira
Douglas Ferreira

Reputation: 747

Error installing CMake in a docker container. Could not find PROTOBUF

Hi I am trying to build a docker image that runs openpose. It goes all well until I have to compile the source I am giving...

I run the Dockerfile below and it throws the following error:

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find Protobuf (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.5/Modules/FindProtobuf.cmake:308 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:388 (find_package)

I tried to do the following: Could not find PROTOBUF Compiler and install the protobuf via apt-get but it didn't work. This happens:

After this operation, 2321 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c apt-get update && apt-get install protobuf-compiler' returned a non-zero code: 1

this is my Dockerfile:

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y libopencv-dev

WORKDIR src

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y git

RUN git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git

WORKDIR /src/openpose/3rdparty

RUN rm -r caffe
RUN rm -r pybind11

RUN git clone https://github.com/BVLC/caffe.git
RUN git clone https://github.com/pybind/pybind11.git

WORKDIR /src/openpose/build


RUN apt-get update && apt-get -y install cmake
RUN cmake .. -DBUILD_CAFFE=OFF -DGPU_MODE=CPU_ONLY
RUN make
RUN make install

RUN make -j`nproc`

this trouble happens on the RUN cmake .. line.

The full log of the error is the following:

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- GCC detected, adding compile flags
-- Building CPU Only.
-- Building with MKL support.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Could NOT find GFlags (missing:  GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY) 
-- Could NOT find Glog (missing:  GLOG_INCLUDE_DIR GLOG_LIBRARY) 
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find Protobuf (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.5/Modules/FindProtobuf.cmake:308 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:388 (find_package)


-- Configuring incomplete, errors occurred!
See also "/src/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/src/openpose/build/CMakeFiles/CMakeError.log".
The command '/bin/sh -c cmake .. -DBUILD_CAFFE=OFF -DGPU_MODE=CPU_ONLY -DBLAS=open' returned a non-zero code: 1

Upvotes: 11

Views: 46489

Answers (2)

Douglas Ferreira
Douglas Ferreira

Reputation: 747

Figured it out:

included this line in the beginning of the code and it worked.

RUN apt install -y libprotobuf-dev protobuf-compiler

Many other errors similar to this occurred... Most of the times solution was identical changing just the name of the package to be installed.

If anybody runs to similar issues here's a tip I learned during this problem. I used ubuntu 16.04 as the "os" therefore ask ubuntu had most of the answers for my issues.

This seems pretty obvious right now but somebody may face this...

Upvotes: 9

wmorrell
wmorrell

Reputation: 5337

Your Dockerfile needs to have Protobuf installed before you try running the cmake command.

This line:

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

Should be:

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

If there are any other missing dependencies, you will need to make sure those dependencies are installed too before they are used.

Upvotes: 19

Related Questions