Skip to content

Commit

Permalink
RSDK-5976 - Fix GLIBC compatibility issue on jetson devices (#14)
Browse files Browse the repository at this point in the history
* Change jetson base container to l4t

* Add l4t base dockerfile

* Fix new line
  • Loading branch information
seanavery authored Dec 6, 2023
1 parent ebc68a4 commit 24be0ab
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
strategy:
matrix:
include:
- container: ghcr.io/seanavery/viam-cpp-base:0.0.2
- container: ghcr.io/seanavery/viam-cpp-base-jetson:0.0.3
TARGET: jetson
META_PATH: meta.json
- container: ghcr.io/seanavery/viam-cpp-base-pi:0.0.2
- container: ghcr.io/seanavery/viam-cpp-base-pi:0.0.3
TARGET: pi
META_PATH: meta-pi.json
container:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
strategy:
matrix:
include:
- container: ghcr.io/seanavery/viam-cpp-base:0.0.2
- container: ghcr.io/seanavery/viam-cpp-base-jetson:0.0.3
TARGET: jetson
META_PATH: meta.json
- container: ghcr.io/seanavery/viam-cpp-base-pi:0.0.2
- container: ghcr.io/seanavery/viam-cpp-base-pi:0.0.3
TARGET: pi
META_PATH: meta-pi.json
container:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
include:
- container: ghcr.io/seanavery/viam-cpp-base:0.0.2
- container: ghcr.io/seanavery/viam-cpp-base-jetson:0.0.3
TARGET: jetson
- container: ghcr.io/seanavery/viam-cpp-base-pi:0.0.2
- container: ghcr.io/seanavery/viam-cpp-base-pi:0.0.3
TARGET: pi
container:
image: ${{ matrix.container }}
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ BIN_DIR := ./bin
HUB_USER := seanavery
TEST_NAME := viam-csi-test
DOCK_TAG := 0.0.1 # tag for mod/test images
BASE_TAG := 0.0.2
L4T_TAG := 35.3.1
BASE_TAG := 0.0.3
L4T_TAG := 35.4.1

# Package
PACK_NAME := viam-csi
Expand All @@ -18,8 +18,8 @@ PACK_TAG := latest
TARGET ?= pi # [jetson,pi]
ifeq ($(TARGET), jetson)
TEST_BASE=nvcr.io/nvidia/l4t-base:$(L4T_TAG)
BASE_NAME=viam-cpp-base
BASE_CONFIG=./etc/Dockerfile.base
BASE_NAME=viam-cpp-base-jetson
BASE_CONFIG=./etc/Dockerfile.base.l4t
MOD_NAME=viam-csi-module-jetson
MOD_CONFIG=./etc/Dockerfile.mod
RECIPE=./viam-csi-jetson-arm64.yml
Expand Down Expand Up @@ -120,10 +120,10 @@ image-test:

# Copies binary and appimage from container to host.
bin-mod:
rm -rf $(BIN_DIR) | true && \
rm -rf $(BIN_DIR) || true && \
mkdir -p $(BIN_DIR) && \
docker stop viam-csi-bin | true && \
docker rm viam-csi-bin | true && \
docker stop viam-csi-bin || true && \
docker rm viam-csi-bin || true && \
docker run -d -it --name viam-csi-bin $(MOD_NAME):$(DOCK_TAG) && \
docker cp viam-csi-bin:/root/opt/src/csi-camera/build/viam-csi ./$(BIN_DIR) && \
docker cp viam-csi-bin:/root/opt/src/csi-camera/etc/viam-csi-$(PACK_TAG)-aarch64.AppImage ./$(BIN_DIR) && \
Expand Down
111 changes: 111 additions & 0 deletions etc/Dockerfile.base.l4t
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
ARG L4T_TAG
FROM nvcr.io/nvidia/l4t-base:${L4T_TAG}

RUN apt-get -y update

# install viam-cpp-sdk
# reference: https://github.com/viamrobotics/viam-cpp-sdk
RUN apt-get -y --no-install-recommends install \
build-essential \
ca-certificates \
curl \
doxygen \
g++ \
gdb \
git \
gnupg \
gpg \
less \
libboost-all-dev \
libc-ares-dev \
libre2-dev \
libssl-dev \
ninja-build \
pkg-config \
software-properties-common \
sudo \
wget \
zlib1g-dev

RUN bash -c 'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -'
RUN apt-add-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main'

RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - > /usr/share/keyrings/kitware-archive-keyring.gpg
RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' > /etc/apt/sources.list.d/kitware.list

RUN apt-get update

RUN apt-get -y --no-install-recommends install -t llvm-toolchain-focal-15 \
clang-15 \
clang-tidy-15

RUN apt-get -y install cmake

RUN mkdir -p ${HOME}/opt/src

RUN cd ${HOME}/opt/src && \
git clone --recurse-submodules -b v1.52.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
cd grpc && \
mkdir -p build && \
cd build && \
cmake .. -G Ninja \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_INSTALL_RPATH=/usr/local/lib && \
ninja install && \
cd .. && \
rm -rf build

RUN cd ${HOME}/opt/src && \
git clone https://github.com/viamrobotics/viam-cpp-sdk && \
cd viam-cpp-sdk && \
mkdir build && \
cd build && \
cmake -DVIAMCPPSDK_USE_DYNAMIC_PROTOS=ON -DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON .. -G Ninja && \
ninja install -j 1

# install viam-csi
RUN cp -r ${HOME}/opt/src/viam-cpp-sdk/build/install/* /usr/local/

# install appimage-builder
RUN apt install -y \
binutils \
coreutils \
desktop-file-utils \
fakeroot \
fuse \
libgdk-pixbuf2.0-dev \
patchelf \
python3-pip python3-setuptools \
squashfs-tools \
strace \
util-linux zsync

RUN pip3 install -U pip setuptools urllib3==1.26.12 requests==2.26.0

# install appimage-builder
RUN cd ${HOME}/opt/src && \
git clone https://github.com/AppImageCrafters/appimage-builder.git && \
cd appimage-builder && \
pip3 install ./

# install docker
RUN apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo \
"deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get -y update && \
apt-get -y install docker-ce docker-ce-cli containerd.io
1 change: 0 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ int serve(const std::string& socket_path) {

// Model registration
auto module_registration = std::make_shared<ModelRegistration>(
ResourceType{RESOURCE_TYPE},
Camera::static_api(),
Model{api_params.api_namespace, api_params.api_type, api_params.api_subtype},
[](Dependencies, ResourceConfig resource_config) -> std::shared_ptr<Resource> {
Expand Down

0 comments on commit 24be0ab

Please sign in to comment.