我正在使用docker来交叉编译mxnet并启用树莓派3 b的C ++软件包。我正在使用以下docker文件:
FROM dockcross/linux-armv7
MAINTAINER Cyrus Behroozi cyrus.behr@gmail.com
ENV DEFAULT_DOCKCROSS_IMAGE linux-armv7-rpi
# OpenCV Dependencies
RUN sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install -y \
build-essential \
cmake unzip pkg-config \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libxvidcore-dev \
libx264-dev \
libgtk-3-dev \
libatlas-base-dev \
gfortran \
&& sudo rm /usr/local/lib/libcurl.so.4 \
&& sudo ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0 /usr/local/lib/libcurl.so.4
# OpenCV Insallation
ENV OPENCV_VERSION="4.1.0"
RUN mkdir -p ~/opencv \
&& cd ~/opencv \
&& wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip \
&& unzip ${OPENCV_VERSION}.zip \
&& mkdir ~/opencv/opencv-${OPENCV_VERSION}/build \
&& cd ~/opencv/opencv-${OPENCV_VERSION}/build \
&& cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-DBUILD_SHARED_LIBS=OFF \
.. \
&& make -j8 \
&& sudo make install \
&& rm ~/opencv/${OPENCV_VERSION}.zip \
&& rm -r ~/opencv/opencv-${OPENCV_VERSION}
# mxnet requirements
RUN sudo apt-get -y install ninja-build \
liblapack* \
libblas* \
libopenblas* \
&& cd ~ \
&& git clone https://github.com/apache/incubator-mxnet.git --recursive \
&& cd incubator-mxnet
RUN cd ~/incubator-mxnet \
&& mkdir -p build \
&& cd build \
&& cmake \
-DUSE_CPP_PACKAGE=1 \
-DUSE_SSE=OFF \
-DUSE_CUDA=OFF \
-DUSE_OPENCV=ON \
-DUSE_OPENMP=ON \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_SIGNAL_HANDLER=ON \
-DCMAKE_BUILD_TYPE=Release \
-GNinja .. \
&& ninja -j8
可以看出,在标记为# mxnet requirements
的步骤中,我正在安装libopenblas
。如果我进入docker容器并执行查找操作,则可以看到确实安装了libopenblas
:
$ sudo find . | grep libopenblas
./usr/share/doc/libopenblas-dev
./usr/share/doc/libopenblas-dev/copyright
./usr/share/doc/libopenblas-base
./usr/share/doc/libopenblas-base/copyright
./usr/lib/libopenblas.a
./usr/lib/libopenblas.so.0
./usr/lib/libopenblasp-r0.2.19.so
./usr/lib/libopenblas.so
./usr/lib/libopenblasp-r0.2.19.a
但是,当我构建dockerfile时,出现以下错误。请注意,在mxnet中运行cmake时会发生这种情况:
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
CMake Error at cmake/Modules/FindOpenBLAS.cmake:82 (MESSAGE):
Could not find OpenBLAS
Call Stack (most recent call first):
cmake/ChooseBlas.cmake:42 (find_package)
CMakeLists.txt:323 (include)
我不确定为什么找不到包,因为搜索路径(在cmake/Modules/FindOpenBLAS.cmake
中指定)具有'/ usr / lib'作为搜索路径:
SET(Open_BLAS_LIB_SEARCH_PATHS
/lib/
/lib/openblas-base
/lib64/
/usr/lib
/usr/lib/openblas-base
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
/usr/local/opt/openblas/lib
${PROJECT_SOURCE_DIR}/3rdparty/OpenBLAS/lib
${PROJECT_SOURCE_DIR}/thirdparty/OpenBLAS/lib
${OpenBLAS_DIR}
${OpenBLAS_DIR}/lib
${OpenBLAS_HOME}
${OpenBLAS_HOME}/lib
)