Skip to content

Add Windows (win-64) build support for ORB-SLAM2#2

Open
margauxmedwards wants to merge 6 commits into
VSLAM-LAB:mainfrom
margauxmedwards:windows-build
Open

Add Windows (win-64) build support for ORB-SLAM2#2
margauxmedwards wants to merge 6 commits into
VSLAM-LAB:mainfrom
margauxmedwards:windows-build

Conversation

@margauxmedwards

Copy link
Copy Markdown

Summary

Adds Windows (win-64) build support for ORB-SLAM2-VSLAM-LAB, along with supporting infrastructure (pixi environment, GitHub Actions workflow, and updated pangolin submodule).

Changes

ORB-SLAM2-VSLAM-LAB/recipe.yaml

  • Removed skip: win; added Windows-specific cmd.exe build script
  • Builds DBoW2, g2o, and ORB-SLAM2 separately as MSVC static/shared libs
  • Uses -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON and /bigobj /Zm200 flags
  • Linux-only host deps (X11, GL, wayland) gated behind if: linux
  • Replaced fontan::pangolin + opencv with pangolin + libopencv from conda-forge

Windows patches (new)

Patch Purpose
fix-win-stdint-gcc.patch Replace GCC-only <stdint-gcc.h> in DBoW2
fix-win-orbslam2-stdint-gcc.patch Same fix for ORBmatcher.cc
fix-win-mappoint-vla.patch Replace GCC VLA with vector<vector<float>>
fix-win-g2o-tr1-unordered-map.patch Replace std::tr1 types with C++11 equivalents
fix-win-g2o-posix-compat.patch POSIX compatibility for g2o on MSVC
fix-win-g2o-vasprintf.patch Provide vasprintf shim for MSVC
fix-win-find-threads.patch Fix CMake thread-finding on Windows
fix-win-orbslam2-posix.patch POSIX compatibility for ORB-SLAM2 on MSVC
fix-win-orbslam2-link-thirdparty.patch Fix linker paths for DBoW2/g2o on Windows
fix-win-thirdparty-static-libs.patch Build thirdparty libs as static on Windows

Infrastructure

  • pixi.toml + pixi.lock: pixi environment with rattler-build, cmake, ninja
  • .github/workflows/rattler-build.yml: CI workflow for Windows builds
  • pangolin-feedstock submodule: updated to include Windows recipe (recipe.yaml)
  • conda_build_config.yaml: minor updates

Testing

Successfully built and packaged on Windows with pixi run build-orbslam2:

  • Compiler: MSVC 19.44 (VS2022)
  • Output: orbslam2-vslamlab-1.0-hf29b281_0.conda
  • All rattler-build tests passed

## Summary

Adds Windows (win-64) build support for the Pangolin conda package by introducing a `recipe/recipe.yaml` in rattler-build format alongside the existing conda-build `meta.yaml`.

## Changes

### `recipe/recipe.yaml` (new)
- rattler-build recipe with platform-split build scripts:
  - **Windows**: uses `cmd.exe` with `cl.exe` (MSVC/VS2022), installs to `%PREFIX%\Library`, disables OpenEXR, video, and examples
  - **Linux/macOS**: uses the existing shell build approach
- Windows-only host deps (wayland, Python, setuptools excluded on Windows)
- `CMAKE_PREFIX_PATH` set correctly for Windows (`%PREFIX%\Library`)

### `recipe/build.sh`
- Removed Python executable flags (`-DPython_EXECUTABLE`, etc.)
- Added `BUILD_PANGOLIN_PYTHON=OFF` and `CMAKE_DISABLE_FIND_PACKAGE_Python(3)=ON` to avoid picking up system Python on non-Windows

### `recipe/meta.yaml`
- Removed `python`, `pybind11`, and `python` run dep (Python bindings disabled)

### `recipe/conda_build_config.yaml`
- Removed (sysroot path-replacement config no longer needed)

## Testing

Successfully built and packaged on Windows with `pixi run build-pangolin`:
- Compiler: MSVC 19.44 (VS2022)
- Output: `pangolin-2024.07.03-haab3175_0.conda` (32.68 MiB, 244 files)
- All rattler-build tests passed
Copilot AI review requested due to automatic review settings May 25, 2026 01:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Windows (win-64) build support for the ORB-SLAM2-VSLAM-LAB conda recipe, plus supporting developer/CI infrastructure (pixi + GitHub Actions) and a pangolin feedstock submodule to provide a Windows-capable pangolin package.

Changes:

  • Add a Windows-specific build script path for ORB-SLAM2 (including third-party builds) and adjust dependencies to use conda-forge pangolin + libopencv.
  • Introduce a set of Windows/MSVC compatibility patches for ORB-SLAM2, DBoW2, and g2o.
  • Add pixi environment/lockfile and a CI workflow to build pangolin + ORB-SLAM2 on Linux and Windows.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pixi.toml Adds a Windows pixi workspace and tasks to build pangolin and ORB-SLAM2 via rattler-build.
pixi.lock Pins pixi environment dependencies for reproducible Windows builds.
ORB-SLAM2-VSLAM-LAB/recipe.yaml Enables Windows builds, adds patches, updates deps (pangolin/libopencv), and adjusts license file path.
ORB-SLAM2-VSLAM-LAB/fix-win-thirdparty-static-libs.patch Forces static builds for DBoW2/g2o on Windows to avoid DLL export issues.
ORB-SLAM2-VSLAM-LAB/fix-win-stdint-gcc.patch Replaces GCC-specific <stdint-gcc.h> include with <cstdint> in DBoW2.
ORB-SLAM2-VSLAM-LAB/fix-win-orbslam2-stdint-gcc.patch Replaces GCC-specific <stdint-gcc.h> include with <cstdint> in ORB-SLAM2.
ORB-SLAM2-VSLAM-LAB/fix-win-orbslam2-posix.patch Adds a small Windows compatibility header and removes Linux-only sysinfo includes.
ORB-SLAM2-VSLAM-LAB/fix-win-orbslam2-link-thirdparty.patch Adjusts Windows linking for third-party libs.
ORB-SLAM2-VSLAM-LAB/fix-win-mappoint-vla.patch Removes a GCC VLA usage in MapPoint.cc by switching to nested vectors.
ORB-SLAM2-VSLAM-LAB/fix-win-g2o-vasprintf.patch Adds an MSVC-friendly vasprintf replacement in g2o utilities.
ORB-SLAM2-VSLAM-LAB/fix-win-g2o-tr1-unordered-map.patch Replaces TR1 types with C++11 equivalents in g2o.
ORB-SLAM2-VSLAM-LAB/fix-win-g2o-posix-compat.patch Tweaks platform detection and POSIX-related includes/behavior for MSVC.
ORB-SLAM2-VSLAM-LAB/fix-win-find-threads.patch Adds find_package(Threads REQUIRED) to improve CMake thread discovery.
conda_build_config.yaml Switches Windows x86_64 compiler selection to vs2022.
.gitmodules Adds pangolin-feedstock submodule pointing at a Windows-build branch.
.gitignore Ignores build output/ directories.
.github/workflows/rattler-build.yml Adds CI jobs to build pangolin and ORB-SLAM2 on Linux and Windows via rattler-build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 9 to +13
source:
- git: https://github.com/VSLAM-LAB/ORB-SLAM2-VSLAM-LAB
rev: 053f26faded2f824ff5297a09fa5a03e19c1a4ae
target_directory: src
patches:
@@ -0,0 +1,12 @@
diff --git a/Thirdparty/DBoW2/DBoW2/FORB.cpp b/Thirdparty/DBoW2/DBoW2/FORB.cpp
@@ -0,0 +1,11 @@
diff --git a/src/ORBmatcher.cc b/src/ORBmatcher.cc
@@ -0,0 +1,28 @@
diff --git a/src/MapPoint.cc b/src/MapPoint.cc
Comment on lines +30 to +38
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
if [ -n "$GH_PAT" ]; then
git config --global url."https://${GH_PAT}@github.com/".insteadOf "https://github.com/"
git submodule update --init --depth=1 pangolin-feedstock
else
echo "::warning::GH_PAT not set — skipping pangolin submodule checkout"
fi
- name: Install rattler-build
uses: prefix-dev/rattler-build-action@v0.2.19
with:
rattler-build-version: "0.36.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants