diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 759c47b..39ede37 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7bb514..46f592f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: diff --git a/.github/workflows/request.yml b/.github/workflows/request.yml index fd56a4b..d4d6fa0 100644 --- a/.github/workflows/request.yml +++ b/.github/workflows/request.yml @@ -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 }} diff --git a/Makefile b/Makefile index a7321be..b288114 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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) && \ diff --git a/etc/Dockerfile.base.l4t b/etc/Dockerfile.base.l4t new file mode 100644 index 0000000..3a153af --- /dev/null +++ b/etc/Dockerfile.base.l4t @@ -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 diff --git a/main.cpp b/main.cpp index 87fd641..8663d47 100644 --- a/main.cpp +++ b/main.cpp @@ -31,7 +31,6 @@ int serve(const std::string& socket_path) { // Model registration auto module_registration = std::make_shared( - 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 {