From b242f1931be2b0e6ba631df345d2f89613a242e1 Mon Sep 17 00:00:00 2001 From: AskewParity Date: Tue, 16 Sep 2025 22:15:07 -0400 Subject: [PATCH 1/3] chore: pull prebuilt version of libtorch --- docker/Dockerfile.x86 | 56 +++++++------------------------------------ 1 file changed, 9 insertions(+), 47 deletions(-) diff --git a/docker/Dockerfile.x86 b/docker/Dockerfile.x86 index a4f5d98b..9216538f 100644 --- a/docker/Dockerfile.x86 +++ b/docker/Dockerfile.x86 @@ -86,50 +86,12 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \ ARG LIBTORCH_VERSION=2.1.0 ARG LIBTORCH_INSTALL_DIR=/libtorch-tmp WORKDIR ${LIBTORCH_INSTALL_DIR} -RUN git clone -b main --recurse-submodule https://github.com/pytorch/pytorch.git -RUN mkdir pytorch-build -RUN cd pytorch-build -RUN USE_CUDA=0 \ - USE_CUDNN=0 \ - USE_NCCL=0 \ - BUILD_TORCH=ON \ - USE_MKLDNN=0 \ - USE_ROCM=0 \ - USE_KINETO=0 \ - USE_NNPACK=1 \ - BUILD_CAFFE2_OPS=0 \ - BUILD_CAFFE2=0 \ - cmake \ - # don't need cuda, for now... - -DUSE_CUDA=0 \ - # disable cudnn - -DUSE_CUDNN=0 \ - # disable multigpu - -DUSE_NCCL=0 \ - -DBUILD_TORCH=ON \ - -DUSE_MKLDNN=0 \ - -DUSE_ROCM=0 \ - -DUSE_KINETO=0 \ - -DUSE_NNPACK=1 \ - -DBUILD_CAFFE2_OPS=0 \ - -DBUILD_CAFFE2=0 \ - -D_GLIBCXX_USE_CXX11_ABI=1 \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DPYTHON_EXECUTABLE:PATH=`which python3` \ - -DCMAKE_PREFIX_PATH=../pytorch-install \ - ${LIBTORCH_INSTALL_DIR}/pytorch -RUN USE_CUDA=0 \ - USE_CUDNN=0 \ - USE_NCCL=0 \ - BUILD_TORCH=ON \ - USE_MKLDNN=0 \ - USE_ROCM=0 \ - USE_KINETO=0 \ - USE_NNPACK=1 \ - BUILD_CAFFE2_OPS=0 \ - BUILD_CAFFE2=0 \ - cmake --build . --target install +WORKDIR /tmp +RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}%2Bcpu.zip \ + && unzip libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip \ + && mv libtorch ${LIBTORCH_INSTALL_DIR} \ + && rm libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip + ENV CMAKE_PREFIX_PATH="${LIBTORCH_INSTALL_DIR}/libtorch" @@ -143,7 +105,7 @@ RUN wget "https://github.com/pytorch/vision/archive/refs/tags/v${TORCHVISION_VER && mkdir -p "${TORCHVISION_INSTALL_DIR}/vision-${TORCHVISION_VERSION}/build" \ && cd "${TORCHVISION_INSTALL_DIR}/vision-${TORCHVISION_VERSION}/build" \ && cmake -DWITH_CUDA=off -D_GLIBCXX_USE_CXX11_ABI=1 -DCMAKE_BUILD_TYPE=Release .. \ - && make -j2 \ + && make -j$(nproc) \ && make install # install MAVSDK from source @@ -151,10 +113,10 @@ RUN git clone --depth 1 https://github.com/mavlink/MAVSDK.git --branch v2.9.1 -- && cd MAVSDK \ && git submodule update --init --recursive \ && cmake -DCMAKE_BUILD_TYPE=Release -Bbuild/default -H. \ - && cmake --build build/default -j2 --target install + && cmake --build build/default -j$(nproc) --target install RUN pip3 install gdown -ENV PATH="${PATH}:${HOME}/.local/bin" +ENV PATH="${PATH}:${HOME}/.local/binn" # login as non-root user USER $USERNAME From df4f7bfc6ec6e292edc8af031d7fd37113c5c960 Mon Sep 17 00:00:00 2001 From: AskewParity Date: Tue, 16 Sep 2025 22:15:42 -0400 Subject: [PATCH 2/3] chore: ensure that we use our version of protoc instead of another library's --- deps/protobuf/protobuf.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deps/protobuf/protobuf.cmake b/deps/protobuf/protobuf.cmake index b7e7215c..507e95c0 100644 --- a/deps/protobuf/protobuf.cmake +++ b/deps/protobuf/protobuf.cmake @@ -1,5 +1,7 @@ function(target_add_protobuf target_name) include(FindProtobuf) + set(PROTOBUF_LIBRARY /usr/lib/x86_64-linux-gnu/libprotobuf.so CACHE FILEPATH "System protobuf lib") + set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARY}) find_package(Protobuf REQUIRED) target_include_directories(${target_name} PRIVATE ${PROTOBUF_INCLUDE_DIR}) From 5807144c0806211a0c64c2697d86a6ff9e60b849 Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Thu, 18 Sep 2025 15:51:40 -0500 Subject: [PATCH 3/3] fix: protobuf dependency imports are architecture specific --- deps/protobuf/protobuf.cmake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/deps/protobuf/protobuf.cmake b/deps/protobuf/protobuf.cmake index 507e95c0..69d0f017 100644 --- a/deps/protobuf/protobuf.cmake +++ b/deps/protobuf/protobuf.cmake @@ -1,6 +1,22 @@ function(target_add_protobuf target_name) include(FindProtobuf) - set(PROTOBUF_LIBRARY /usr/lib/x86_64-linux-gnu/libprotobuf.so CACHE FILEPATH "System protobuf lib") + + # Find the appropriate protobuf library for the current architecture + find_library(PROTOBUF_LIBRARY + NAMES protobuf + PATHS /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/aarch64-linux-gnu /usr/lib/arm-linux-gnueabihf + NO_DEFAULT_PATH + ) + + # Fallback to system default search + if(NOT PROTOBUF_LIBRARY) + find_library(PROTOBUF_LIBRARY NAMES protobuf) + endif() + + if(NOT PROTOBUF_LIBRARY) + message(FATAL_ERROR "Could not find protobuf library") + endif() + set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARY}) find_package(Protobuf REQUIRED)