Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. Ask your questions right here!
  3. Building ROS node with OpenCV

Building ROS node with OpenCV

Scheduled Pinned Locked Moved Ask your questions right here!
31 Posts 6 Posters 9.5k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Chad SweetC Offline
    Chad SweetC Offline
    Chad Sweet
    ModalAI Team
    wrote on last edited by
    #2

    Check out an example of how to do this here: https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-mpa-exposure/-/blob/dev/CMakeLists.txt#L49

    S 1 Reply Last reply
    0
    • Chad SweetC Chad Sweet

      Check out an example of how to do this here: https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-mpa-exposure/-/blob/dev/CMakeLists.txt#L49

      S Offline
      S Offline
      sarahl
      wrote on last edited by
      #3

      @Chad-Sweet is the voxl-mpa-exposure private? I don't seem to be able to access it.

      1 Reply Last reply
      0
      • Chad SweetC Offline
        Chad SweetC Offline
        Chad Sweet
        ModalAI Team
        wrote on last edited by
        #4

        Whoops, please check again

        S 1 Reply Last reply
        0
        • Chad SweetC Chad Sweet

          Whoops, please check again

          S Offline
          S Offline
          sarahl
          wrote on last edited by
          #5

          @Chad-Sweet Thanks, I will try it out!

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sarahl
            wrote on last edited by
            #6

            I had some additional issues with build dependencies, so now I'm trying to build a docker that's a combination of the opencv-opencl one and the roskinetic one. However, I'm now running out of space on the overlays while building the opencv portion:

            symlink ../../Asia/Katmandu /data/overlay/0539659d5706b44f5832c3d53925cfe2647594de8f18b5708435028ddfdd630e/tmproot772012770/usr/share/zoneinfo/posix/Asia/Kathmandu: no space left on device

            However, running df -H, it doesn't appear to be out of space.

            Filesystem Size Used Avail Use% Mounted on
            /dev/root 3.0G 1.7G 1.3G 58% /
            devtmpfs 2.0G 0 2.0G 0% /dev
            tmpfs 2.0G 0 2.0G 0% /dev/shm
            tmpfs 2.0G 18M 2.0G 1% /run
            tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
            tmpfs 2.0G 4.1k 2.0G 1% /var/volatile
            /dev/sda2 2.3M 82k 2.1M 4% /persist
            /dev/sde11 100M 35M 66M 35% /firmware
            /dev/sde12 13M 4.3M 7.7M 36% /dsp
            /dev/sda3 61M 41k 59M 1% /cache
            /dev/mmcblk0p1 32G 33k 32G 1% /mnt/sdcard
            /dev/sda9 16G 4.9G 11G 32% /data

            Do you know what might be causing this and how I can get around it? I have a 32 GB micro-sd card, is it possible to use that instead of /data?

            1 Reply Last reply
            0
            • Chad SweetC Offline
              Chad SweetC Offline
              Chad Sweet
              ModalAI Team
              wrote on last edited by
              #7

              You can actually build an ARM docker on your Linux desktop. The build process uses tons of space, so tough to say exactly what you're running in to. But, you can definitely try offline and then load it on target. (it will build MUCH faster too!)

              S 1 Reply Last reply
              0
              • Chad SweetC Chad Sweet

                You can actually build an ARM docker on your Linux desktop. The build process uses tons of space, so tough to say exactly what you're running in to. But, you can definitely try offline and then load it on target. (it will build MUCH faster too!)

                S Offline
                S Offline
                sarahl
                wrote on last edited by
                #8

                @Chad-Sweet oh thanks! I'll try that you! I actually want to try to use Ubuntu 18.04 / ROS melodic to be more aligned with our other systems. Do you know if the modalai opencl deb would still be compatible?

                Also, it seems aarch64 is deprecated: https://hub.docker.com/r/aarch64/ubuntu
                for this: https://hub.docker.com/r/arm64v8/ubuntu

                For the base docker image, would it be correct to just change:
                FROM aarch64/ubuntu:xenial
                to:
                FROM arm64v8/ubuntu:bionic

                (Apologies for all the questions, it's actually my first time building a docker image from scratch.)

                1 Reply Last reply
                0
                • Chad SweetC Offline
                  Chad SweetC Offline
                  Chad Sweet
                  ModalAI Team
                  wrote on last edited by
                  #9

                  All of those seem likely to work, though we haven't tried them so there could be some debugging required.

                  S 2 Replies Last reply
                  0
                  • Chad SweetC Chad Sweet

                    All of those seem likely to work, though we haven't tried them so there could be some debugging required.

                    S Offline
                    S Offline
                    sarahl
                    wrote on last edited by sarahl
                    #10

                    is there something specific I need to enable in docker (on the amd64 machine side) to be able to build the arm64 docker images? I'm getting this error:

                    scripts/build-docker.sh 4.2.0
                    Building OpenCV 4.2.0
                    Sending build context to Docker daemon 11.16MB
                    Step 1/48 : FROM aarch64/ubuntu:xenial
                    ---> a7d1ddc47ced
                    Step 2/48 : RUN apt-get update
                    ---> Running in 23be03a5aa45
                    standard_init_linux.go:211: exec user process caused "no such file or directory"
                    The command '/bin/sh -c apt-get update' returned a non-zero code: 1

                    1 Reply Last reply
                    0
                    • Chad SweetC Chad Sweet

                      All of those seem likely to work, though we haven't tried them so there could be some debugging required.

                      S Offline
                      S Offline
                      sarahl
                      wrote on last edited by
                      #11

                      @Chad-Sweet any advice on the above message? it doesn't seem to like trying to build an arm64 docker image on an amd64 ubuntu machine.

                      1 Reply Last reply
                      0
                      • modaltbM Offline
                        modaltbM Offline
                        modaltb
                        ModalAI Team
                        wrote on last edited by
                        #12

                        @sarahl ,

                        I've been messing with another project in a similar area, this link helped:

                        https://github.com/multiarch/qemu-user-static

                        Namely, needing to run this 'magic command' before running my arm64 docker on x86 host (to be honest I'm not fully sure what it's doing)

                        docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
                        

                        Another thing that's helped is adding this to my docker file:

                        # required for ARM emulation
                        COPY ./bin/qemu-arm-static /usr/bin/qemu-arm-static
                        

                        Where in my project, I've copied qemu-arm-static into a bin dir in my repo.

                        Hope this helps!

                        S 1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by A Former User
                          #13

                          Hi @modaltb ,

                          As I had also storage problems like posted here, I wanted to go with the way suggested by @Chad-Sweet. I am doing the same kind of project. Merging two Docker files(Ros Kinetic and Open CV).

                          I am building the images in Raspi aarch64 Ubuntu 20.04.2.
                          I was able to build ROS Kinetic image without Open CV and send to VOXL m500 to load and run.

                          However, when I merged two files and built I got the following error but am not sure if it is the same error with @sarahl and qemu-arm-static will help me.

                          What might be the problem or solution?
                          Thank you in advance,

                          I pasted the output message and two relevant docker files I merged:
                          I used all the docker files for ros kinetic and adapted Open CV files into that.

                          General configuration for OpenCV 3.4.6 =====================================
                          --   Version control:               unknown
                          --
                          --   Platform:
                          --     Timestamp:                   2021-04-22T21:24:55Z
                          --     Host:                        Linux 5.4.0-1034-raspi aarch64
                          --     CMake:                       3.5.1
                          --     CMake generator:             Unix Makefiles
                          --     CMake build tool:            /usr/bin/make
                          --     Configuration:               Release
                          --
                          --   CPU/HW features:
                          --     Baseline:                    NEON FP16
                          --       required:                  NEON
                          --       disabled:                  VFPV3
                          --
                          --   C/C++:
                          --     Built as dynamic libs?:      YES
                          --     C++11:                       YES
                          --     C++ Compiler:                /usr/bin/c++  (ver 5.4.0)
                          --     C++ flags (Release):         -std=c++11 -march=armv8-a+simd   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
                          --     C++ flags (Debug):           -std=c++11 -march=armv8-a+simd   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
                          --     C Compiler:                  /usr/bin/cc
                          --     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
                          --     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
                          --     Linker flags (Release):      -Wl,--gc-sections
                          --     Linker flags (Debug):        -Wl,--gc-sections
                          --     ccache:                      NO
                          --     Precompiled headers:         YES
                          --     Extra dependencies:          dl m pthread rt
                          --     3rdparty dependencies:
                          --
                          --   OpenCV modules:
                          --     To be built:                 calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo python2 stitching ts video videoio
                          --     Disabled:                    shape superres videostab world
                          --     Disabled by dependency:      -
                          --     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java js python3 viz
                          --     Applications:                tests perf_tests apps
                          --     Documentation:               NO
                          --     Non-free algorithms:         NO
                          --
                          --   GUI:
                          --     GTK+:                        YES (ver 2.24.30)
                          --       GThread :                  YES (ver 2.48.2)
                          --       GtkGlExt:                  NO
                          --     VTK support:                 NO
                          --
                          --   Media I/O:
                          --     ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.8)
                          --     JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
                          --     WEBP:                        build (ver encoder: 0x020e)
                          --     PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.2.54)
                          --     TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.6)
                          --     JPEG 2000:                   build (ver 1.900.1)
                          --     OpenEXR:                     build (ver 1.7.1)
                          --     HDR:                         YES
                          --     SUNRASTER:                   YES
                          --     PXM:                         YES
                          --
                          --   Video I/O:
                          --     DC1394:                      YES (ver 2.2.4)
                          --     FFMPEG:                      YES
                          --       avcodec:                   YES (ver 56.60.100)
                          --       avformat:                  YES (ver 56.40.101)
                          --       avutil:                    YES (ver 54.31.100)
                          --       swscale:                   YES (ver 3.1.101)
                          --       avresample:                NO
                          --     GStreamer:                   NO
                          --     libv4l/libv4l2:              NO
                          --     v4l/v4l2:                    linux/videodev2.h
                          --
                          --   Parallel framework:            OpenMP
                          --
                          --   Trace:                         YES (built-in)
                          --
                          --   Other third-party libraries:
                          --     Lapack:                      NO
                          --     Eigen:                       NO
                          --     Custom HAL:                  YES (carotene (ver 0.0.1))
                          --     Protobuf:                    build (3.5.1)
                          --
                          --   OpenCL:                        YES (no extra features)
                          --     Include path:                /home/root/opencv-opencl/opencv-3.4.6/3rdparty/include/opencl/1.2
                          --     Link libraries:              Dynamic load
                          --
                          --   Python 2:
                          --     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
                          --     Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.12)
                          --     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
                          --     install path:                lib/python2.7/dist-packages/cv2/python-2.7
                          --
                          --   Python (for build):            /usr/bin/python2.7
                          --
                          --   Java:
                          --     ant:                         NO
                          --     JNI:                         NO
                          --     Java wrappers:               NO
                          --     Java tests:                  NO
                          --
                          --   Install to:                    /usr
                          -- -----------------------------------------------------------------
                          --
                          -- Configuring incomplete, errors occurred!
                          
                          See also "/home/root/opencv-opencl/opencv-3.4.6/build/CMakeFiles/CMakeOutput.log".
                          See also "/home/root/opencv-opencl/opencv-3.4.6/build/CMakeFiles/CMakeError.log".
                          The command '/bin/sh -c cmake -DCMAKE_BUILD_TYPE=Release           -DCMAKE_INSTALL_PREFIX=/usr           -DWITH_OPENMP=ON           -DWITH_OPENCL=ON           -DHAVE_OPENCL=1           -DOPENCV_EXTRA_MODULES_PATH=/home/opencv-opencl/opencv_contrib-$opencv_version/modules           -DBUILD_opencv_aruco=ON           -DBUILD_opencv_bgsegm=OFF           -DBUILD_opencv_bioinspired=OFF           -DBUILD_opencv_ccalib=OFF           -DBUILD_opencv_cnn_3dobj=OFF           -DBUILD_opencv_cudaarithm=OFF           -DBUILD_opencv_cudabgsegm=OFF           -DBUILD_opencv_cudacodec=OFF           -DBUILD_opencv_cudafeatures2d=OFF           -DBUILD_opencv_cudafilters=OFF           -DBUILD_opencv_cudaimgproc=OFF           -DBUILD_opencv_cudalegacy=OFF           -DBUILD_opencv_cudaobjdetect=OFF           -DBUILD_opencv_cudaoptflow=OFF           -DBUILD_opencv_cudastereo=OFF           -DBUILD_opencv_cudawarping=OFF           -DBUILD_opencv_cudev=OFF           -DBUILD_opencv_cvv=OFF           -DBUILD_opencv_datasets=OFF           -DBUILD_opencv_dnn_objdetect=ON           -DBUILD_opencv_dnns_easily_fooled=OFF           -DBUILD_opencv_dnn_superres=OFF           -DBUILD_opencv_dpm=OFF           -DBUILD_opencv_face=OFF           -DBUILD_opencv_freetype=OFF           -DBUILD_opencv_fuzzy=OFF           -DBUILD_opencv_hdf=OFF           -DBUILD_opencv_hfs=OFF           -DBUILD_opencv_img_hash=OFF           -DBUILD_opencv_line_descriptor=OFF           -DBUILD_opencv_matlab=OFF           -DBUILD_opencv_optflow=OFF           -DBUILD_opencv_ovis=OFF           -DBUILD_opencv_phase_unwrapping=OFF           -DBUILD_opencv_plot=OFF           -DBUILD_opencv_quality=OFF           -DBUILD_opencv_reg=OFF           -DBUILD_opencv_rgbd=OFF           -DBUILD_opencv_saliency=OFF           -DBUILD_opencv_sfm=OFF           -DBUILD_opencv_shape=OFF           -DBUILD_opencv_stereo=OFF           -DBUILD_opencv_structured_light=OFF           -DBUILD_opencv_superres=OFF           -DBUILD_opencv_surface_matching=OFF           -DBUILD_opencv_text=OFF           -DBUILD_opencv_tracking=OFF           -DBUILD_opencv_videostab=OFF           -DBUILD_opencv_viz=OFF           -DBUILD_opencv_xfeatures2d=OFF           -DBUILD_opencv_ximgproc=OFF           -DBUILD_opencv_xobjdetect=OFF           -DBUILD_opencv_xphoto=OFF           -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++11 -march=armv8-a+simd" ..' returned a non-zero code: 1
                          

                          Dockerfile.xenial-base

                          FROM aarch64/ubuntu:xenial
                          
                          RUN apt-get update
                          RUN apt-get -y upgrade
                          RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list'
                          RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
                          RUN apt-get update && apt-get install -y python-rosdep \
                            python-pip \
                            python-rosinstall-generator \
                            python-wstool \
                            python-rosinstall \
                            python-pandas \
                            python-numpy \
                            python-dev \
                            python-defusedxml \
                            build-essential \
                            libboost-all-dev \
                            libconsole-bridge-dev \
                            libtinyxml-dev \
                            sbcl-source \
                            sbcl-doc \
                            vim \
                            sudo \
                            nano \
                            strace \
                            libglib2.0-0 \
                            libgtk2.0-dev \
                            pkg-config \
                            libavcodec-dev \
                            libavformat-dev \
                            libswscale-dev \
                            libtbb2 \
                            libtbb-dev \
                            libjpeg-dev \
                            libpng-dev \
                            libtiff-dev \
                            libdc1394-22-dev \
                            wget \
                            unzip \
                            cmake \
                            git
                          
                          RUN mkdir -p /home/root/opencv-opencl
                          
                          WORKDIR /home/root/opencv-opencl
                          
                          COPY modalai-opencl-dev_1.0-1.deb .
                          
                          RUN dpkg -i modalai-opencl-dev_1.0-1.deb
                          
                          
                          CMD /bin/bash
                          
                          

                          Dockerfile.opencv

                          FROM roskinetic-xenial:base
                          
                          ARG opencv_version=4.2.0
                          
                          WORKDIR /home/root/opencv-opencl
                          
                          RUN wget https://github.com/opencv/opencv/archive/$opencv_version.zip
                          
                          RUN unzip $opencv_version.zip
                          RUN rm $opencv_version.zip
                          
                          RUN wget https://github.com/opencv/opencv_contrib/archive/$opencv_version.zip
                          
                          RUN unzip $opencv_version.zip
                          RUN rm $opencv_version.zip
                          
                          WORKDIR opencv-$opencv_version/build
                          
                          RUN cmake -DCMAKE_BUILD_TYPE=Release \
                                    -DCMAKE_INSTALL_PREFIX=/usr \
                                    -DWITH_OPENMP=ON \
                                    -DWITH_OPENCL=ON \
                                    -DHAVE_OPENCL=1 \
                                    -DOPENCV_EXTRA_MODULES_PATH=/home/opencv-opencl/opencv_contrib-$opencv_version/modules \
                                    -DBUILD_opencv_aruco=ON \
                                    -DBUILD_opencv_bgsegm=OFF \a
                                    -DBUILD_opencv_bioinspired=OFF \
                                    -DBUILD_opencv_ccalib=OFF \
                                    -DBUILD_opencv_cnn_3dobj=OFF \
                                    -DBUILD_opencv_cudaarithm=OFF \
                                    -DBUILD_opencv_cudabgsegm=OFF \
                                    -DBUILD_opencv_cudacodec=OFF \
                                    -DBUILD_opencv_cudafeatures2d=OFF \
                                    -DBUILD_opencv_cudafilters=OFF \
                                    -DBUILD_opencv_cudaimgproc=OFF \
                                    -DBUILD_opencv_cudalegacy=OFF \
                                    -DBUILD_opencv_cudaobjdetect=OFF \
                                    -DBUILD_opencv_cudaoptflow=OFF \
                                    -DBUILD_opencv_cudastereo=OFF \
                                    -DBUILD_opencv_cudawarping=OFF \
                                    -DBUILD_opencv_cudev=OFF \
                                    -DBUILD_opencv_cvv=OFF \
                                    -DBUILD_opencv_datasets=OFF \
                                    -DBUILD_opencv_dnn_objdetect=ON \
                                    -DBUILD_opencv_dnns_easily_fooled=OFF \
                                    -DBUILD_opencv_dnn_superres=OFF \
                                    -DBUILD_opencv_dpm=OFF \
                                    -DBUILD_opencv_face=OFF \
                                    -DBUILD_opencv_freetype=OFF \
                                    -DBUILD_opencv_fuzzy=OFF \
                                    -DBUILD_opencv_hdf=OFF \
                                    -DBUILD_opencv_hfs=OFF \
                                    -DBUILD_opencv_img_hash=OFF \
                                    -DBUILD_opencv_line_descriptor=OFF \
                                    -DBUILD_opencv_matlab=OFF \
                                    -DBUILD_opencv_optflow=OFF \
                                    -DBUILD_opencv_ovis=OFF \
                                    -DBUILD_opencv_phase_unwrapping=OFF \
                                    -DBUILD_opencv_plot=OFF \
                                    -DBUILD_opencv_quality=OFF \
                                    -DBUILD_opencv_reg=OFF \
                                    -DBUILD_opencv_rgbd=OFF \
                                    -DBUILD_opencv_saliency=OFF \
                                    -DBUILD_opencv_sfm=OFF \
                                    -DBUILD_opencv_shape=OFF \
                                    -DBUILD_opencv_stereo=OFF \
                                    -DBUILD_opencv_structured_light=OFF \
                                    -DBUILD_opencv_superres=OFF \
                                    -DBUILD_opencv_surface_matching=OFF \
                                    -DBUILD_opencv_text=OFF \
                                    -DBUILD_opencv_tracking=OFF \
                                    -DBUILD_opencv_videostab=OFF \
                                    -DBUILD_opencv_viz=OFF \
                                    -DBUILD_opencv_xfeatures2d=OFF \
                                    -DBUILD_opencv_ximgproc=OFF \
                                    -DBUILD_opencv_xobjdetect=OFF \
                                    -DBUILD_opencv_xphoto=OFF \
                                    -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++11 -march=armv8-a+simd" ..
                          
                          RUN make -j4
                          RUN make install
                          
                          WORKDIR /home/root/opencv-opencl
                          
                          CMD ["/bin/bash"]
                          
                          
                          ? 1 Reply Last reply
                          0
                          • ? A Former User

                            Hi @modaltb ,

                            As I had also storage problems like posted here, I wanted to go with the way suggested by @Chad-Sweet. I am doing the same kind of project. Merging two Docker files(Ros Kinetic and Open CV).

                            I am building the images in Raspi aarch64 Ubuntu 20.04.2.
                            I was able to build ROS Kinetic image without Open CV and send to VOXL m500 to load and run.

                            However, when I merged two files and built I got the following error but am not sure if it is the same error with @sarahl and qemu-arm-static will help me.

                            What might be the problem or solution?
                            Thank you in advance,

                            I pasted the output message and two relevant docker files I merged:
                            I used all the docker files for ros kinetic and adapted Open CV files into that.

                            General configuration for OpenCV 3.4.6 =====================================
                            --   Version control:               unknown
                            --
                            --   Platform:
                            --     Timestamp:                   2021-04-22T21:24:55Z
                            --     Host:                        Linux 5.4.0-1034-raspi aarch64
                            --     CMake:                       3.5.1
                            --     CMake generator:             Unix Makefiles
                            --     CMake build tool:            /usr/bin/make
                            --     Configuration:               Release
                            --
                            --   CPU/HW features:
                            --     Baseline:                    NEON FP16
                            --       required:                  NEON
                            --       disabled:                  VFPV3
                            --
                            --   C/C++:
                            --     Built as dynamic libs?:      YES
                            --     C++11:                       YES
                            --     C++ Compiler:                /usr/bin/c++  (ver 5.4.0)
                            --     C++ flags (Release):         -std=c++11 -march=armv8-a+simd   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
                            --     C++ flags (Debug):           -std=c++11 -march=armv8-a+simd   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
                            --     C Compiler:                  /usr/bin/cc
                            --     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG
                            --     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fopenmp -g  -O0 -DDEBUG -D_DEBUG
                            --     Linker flags (Release):      -Wl,--gc-sections
                            --     Linker flags (Debug):        -Wl,--gc-sections
                            --     ccache:                      NO
                            --     Precompiled headers:         YES
                            --     Extra dependencies:          dl m pthread rt
                            --     3rdparty dependencies:
                            --
                            --   OpenCV modules:
                            --     To be built:                 calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo python2 stitching ts video videoio
                            --     Disabled:                    shape superres videostab world
                            --     Disabled by dependency:      -
                            --     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java js python3 viz
                            --     Applications:                tests perf_tests apps
                            --     Documentation:               NO
                            --     Non-free algorithms:         NO
                            --
                            --   GUI:
                            --     GTK+:                        YES (ver 2.24.30)
                            --       GThread :                  YES (ver 2.48.2)
                            --       GtkGlExt:                  NO
                            --     VTK support:                 NO
                            --
                            --   Media I/O:
                            --     ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.8)
                            --     JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
                            --     WEBP:                        build (ver encoder: 0x020e)
                            --     PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.2.54)
                            --     TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.6)
                            --     JPEG 2000:                   build (ver 1.900.1)
                            --     OpenEXR:                     build (ver 1.7.1)
                            --     HDR:                         YES
                            --     SUNRASTER:                   YES
                            --     PXM:                         YES
                            --
                            --   Video I/O:
                            --     DC1394:                      YES (ver 2.2.4)
                            --     FFMPEG:                      YES
                            --       avcodec:                   YES (ver 56.60.100)
                            --       avformat:                  YES (ver 56.40.101)
                            --       avutil:                    YES (ver 54.31.100)
                            --       swscale:                   YES (ver 3.1.101)
                            --       avresample:                NO
                            --     GStreamer:                   NO
                            --     libv4l/libv4l2:              NO
                            --     v4l/v4l2:                    linux/videodev2.h
                            --
                            --   Parallel framework:            OpenMP
                            --
                            --   Trace:                         YES (built-in)
                            --
                            --   Other third-party libraries:
                            --     Lapack:                      NO
                            --     Eigen:                       NO
                            --     Custom HAL:                  YES (carotene (ver 0.0.1))
                            --     Protobuf:                    build (3.5.1)
                            --
                            --   OpenCL:                        YES (no extra features)
                            --     Include path:                /home/root/opencv-opencl/opencv-3.4.6/3rdparty/include/opencl/1.2
                            --     Link libraries:              Dynamic load
                            --
                            --   Python 2:
                            --     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
                            --     Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.12)
                            --     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
                            --     install path:                lib/python2.7/dist-packages/cv2/python-2.7
                            --
                            --   Python (for build):            /usr/bin/python2.7
                            --
                            --   Java:
                            --     ant:                         NO
                            --     JNI:                         NO
                            --     Java wrappers:               NO
                            --     Java tests:                  NO
                            --
                            --   Install to:                    /usr
                            -- -----------------------------------------------------------------
                            --
                            -- Configuring incomplete, errors occurred!
                            
                            See also "/home/root/opencv-opencl/opencv-3.4.6/build/CMakeFiles/CMakeOutput.log".
                            See also "/home/root/opencv-opencl/opencv-3.4.6/build/CMakeFiles/CMakeError.log".
                            The command '/bin/sh -c cmake -DCMAKE_BUILD_TYPE=Release           -DCMAKE_INSTALL_PREFIX=/usr           -DWITH_OPENMP=ON           -DWITH_OPENCL=ON           -DHAVE_OPENCL=1           -DOPENCV_EXTRA_MODULES_PATH=/home/opencv-opencl/opencv_contrib-$opencv_version/modules           -DBUILD_opencv_aruco=ON           -DBUILD_opencv_bgsegm=OFF           -DBUILD_opencv_bioinspired=OFF           -DBUILD_opencv_ccalib=OFF           -DBUILD_opencv_cnn_3dobj=OFF           -DBUILD_opencv_cudaarithm=OFF           -DBUILD_opencv_cudabgsegm=OFF           -DBUILD_opencv_cudacodec=OFF           -DBUILD_opencv_cudafeatures2d=OFF           -DBUILD_opencv_cudafilters=OFF           -DBUILD_opencv_cudaimgproc=OFF           -DBUILD_opencv_cudalegacy=OFF           -DBUILD_opencv_cudaobjdetect=OFF           -DBUILD_opencv_cudaoptflow=OFF           -DBUILD_opencv_cudastereo=OFF           -DBUILD_opencv_cudawarping=OFF           -DBUILD_opencv_cudev=OFF           -DBUILD_opencv_cvv=OFF           -DBUILD_opencv_datasets=OFF           -DBUILD_opencv_dnn_objdetect=ON           -DBUILD_opencv_dnns_easily_fooled=OFF           -DBUILD_opencv_dnn_superres=OFF           -DBUILD_opencv_dpm=OFF           -DBUILD_opencv_face=OFF           -DBUILD_opencv_freetype=OFF           -DBUILD_opencv_fuzzy=OFF           -DBUILD_opencv_hdf=OFF           -DBUILD_opencv_hfs=OFF           -DBUILD_opencv_img_hash=OFF           -DBUILD_opencv_line_descriptor=OFF           -DBUILD_opencv_matlab=OFF           -DBUILD_opencv_optflow=OFF           -DBUILD_opencv_ovis=OFF           -DBUILD_opencv_phase_unwrapping=OFF           -DBUILD_opencv_plot=OFF           -DBUILD_opencv_quality=OFF           -DBUILD_opencv_reg=OFF           -DBUILD_opencv_rgbd=OFF           -DBUILD_opencv_saliency=OFF           -DBUILD_opencv_sfm=OFF           -DBUILD_opencv_shape=OFF           -DBUILD_opencv_stereo=OFF           -DBUILD_opencv_structured_light=OFF           -DBUILD_opencv_superres=OFF           -DBUILD_opencv_surface_matching=OFF           -DBUILD_opencv_text=OFF           -DBUILD_opencv_tracking=OFF           -DBUILD_opencv_videostab=OFF           -DBUILD_opencv_viz=OFF           -DBUILD_opencv_xfeatures2d=OFF           -DBUILD_opencv_ximgproc=OFF           -DBUILD_opencv_xobjdetect=OFF           -DBUILD_opencv_xphoto=OFF           -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++11 -march=armv8-a+simd" ..' returned a non-zero code: 1
                            

                            Dockerfile.xenial-base

                            FROM aarch64/ubuntu:xenial
                            
                            RUN apt-get update
                            RUN apt-get -y upgrade
                            RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list'
                            RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
                            RUN apt-get update && apt-get install -y python-rosdep \
                              python-pip \
                              python-rosinstall-generator \
                              python-wstool \
                              python-rosinstall \
                              python-pandas \
                              python-numpy \
                              python-dev \
                              python-defusedxml \
                              build-essential \
                              libboost-all-dev \
                              libconsole-bridge-dev \
                              libtinyxml-dev \
                              sbcl-source \
                              sbcl-doc \
                              vim \
                              sudo \
                              nano \
                              strace \
                              libglib2.0-0 \
                              libgtk2.0-dev \
                              pkg-config \
                              libavcodec-dev \
                              libavformat-dev \
                              libswscale-dev \
                              libtbb2 \
                              libtbb-dev \
                              libjpeg-dev \
                              libpng-dev \
                              libtiff-dev \
                              libdc1394-22-dev \
                              wget \
                              unzip \
                              cmake \
                              git
                            
                            RUN mkdir -p /home/root/opencv-opencl
                            
                            WORKDIR /home/root/opencv-opencl
                            
                            COPY modalai-opencl-dev_1.0-1.deb .
                            
                            RUN dpkg -i modalai-opencl-dev_1.0-1.deb
                            
                            
                            CMD /bin/bash
                            
                            

                            Dockerfile.opencv

                            FROM roskinetic-xenial:base
                            
                            ARG opencv_version=4.2.0
                            
                            WORKDIR /home/root/opencv-opencl
                            
                            RUN wget https://github.com/opencv/opencv/archive/$opencv_version.zip
                            
                            RUN unzip $opencv_version.zip
                            RUN rm $opencv_version.zip
                            
                            RUN wget https://github.com/opencv/opencv_contrib/archive/$opencv_version.zip
                            
                            RUN unzip $opencv_version.zip
                            RUN rm $opencv_version.zip
                            
                            WORKDIR opencv-$opencv_version/build
                            
                            RUN cmake -DCMAKE_BUILD_TYPE=Release \
                                      -DCMAKE_INSTALL_PREFIX=/usr \
                                      -DWITH_OPENMP=ON \
                                      -DWITH_OPENCL=ON \
                                      -DHAVE_OPENCL=1 \
                                      -DOPENCV_EXTRA_MODULES_PATH=/home/opencv-opencl/opencv_contrib-$opencv_version/modules \
                                      -DBUILD_opencv_aruco=ON \
                                      -DBUILD_opencv_bgsegm=OFF \a
                                      -DBUILD_opencv_bioinspired=OFF \
                                      -DBUILD_opencv_ccalib=OFF \
                                      -DBUILD_opencv_cnn_3dobj=OFF \
                                      -DBUILD_opencv_cudaarithm=OFF \
                                      -DBUILD_opencv_cudabgsegm=OFF \
                                      -DBUILD_opencv_cudacodec=OFF \
                                      -DBUILD_opencv_cudafeatures2d=OFF \
                                      -DBUILD_opencv_cudafilters=OFF \
                                      -DBUILD_opencv_cudaimgproc=OFF \
                                      -DBUILD_opencv_cudalegacy=OFF \
                                      -DBUILD_opencv_cudaobjdetect=OFF \
                                      -DBUILD_opencv_cudaoptflow=OFF \
                                      -DBUILD_opencv_cudastereo=OFF \
                                      -DBUILD_opencv_cudawarping=OFF \
                                      -DBUILD_opencv_cudev=OFF \
                                      -DBUILD_opencv_cvv=OFF \
                                      -DBUILD_opencv_datasets=OFF \
                                      -DBUILD_opencv_dnn_objdetect=ON \
                                      -DBUILD_opencv_dnns_easily_fooled=OFF \
                                      -DBUILD_opencv_dnn_superres=OFF \
                                      -DBUILD_opencv_dpm=OFF \
                                      -DBUILD_opencv_face=OFF \
                                      -DBUILD_opencv_freetype=OFF \
                                      -DBUILD_opencv_fuzzy=OFF \
                                      -DBUILD_opencv_hdf=OFF \
                                      -DBUILD_opencv_hfs=OFF \
                                      -DBUILD_opencv_img_hash=OFF \
                                      -DBUILD_opencv_line_descriptor=OFF \
                                      -DBUILD_opencv_matlab=OFF \
                                      -DBUILD_opencv_optflow=OFF \
                                      -DBUILD_opencv_ovis=OFF \
                                      -DBUILD_opencv_phase_unwrapping=OFF \
                                      -DBUILD_opencv_plot=OFF \
                                      -DBUILD_opencv_quality=OFF \
                                      -DBUILD_opencv_reg=OFF \
                                      -DBUILD_opencv_rgbd=OFF \
                                      -DBUILD_opencv_saliency=OFF \
                                      -DBUILD_opencv_sfm=OFF \
                                      -DBUILD_opencv_shape=OFF \
                                      -DBUILD_opencv_stereo=OFF \
                                      -DBUILD_opencv_structured_light=OFF \
                                      -DBUILD_opencv_superres=OFF \
                                      -DBUILD_opencv_surface_matching=OFF \
                                      -DBUILD_opencv_text=OFF \
                                      -DBUILD_opencv_tracking=OFF \
                                      -DBUILD_opencv_videostab=OFF \
                                      -DBUILD_opencv_viz=OFF \
                                      -DBUILD_opencv_xfeatures2d=OFF \
                                      -DBUILD_opencv_ximgproc=OFF \
                                      -DBUILD_opencv_xobjdetect=OFF \
                                      -DBUILD_opencv_xphoto=OFF \
                                      -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++11 -march=armv8-a+simd" ..
                            
                            RUN make -j4
                            RUN make install
                            
                            WORKDIR /home/root/opencv-opencl
                            
                            CMD ["/bin/bash"]
                            
                            
                            ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #14

                            I overcame that problem by adjusting the WORKDIR and PATH. Moreover adding sudo apt-update.

                            However, I always come back to the same problem no matter what i do.
                            I decided to build in my host computer and load in target to head off "No Space Problem" in the target but the problem also occurred in the host as well. I cannot proceed any how.

                            Any suggestions from your side?

                            /home/opencv-opencl/opencv-3.4.6/build/modules/calib3d/test_precomp.hpp:20:1: fatal error: can't write PCH file: No space left on device
                             } // namespace
                             ^
                            compilation terminated.
                            In file included from /home/opencv-opencl/opencv-3.4.6/build/modules/features2d/perf_precomp.hpp:5:0:
                            /home/opencv-opencl/opencv-3.4.6/modules/features2d/include/opencv2/features2d.hpp:1426:1: fatal error: can't write PCH file: No space left on device
                             } /* namespace cv */
                             ^
                            
                            make: *** [all] Error 2
                            The command '/bin/sh -c make -j4' returned a non-zero code: 2
                            
                            REPOSITORY                   TAG       IMAGE ID       CREATED             SIZE
                            <none>                       <none>    f1a9b038119e   18 minutes ago      1.81GB
                            roskinetic-xenial            v1.0      e76c6e4f806e   About an hour ago   1.98GB
                            roskinetic-xenial            minimal   fcdda3d30808   3 hours ago         1.56GB
                            roskinetic-xenial            base      d22679ae8e50   3 hours ago         1.37GB
                            multiarch/qemu-user-static   latest    a217e72a8293   3 months ago        280MB
                            hello-world                  latest    a29f45ccde2a   15 months ago       9.14kB
                            aarch64/ubuntu               xenial    a7d1ddc47ced   3 years ago         110MB
                            
                            

                            Could you @sarahl solve your issue?

                            1 Reply Last reply
                            0
                            • modaltbM Offline
                              modaltbM Offline
                              modaltb
                              ModalAI Team
                              wrote on last edited by
                              #15

                              Hi @Voxlady ,

                              I'm scratching my head on this one, I don't have anything helpful yet but will keep an eye out!

                              1 Reply Last reply
                              0
                              • modaltbM modaltb

                                @sarahl ,

                                I've been messing with another project in a similar area, this link helped:

                                https://github.com/multiarch/qemu-user-static

                                Namely, needing to run this 'magic command' before running my arm64 docker on x86 host (to be honest I'm not fully sure what it's doing)

                                docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
                                

                                Another thing that's helped is adding this to my docker file:

                                # required for ARM emulation
                                COPY ./bin/qemu-arm-static /usr/bin/qemu-arm-static
                                

                                Where in my project, I've copied qemu-arm-static into a bin dir in my repo.

                                Hope this helps!

                                S Offline
                                S Offline
                                sarahl
                                wrote on last edited by
                                #16

                                @modaltb thanks so much! I was actually wondering if I needed something like buildx for the multi-arch building, but I couldn't get it to work with the Ubuntu version of docker. But this seemed to fix my previous issue, so I'll see how this goes. Just trying the first command for now without the COPY line.

                                @Voxlady I'll let you know if this fixes my issue. Haven't gotten to the OpenCV portion yet. I don't know what your disk storage constraints are on the raspberry pi, but I'm running on an amd64 Ubuntu 18.04 machine which hopefully will not run into storage issues. I noticed on the Voxl that what was taking up a lot of space was the docker overlays. I wonder if condensing all the dockerfiles into a single one would help (if you don't need all the intermediate images)?

                                1 Reply Last reply
                                0
                                • ? Offline
                                  ? Offline
                                  A Former User
                                  wrote on last edited by
                                  #17

                                  Hi @modaltb and @sarahl ,

                                  Thank you for your messages. It took me some trial-and-error time but I finally solved the problem by reducing the number of Docker Files as well as images. Now, everything seems working again.

                                  BR,
                                  Ayberk

                                  1 Reply Last reply
                                  0
                                  • modaltbM Offline
                                    modaltbM Offline
                                    modaltb
                                    ModalAI Team
                                    wrote on last edited by
                                    #18

                                    Thanks for the update. We really appreciate the feedback and community response!

                                    S 2 Replies Last reply
                                    0
                                    • modaltbM modaltb

                                      Thanks for the update. We really appreciate the feedback and community response!

                                      S Offline
                                      S Offline
                                      sarahl
                                      wrote on last edited by
                                      #19

                                      @modaltb okay it finally built, but when I tried to load it onto the Voxl, it ran out of space. So now I'm trying to build a new version with fewer intermediate images and with opencl removed. Are there any other ways to make more space for docker?

                                      @Voxlady were you able to load your roskinetic+opencv image to the Voxl? Did you use 4.2.0 or 3.4.6 or another opencv version?

                                      1 Reply Last reply
                                      0
                                      • ? Offline
                                        ? Offline
                                        A Former User
                                        wrote on last edited by A Former User
                                        #20

                                        @sarahl,

                                        Yes, I was able to load the image and even download additional packages in the container.

                                        1. I merged two base files from Opencv/cl and kinetic. Moreover, I put everything that's in Dockerfile.opencv into Dockerfile.xenial-packages. So, in the end I didn't have any extra Opencv-cl file. I also disabled Opencl.

                                        2. Most importantly, after I built roskinetic-xenial:v1.0, I deleted other two images base and minimal. I think that's okay to delete since no error or failure has occurred so far.

                                        3. Last, I used some best practices suggested by Docker. Especially, for Dockerfile.xenial-base. See sorting multi-line arguments .

                                        4. I think 3.4.6 version doesn't have a corresponding release in GitHub. So, ARG opencv_version=4.2.0 in Dockerfile.opencv assigns automatically. Therefore, I went with 4.2.0.

                                        Hopefully it helps.
                                        All the best

                                        1 Reply Last reply
                                        0
                                        • modaltbM modaltb

                                          Thanks for the update. We really appreciate the feedback and community response!

                                          S Offline
                                          S Offline
                                          sarahl
                                          wrote on last edited by
                                          #21

                                          @modaltb So I finally got the docker loaded, and also built cv_bridge and the camera ros driver. However, it doesn't seem to be reading in the camera (a FLIR). When I'm outside the docker, plugging in the device adds /dev/ttyACM0 and /dev/video2, the latter of which is used by the ros node. Is there something I need to do when running the docker to have access to the usb devices?

                                          1 Reply Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          ModalAI
                                          Categories Recent Tags ModalAI.com Docs
                                          © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups