diff --git a/deps/protobuf/protobuf.cmake b/deps/protobuf/protobuf.cmake index b7e7215c..69d0f017 100644 --- a/deps/protobuf/protobuf.cmake +++ b/deps/protobuf/protobuf.cmake @@ -1,5 +1,23 @@ function(target_add_protobuf target_name) include(FindProtobuf) + + # 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) target_include_directories(${target_name} PRIVATE ${PROTOBUF_INCLUDE_DIR}) 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