stereolabs / zed-ros2-wrapper

ROS 2 wrapper for the ZED SDK
https://www.stereolabs.com/docs/ros2/
Apache License 2.0
134 stars 139 forks source link

colcon build error in docker #181

Closed eladpar closed 6 months ago

eladpar commented 8 months ago

Preliminary Checks

Description

hey im trying to create a ros2 zed wrapper docker in amd64 ans it is not compiling here is my Dockerfile:

ARG UBUNTU_RELEASE_YEAR=20
ARG CUDA_MAJOR=12
ARG CUDA_MINOR=1.0

FROM nvidia/cuda:${CUDA_MAJOR}.${CUDA_MINOR}-devel-ubuntu${UBUNTU_RELEASE_YEAR}.04
ARG UBUNTU_RELEASE_YEAR=20
ARG CUDA_MAJOR=12
ARG CUDA_MINOR=1.0
ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=0

ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility

RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt

# Setup the ZED SDK
RUN apt-get update -y || true ; apt-get install --no-install-recommends lsb-release wget less udev sudo zstd build-essential cmake python3 python3-pip libpng-dev libgomp1 -y ; \
    #python3 -m pip install --upgrade pip ; \
    python3 -m pip install numpy opencv-python ; \
    wget -q -O ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}${CUDA_MINOR%.*}/ubuntu${UBUNTU_RELEASE_YEAR} && \
    chmod +x ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run ; ./ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run -- silent skip_tools skip_cuda && \
    ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so && \
    rm ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/zed/
WORKDIR /external_libs_build

# ========================
# ROS2-FOXY INSTALLATION
# ========================

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    locales && \
    locale-gen en_US.UTF-8 && \
    update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

ENV LANG=en_US.UTF-8

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    software-properties-common && \
    add-apt-repository universe && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN apt update && \
    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
    -o /usr/share/keyrings/ros-archive-keyring.gpg

RUN sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" > /etc/apt/sources.list.d/ros2-latest.list'

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        ros-foxy-ros-base \
        python3-argcomplete \
        ros-foxy-cv-bridge \
        python3-colcon-common-extensions \
        python3-rosdep \
        git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        ros-foxy-nmea-msgs \
        ros-foxy-geographic-msgs \
        ros-foxy-image-transport \
        ros-foxy-robot-localization \
        ros-foxy-diagnostic-updater && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
WORKDIR /root/ros2_ws/src/ 

RUN bash -c '. /opt/ros/foxy/setup.bash && \ 
sudo rosdep init && \
rosdep update && \
git clone  --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && \
cd .. && \
rosdep install --from-paths src --ignore-src -r -y && \
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) && \
. install/setup.bash'

Steps to Reproduce

  1. run the docker file on amd64

Expected Result

compiled

Actual Result

didnt compile

ZED Camera model

ZED

Environment

ubuntu 20.04
cuda 12.1

Anything else?

the log is

docker build -t ros2-zed-wrapper .
[+] Building 80.4s (16/16) FINISHED                                            docker:default
 => [internal] load .dockerignore                                                        0.0s
 => => transferring context: 2B                                                          0.0s
 => [internal] load build definition from Dockerfile                                     0.0s
 => => transferring dockerfile: 3.34kB                                                   0.0s
 => [internal] load metadata for docker.io/nvidia/cuda:12.1.0-devel-ubuntu20.04          0.7s
 => [ 1/13] FROM docker.io/nvidia/cuda:12.1.0-devel-ubuntu20.04@sha256:8e73cff2e89bc120  0.0s
 => CACHED [ 2/13] RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version 12.1.0  0.0s
 => CACHED [ 3/13] RUN apt-get update -y || true ; apt-get install --no-install-recomme  0.0s
 => CACHED [ 4/13] WORKDIR /usr/local/zed/                                               0.0s
 => CACHED [ 5/13] WORKDIR /external_libs_build                                          0.0s
 => CACHED [ 6/13] RUN apt-get update &&  apt-get install -y --no-install-recommends  l  0.0s
 => CACHED [ 7/13] RUN apt-get update &&  apt-get install -y --no-install-recommends     0.0s
 => CACHED [ 8/13] RUN apt update &&  curl -sSL https://raw.githubusercontent.com/ros/r  0.0s
 => CACHED [ 9/13] RUN sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/u  0.0s
 => CACHED [10/13] RUN apt-get update &&     apt-get install -y --no-install-recommends  0.0s
 => [11/13] RUN apt-get update &&     apt-get install -y --no-install-recommends        13.2s
 => [12/13] WORKDIR /root/ros2_ws/src/                                                   0.1s
 => ERROR [13/13] RUN bash -c '. /opt/ros/foxy/setup.bash && sudo rosdep init && rosde  66.3s 
------                                                                                        
 > [13/13] RUN bash -c '. /opt/ros/foxy/setup.bash && sudo rosdep init && rosdep update && git clone  --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && cd .. && rosdep install --from-paths src --ignore-src -r -y && colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) && . install/setup.bash':                     
1.056 Wrote /etc/ros/rosdep/sources.list.d/20-default.list                                    
1.056 Recommended: please run
1.056 
1.056   rosdep update
1.056 
9.584 reading in sources list data from /etc/ros/rosdep/sources.list.d
9.584 Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
9.584 Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
9.584 Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
9.584 Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
9.584 Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
9.584 Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
9.584 Skip end-of-life distro "ardent"
9.584 Skip end-of-life distro "bouncy"
9.584 Skip end-of-life distro "crystal"
9.584 Skip end-of-life distro "dashing"
9.584 Skip end-of-life distro "eloquent"
9.584 Skip end-of-life distro "foxy"
9.584 Skip end-of-life distro "galactic"
9.584 Skip end-of-life distro "groovy"
9.584 Add distro "humble"
9.584 Skip end-of-life distro "hydro"
9.584 Skip end-of-life distro "indigo"
9.584 Add distro "iron"
9.584 Skip end-of-life distro "jade"
9.584 Skip end-of-life distro "kinetic"
9.584 Skip end-of-life distro "lunar"
9.584 Skip end-of-life distro "melodic"
9.584 Add distro "noetic"
9.584 Add distro "rolling"
9.584 updated cache in /root/.ros/rosdep/sources.cache
9.584 Warning: running 'rosdep update' as root is not recommended.
9.584   You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
9.613 Cloning into 'zed-ros2-wrapper'...
11.19 Submodule 'zed-ros2-interfaces' (https://github.com/stereolabs/zed-ros2-interfaces.git) registered for path 'zed-ros2-interfaces'
11.20 Cloning into '/root/ros2_ws/src/zed-ros2-wrapper/zed-ros2-interfaces'...
14.42 Submodule path 'zed-ros2-interfaces': checked out '6dfb08531c324481418342e789adb2c3d836c917'
14.64 ERROR: the following packages/stacks could not have their rosdep keys resolved
14.64 to system dependencies:
14.64 zed_wrapper: Cannot locate rosdep definition for [xacro]
14.64 Continuing to install resolvable dependencies...
14.64 #All required rosdeps installed successfully
14.89 Starting >>> zed_interfaces
27.39 Finished <<< zed_interfaces [12.5s]
27.39 Starting >>> zed_components
61.71 --- stderr: zed_components
61.71 In file included from /root/ros2_ws/src/zed-ros2-wrapper/zed_components/src/zed_camera/include/zed_camera_component.hpp:19,
61.71                  from /root/ros2_ws/src/zed-ros2-wrapper/zed_components/src/zed_camera/src/zed_camera_component.cpp:20:
61.71 /usr/local/zed/include/sl/Fusion.hpp:68:64: note: #pragma message: ~ FUSION SDK is distributed in Early Access ~
61.71    68 | #pragma message("~ FUSION SDK is distributed in Early Access ~")
61.71       |                                                                ^
61.71 ---
61.71 [Processing: zed_components]
61.71 Finished <<< zed_components [34.3s]
61.71 Starting >>> zed_wrapper
66.23 --- stderr: zed_wrapper
66.23 In file included from /root/ros2_ws/install/zed_components/include/zed_components/zed_camera_component.hpp:19,
66.23                  from /root/ros2_ws/src/zed-ros2-wrapper/zed_wrapper/src/zed_wrapper.cpp:17:
66.23 /usr/local/zed/include/sl/Fusion.hpp:68:64: note: #pragma message: ~ FUSION SDK is distributed in Early Access ~
66.23    68 | #pragma message("~ FUSION SDK is distributed in Early Access ~")
66.23       |                                                                ^
66.23 /usr/bin/ld: warning: libcuda.so.1, needed by /usr/local/zed/lib/libsl_zed.so, not found (try using -rpath or -rpath-link)
66.23 /usr/bin/ld: warning: libnvcuvid.so.1, needed by /usr/local/zed/lib/libsl_zed.so, not found (try using -rpath or -rpath-link)
66.23 /usr/bin/ld: warning: libnvidia-encode.so.1, needed by /usr/local/zed/lib/libsl_zed.so, not found (try using -rpath or -rpath-link)
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuMemFree_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuCtxPushCurrent_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidParseVideoData'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuStreamSynchronize'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidCreateDecoder'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidCreateVideoParser'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuCtxPopCurrent_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuCtxSetCurrent'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuCtxCreate_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuMemcpy2DUnaligned_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidCtxLockDestroy'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `NvEncodeAPICreateInstance'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidCtxLockCreate'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuMemcpy2D_v2'
66.23 /usr/bin/ld: /root/ros2_ws/install/zed_components/lib/libzed_camera_component.so: undefined reference to `cuCtxGetDevice'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuMemAllocPitch_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuGetErrorName'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidMapVideoFrame64'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidGetDecoderCaps'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidDestroyDecoder'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuMemcpy2DAsync_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuInit'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidDecodePicture'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuCtxDestroy_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuMemAlloc_v2'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidUnmapVideoFrame64'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuCtxGetCurrent'
66.23 /usr/bin/ld: /usr/local/zed/lib/libsl_zed.so: undefined reference to `cuvidDestroyVideoParser'
66.23 collect2: error: ld returned 1 exit status
66.23 make[2]: *** [CMakeFiles/zed_wrapper.dir/build.make:321: zed_wrapper] Error 1
66.23 make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/zed_wrapper.dir/all] Error 2
66.23 make: *** [Makefile:141: all] Error 2
66.23 ---
66.23 Failed   <<< zed_wrapper [4.52s, exited with code 2]
66.26 
66.26 Summary: 2 packages finished [51.4s]
66.26   1 package failed: zed_wrapper
66.26   2 packages had stderr output: zed_components zed_wrapper
66.26   1 package not processed
------
Dockerfile:82
--------------------
  81 |     
  82 | >>> RUN bash -c '. /opt/ros/foxy/setup.bash && \ 
  83 | >>> sudo rosdep init && \
  84 | >>> rosdep update && \
  85 | >>> git clone  --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && \
  86 | >>> cd .. && \
  87 | >>> rosdep install --from-paths src --ignore-src -r -y && \
  88 | >>> colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) && \
  89 | >>> . install/setup.bash'
  90 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c bash -c '. /opt/ros/foxy/setup.bash && sudo rosdep init && rosdep update && git clone  --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && cd .. && rosdep install --from-paths src --ignore-src -r -y && colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) && . install/setup.bash'" did not complete successfully: exit code: 2
Patrick-AA commented 8 months ago

Hello,

Can you try the colcon build command with something similar to Dockerfile.l4t35_1-humble-release ?

Mat198 commented 7 months ago

I think this can solve your issue: https://stackoverflow.com/questions/59691207/docker-build-with-nvidia-runtime

eladpar commented 7 months ago

Hello,

Can you try the colcon build command with something similar to Dockerfile.l4t35_1-humble-release ?

this worked but although its not foxy..

I think this can solve your issue: https://stackoverflow.com/questions/59691207/docker-build-with-nvidia-runtime

haven't tried this, it might work

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days