First off thanks for a great OS and community.
I’m running into some problems that I think is related to the cross-build feature.
I will describe my findings in the hopes that someone is able to spot the problem or help guide me to a solution.
I’m building two different docker images. One with just a ROS installation and then one building on top of that with my own dependencies and ROS nodes.
If i build this without the cross-build feature it works without a problem. But with cross-build it will fail on the line
RUN . /opt/ros/noetic/setup.sh && catkin_make
with this error
find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.
I have made sure that the right setup file is sourced with some console prints. Also tried adding catkin as a ROS package and feeding the catkin_make the path.
I have also build the container without trying to run catkin_make and it builds fine.
If i then boot up the container and enter it to run the two same commands it builds the workspace without a problem and all works. Sadly this is not a lasting solution.
Really hope someone have worked with this and found a solution! The two dockerfiles are linked below.
The two dockerfiles I’m working with:
Base ROS image following the setup from ROS just with Balena cross-build feature.
FROM balenalib/raspberrypi3-ubuntu:focal RUN ["cross-build-start"] RUN echo 'Etc/UTC' > /etc/timezone && \ ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ apt-get update && \ apt-get install -q -y --no-install-recommends tzdata && \ rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -q -y --no-install-recommends \ dirmngr \ gnupg2 \ && rm -rf /var/lib/apt/lists/* RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 RUN echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros1-latest.list ENV LANG C.UTF-8 ENV LC_ALL C.UTF-8 ENV ROS_DISTRO noetic RUN apt-get update && apt-get install -y --no-install-recommends \ ros-noetic-ros-core=1.5.0-1* \ && rm -rf /var/lib/apt/lists/* RUN ["cross-build-end"] CMD ["bash"]
My dockerfile building on top of the ROS base image.
FROM docker-image-registry/ros_docker_image_base RUN ["cross-build-start"] RUN apt-get update && apt-get install -y \ libmysqlcppconn-dev \ python3-pip \ python3-wstool \ python3-catkin-tools \ python3-catkin-lint \ python3-osrf-pycommon \ automake \ autoconf \ libtool \ libmodbus-dev \ libmodbus5 \ && rm -rf /var/lib/apt/lists/* COPY libs/WiringPi /opt/ros/noetic/lib/WiringPi WORKDIR /opt/ros/noetic/lib/WiringPi RUN ./build WORKDIR /ws RUN rosdep init && rosdep update COPY ros_ws/src /ws/src RUN . /opt/ros/noetic/setup.sh && \ apt-get update && rosdep install -y \ --from-paths /ws/src \ --ignore-src \ && rm -rf /var/lib/apt/lists/* RUN . /opt/ros/noetic/setup.sh && catkin_make COPY rosmain.launch / \ entry.sh / WORKDIR / RUN ["cross-build-end"] ENTRYPOINT ["./entry.sh" ] CMD ["roslaunch","/rosmain.launch"]