Windows build fixes - #2062
Closed
monch999 wants to merge 8 commits into
Closed
Conversation
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>
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. |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.