在 docker 容器中安装 CMake 时出错。找不到 PROTOBUF
Error installing CMake in a docker container. Could not find PROTOBUF
您好,我正在尝试构建一个 docker 图像,运行 是 openpose。一切顺利,直到我必须编译我提供的源代码...
我 运行 下面的 Dockerfile 并抛出以下错误:
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)
我尝试执行以下操作:
并通过 apt-get 安装 protobuf 但它没有用。发生这种情况:
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
这是我的 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`
这个问题发生在 运行 cmake .. 行。
错误的完整日志如下:
-- 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
在尝试 运行 cmake
命令之前,您的 Dockerfile 需要安装 Protobuf。
这一行:
RUN apt-get update && apt-get -y install cmake
应该是:
RUN apt-get update && apt-get -y install cmake protobuf-compiler
如果有任何其他缺失的依赖项,您需要确保在使用它们之前也安装了这些依赖项。
想通了:
将这一行包含在代码的开头并且有效。
RUN apt install -y libprotobuf-dev protobuf-compiler
发生了许多其他与此类似的错误...大多数时候解决方案是相同的,只是更改要安装的包的名称。
如果有人遇到类似问题,这是我在解决此问题时学到的一个提示。我使用 ubuntu 16.04 作为 "os" 因此询问 ubuntu 对我的问题有大部分答案。
这现在看起来很明显,但有人可能会遇到这个...
您好,我正在尝试构建一个 docker 图像,运行 是 openpose。一切顺利,直到我必须编译我提供的源代码...
我 运行 下面的 Dockerfile 并抛出以下错误:
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)
我尝试执行以下操作:
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
这是我的 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`
这个问题发生在 运行 cmake .. 行。
错误的完整日志如下:
-- 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
在尝试 运行 cmake
命令之前,您的 Dockerfile 需要安装 Protobuf。
这一行:
RUN apt-get update && apt-get -y install cmake
应该是:
RUN apt-get update && apt-get -y install cmake protobuf-compiler
如果有任何其他缺失的依赖项,您需要确保在使用它们之前也安装了这些依赖项。
想通了:
将这一行包含在代码的开头并且有效。
RUN apt install -y libprotobuf-dev protobuf-compiler
发生了许多其他与此类似的错误...大多数时候解决方案是相同的,只是更改要安装的包的名称。
如果有人遇到类似问题,这是我在解决此问题时学到的一个提示。我使用 ubuntu 16.04 作为 "os" 因此询问 ubuntu 对我的问题有大部分答案。
这现在看起来很明显,但有人可能会遇到这个...