From ea1ee112818aea8f5341b5825214bbb42aea01f8 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Wed, 26 Nov 2025 14:35:11 +0000 Subject: [PATCH 1/2] build: remove portable install using nehalem, must use avx enabled CPU (2010+) --- .github/workflows/publish-docker.yaml | 2 +- .github/workflows/test-build-prs.yaml | 4 ++-- configure.sh | 14 -------------- gpu.Dockerfile | 13 +++++++------ portable.Dockerfile | 8 ++++---- snap/snapcraft.yaml | 6 ------ snap/snapcraft24.yaml | 6 ------ 7 files changed, 14 insertions(+), 39 deletions(-) diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml index 4aafa0265..7177a3bb6 100644 --- a/.github/workflows/publish-docker.yaml +++ b/.github/workflows/publish-docker.yaml @@ -39,7 +39,7 @@ jobs: id: docker_build uses: docker/build-push-action@v2 with: - file: ./portable.Dockerfile + file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true no-cache: true diff --git a/.github/workflows/test-build-prs.yaml b/.github/workflows/test-build-prs.yaml index 1656ba5c2..a9dc36231 100644 --- a/.github/workflows/test-build-prs.yaml +++ b/.github/workflows/test-build-prs.yaml @@ -20,10 +20,10 @@ jobs: - name: Build uses: docker/build-push-action@v2 with: - file: ./portable.Dockerfile + file: ./Dockerfile platforms: linux/amd64 push: false - + # snapcraft: # runs-on: ubuntu-latest # strategy: diff --git a/configure.sh b/configure.sh index b8653a95a..85245c479 100755 --- a/configure.sh +++ b/configure.sh @@ -140,26 +140,12 @@ installreqs() { # edt requires numpy to build venv/bin/pip install numpy==2.3.2 venv/bin/pip install -r requirements.txt --ignore-installed - #if [ ! -z "$GPU_INSTALL" ]; then - #fi set +e } install() { installreqs - if [ ! -z "$PORTABLE_INSTALL" ]; then - echo "Replacing g++ and gcc with our scripts for portability..." - if [ ! -e /usr/bin/gcc_real ]; then - sudo mv -v /usr/bin/gcc /usr/bin/gcc_real - sudo cp -v ./docker/gcc /usr/bin/gcc - fi - if [ ! -e /usr/bin/g++_real ]; then - sudo mv -v /usr/bin/g++ /usr/bin/g++_real - sudo cp -v ./docker/g++ /usr/bin/g++ - fi - fi - set -eo pipefail echo "Compiling SuperBuild" diff --git a/gpu.Dockerfile b/gpu.Dockerfile index bfd021b0e..68e2f89c5 100644 --- a/gpu.Dockerfile +++ b/gpu.Dockerfile @@ -3,7 +3,7 @@ FROM nvidia/cuda:13.0.0-devel-ubuntu24.04 AS builder # Env variables ENV DEBIAN_FRONTEND=noninteractive \ PYTHONPATH="/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" + LD_LIBRARY_PATH="/code/SuperBuild/install/lib" # Prepare directories WORKDIR /code @@ -12,7 +12,7 @@ WORKDIR /code COPY . ./ # Run the build -RUN PORTABLE_INSTALL=YES GPU_INSTALL=YES bash configure.sh install +RUN bash configure.sh install # Run the tests ENV PATH="/code/venv/bin:$PATH" @@ -30,7 +30,7 @@ FROM nvidia/cuda:13.0.0-devel-ubuntu24.04 # Env variables ENV DEBIAN_FRONTEND=noninteractive \ PYTHONPATH="/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" \ + LD_LIBRARY_PATH="/code/SuperBuild/install/lib" \ PDAL_DRIVER_PATH="/code/SuperBuild/install/bin" WORKDIR /code @@ -40,12 +40,13 @@ COPY --from=builder /code /code ENV PATH="/code/venv/bin:$PATH" -RUN apt-get update -y \ - && apt-get install -y ffmpeg libtbb2 # Install shared libraries that we depend on via APT, but *not* # the -dev packages to save space! # Also run a smoke test on ODM and OpenSfM -RUN bash configure.sh installruntimedepsonly \ +RUN apt-get update -y \ + # ffmpeg & libtbb2 needed for GPU build only + && apt-get install -y ffmpeg libtbb2 \ + && bash configure.sh installruntimedepsonly \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && bash run.sh --help \ diff --git a/portable.Dockerfile b/portable.Dockerfile index b0b2eba24..b6efcdc94 100644 --- a/portable.Dockerfile +++ b/portable.Dockerfile @@ -2,8 +2,8 @@ FROM ubuntu:24.04 AS builder # Env variables ENV DEBIAN_FRONTEND=noninteractive \ - PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" + PYTHONPATH="/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ + LD_LIBRARY_PATH="/code/SuperBuild/install/lib" # Prepare directories WORKDIR /code @@ -29,8 +29,8 @@ FROM ubuntu:24.04 # Env variables ENV DEBIAN_FRONTEND=noninteractive \ - PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" \ + PYTHONPATH="/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ + LD_LIBRARY_PATH="/code/SuperBuild/install/lib" \ PDAL_DRIVER_PATH="/code/SuperBuild/install/bin" WORKDIR /code diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0a4a8e032..f018f837a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -155,12 +155,6 @@ parts: override-build: | snapcraftctl set-version $(cat VERSION) - # Portable build - test -f /usr/bin/gcc_real || mv -v /usr/bin/gcc /usr/bin/gcc_real - test -f /usr/bin/gcc || cp -v ./docker/gcc /usr/bin/gcc - test -f /usr/bin/g++_real || mv -v /usr/bin/g++ /usr/bin/g++_real - test -f /usr/bin/g++ || cp -v ./docker/g++ /usr/bin/g++ - pip3 install --user -r requirements.txt # Build the SuperBuild libraries diff --git a/snap/snapcraft24.yaml b/snap/snapcraft24.yaml index d1f4a3001..9ea2a138b 100644 --- a/snap/snapcraft24.yaml +++ b/snap/snapcraft24.yaml @@ -157,12 +157,6 @@ parts: override-build: | snapcraftctl set-version $(cat VERSION) - # Portable build - test -f /usr/bin/gcc_real || mv -v /usr/bin/gcc /usr/bin/gcc_real - test -f /usr/bin/gcc || cp -v ./docker/gcc /usr/bin/gcc - test -f /usr/bin/g++_real || mv -v /usr/bin/g++ /usr/bin/g++_real - test -f /usr/bin/g++ || cp -v ./docker/g++ /usr/bin/g++ - pip3 install --user -r requirements.txt # Build the SuperBuild libraries From c474d539fb6c6472ce16a68d9f766d70d39e0355 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Wed, 26 Nov 2025 16:19:58 +0000 Subject: [PATCH 2/2] build: remove portable dockerfile + custom gcc and g++ impl --- docker/README | 3 --- docker/g++ | 17 -------------- docker/gcc | 17 -------------- portable.Dockerfile | 53 ------------------------------------------- snap/snapcraft21.yaml | 6 ----- 5 files changed, 96 deletions(-) delete mode 100644 docker/README delete mode 100755 docker/g++ delete mode 100755 docker/gcc delete mode 100644 portable.Dockerfile diff --git a/docker/README b/docker/README deleted file mode 100644 index 6843dac52..000000000 --- a/docker/README +++ /dev/null @@ -1,3 +0,0 @@ -The g++ and gcc scripts in this directory are used to replace the real g++ and gcc programs so that compilation across all projects (including dependencies) uses the -march=nehalem flag, which allows us to build a docker image compatible with most Intel based CPUs. - -Without the -march=nehalem flag, a docker image will contain binaries that are optimized for the machine that built the image, and will not run on older machines. diff --git a/docker/g++ b/docker/g++ deleted file mode 100755 index 33670a257..000000000 --- a/docker/g++ +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -declare -a args - -for i in "$@" -do - if [[ "$i" != -march* ]]; then - args+=("$i") - fi -done - -ARCH=nehalem -if [[ $(uname -m) == "aarch64" ]]; then - ARCH=armv8-a -fi - -/usr/bin/g++_real -march=$ARCH "${args[@]}" diff --git a/docker/gcc b/docker/gcc deleted file mode 100755 index 80183720e..000000000 --- a/docker/gcc +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -declare -a args - -for i in "$@" -do - if [[ "$i" != -march* ]]; then - args+=("$i") - fi -done - -ARCH=nehalem -if [[ $(uname -m) == "aarch64" ]]; then - ARCH=armv8-a -fi - -/usr/bin/gcc_real -march=$ARCH "${args[@]}" diff --git a/portable.Dockerfile b/portable.Dockerfile deleted file mode 100644 index b6efcdc94..000000000 --- a/portable.Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -FROM ubuntu:24.04 AS builder - -# Env variables -ENV DEBIAN_FRONTEND=noninteractive \ - PYTHONPATH="/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ - LD_LIBRARY_PATH="/code/SuperBuild/install/lib" - -# Prepare directories -WORKDIR /code - -# Copy everything -COPY . ./ - -# Run the build -RUN PORTABLE_INSTALL=YES bash configure.sh install - -# Run the tests -ENV PATH="/code/venv/bin:$PATH" -RUN bash test.sh - -# Clean Superbuild -RUN bash configure.sh clean - -### END Builder - -### Use a second image for the final asset to reduce the number and -# size of the layers. -FROM ubuntu:24.04 - -# Env variables -ENV DEBIAN_FRONTEND=noninteractive \ - PYTHONPATH="/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ - LD_LIBRARY_PATH="/code/SuperBuild/install/lib" \ - PDAL_DRIVER_PATH="/code/SuperBuild/install/bin" - -WORKDIR /code - -# Copy everything we built from the builder -COPY --from=builder /code /code - -ENV PATH="/code/venv/bin:$PATH" - -# Install shared libraries that we depend on via APT, but *not* -# the -dev packages to save space! -# Also run a smoke test on ODM and OpenSfM -RUN bash configure.sh installruntimedepsonly \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - && bash run.sh --help \ - && bash -c "eval $(python3 /code/opendm/context.py) && python3 -c 'from opensfm import io, pymap'" - -# Entry point -ENTRYPOINT ["python3", "/code/run.py"] diff --git a/snap/snapcraft21.yaml b/snap/snapcraft21.yaml index 299b579b8..f7109956d 100644 --- a/snap/snapcraft21.yaml +++ b/snap/snapcraft21.yaml @@ -155,12 +155,6 @@ parts: override-build: | snapcraftctl set-version $(cat VERSION) - # Portable build - test -f /usr/bin/gcc_real || mv -v /usr/bin/gcc /usr/bin/gcc_real - test -f /usr/bin/gcc || cp -v ./docker/gcc /usr/bin/gcc - test -f /usr/bin/g++_real || mv -v /usr/bin/g++ /usr/bin/g++_real - test -f /usr/bin/g++ || cp -v ./docker/g++ /usr/bin/g++ - pip3 install --user -r requirements.txt # Build the SuperBuild libraries