Skip to content

Windows build fixes - #2062

Closed
monch999 wants to merge 8 commits into
OpenDroneMap:masterfrom
monch999:windows-build-fixes
Closed

Windows build fixes#2062
monch999 wants to merge 8 commits into
OpenDroneMap:masterfrom
monch999:windows-build-fixes

Conversation

@monch999

@monch999 monch999 commented Aug 4, 2026

Copy link
Copy Markdown

No description provided.

monch999 and others added 8 commits July 5, 2026 23:19
LAStools sources are Windows-1252 encoded and contain non-ASCII bytes in
char literals (e.g. an en dash 0x96 in lasmerge.cpp). MSVC parses source
files using the system codepage by default, so on locales like Chinese
(codepage 936) the byte is treated as a DBCS lead byte, swallowing the
closing quote and failing the build with C2015/C2001/C2143 errors.

Compile LAStools with /source-charset:.1252 and /execution-charset:.1252
so parsing matches the encoding the sources were written in, regardless
of the build machine locale.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On Windows the SuperBuild OpenCV installs its CMake config under
x64/vc17/lib, but OpenMVS was given the Linux-style lib/cmake/opencv4
path (which does not exist there) and odm_orthophoto received no
OpenCV_DIR at all. find_package(OpenCV) then falls back to the standard
search, which derives prefixes from the PATH environment variable, so
any unrelated OpenCV install on the build machine can be picked up and
either fail to configure or silently link the wrong version.

Pass an explicit, per-platform OpenCV_DIR to both projects, matching
what External-OpenSfM.cmake already does.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
OpenMVS_MAX_CUDA_COMPATIBILITY derives -gencode flags by zipping the
output of nvcc --list-gpu-arch and --list-gpu-code. With CUDA 12.9 the
two lists no longer line up (12.9 introduced family-specific codes), so
the generated flags pair mismatched entries and nvcc aborts with
"Unknown arch name 'sass_90'".

Turn the option off and pass CMAKE_CUDA_ARCHITECTURES explicitly,
covering Pascal through Blackwell (61/75/86/89/90 real + 120 with PTX
for forward compatibility), using LIST_SEPARATOR to carry the list
through ExternalProject_Add.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
OpenCV's python detection cannot always locate the base interpreter's
headers and import library from a venv python on Windows (e.g. when the
venv was created from an Anaconda install). PYTHON3_INCLUDE_DIR and
PYTHON3_LIBRARY come up empty, PYTHON3LIBS_FOUND stays false, and the
cv2 module is silently skipped -- the build succeeds but "import cv2"
fails at runtime.

Query the venv interpreter for its base include directory and
pythonXY.lib and pass both explicitly, converting to forward slashes
since backslashes break CMake string parsing in target_link_libraries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
libavif is not part of the vcpkg dependency set, but OpenCV's
find_package can still discover a stray copy on the build machine (e.g.
Anaconda's Library tree, reachable through PATH-derived config search)
and link it into opencv_imgcodecs. The build then works on the build
machine but the shipped binaries fail to load on end-user machines with
a missing avif.dll.

Pass WITH_AVIF=OFF explicitly so the produced binaries only depend on
libraries that are actually bundled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Records the full native Windows build of ODM 3.6.0 on a Chinese-locale
machine: environment versus what CI assumes, the build and packaging
commands, and the nine problems hit along the way with their root
causes and fixes. Also covers how to force-rebuild a single SuperBuild
external project and how to verify an installer is self-contained.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Windows setup ships an embedded Python build with its ._pth file
removed (so that pyvenv.cfg is honored). A side effect is that without
a ._pth, python.exe falls back to reading
HKLM/HKCU\Software\Python\PythonCore\3.12\PythonPath from the registry
and merges those entries into sys.path.

On any end-user machine that has a registered Python 3.12 install
(python.org, Anaconda, etc.), the registered Lib/ and DLLs/ directories
take part in module resolution, so stdlib extension modules such as
_ctypes.pyd get loaded from the foreign install while their dependent
DLLs are not on the search path. ODM then crashes on startup with
"ImportError: DLL load failed" as soon as opendm.vmem imports ctypes.

Fix: write a python312._pth next to the embedded python.exe during
post-install. When a ._pth is present, sys.path is fully defined by the
file and both registry entries and PYTHONPATH/PYTHONHOME are ignored.
The file lists the embedded stdlib zip, the embed directory itself, the
ODM install root and the venv site-packages, which is exactly the set
of paths ODM needs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The registry PythonPath fix now rides on this branch as a cherry-pick of
the commit that carries the upstream PR, so the earlier warning about
packaging from this branch no longer applies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MJohnson459

Copy link
Copy Markdown
Contributor

Thanks for contributing but we can't accept entirely AI generated output. Some of the fixes I'm sure are valid but others will break Linux etc. If you can untangle these fixes you are welcome to put a PR up of them individually with a description for why they are needed.

@MJohnson459 MJohnson459 closed this Aug 4, 2026
@MJohnson459

Copy link
Copy Markdown
Contributor

Something to keep in mind is we will be moving the build system to pixi imminently so you can always try that for the windows build. #2037

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