Skip to content

Support Windows pybind11 generation #532

@j-rivero

Description

@j-rivero

Desired behavior

Current code disable the python generation on Windows. If we enable the compilation, the following problem arises: Build Status

  Angle.cc
  AxisAlignedBox.cc
  Capsule.cc
C:\vcpkg\installed\x64-windows\include\pybind11\detail/type_caster_base.h(482,26): error C2027: use of undefined type '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\Capsule.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\Program Files\Python311\include\pytypedefs.h(22): message : see declaration of '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\Capsule.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\vcpkg\installed\x64-windows\include\pybind11\detail/type_caster_base.h(482,26): error C2027: use of undefined type '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\_gz_math_pybind11.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\Program Files\Python311\include\pytypedefs.h(22): message : see declaration of '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\_gz_math_pybind11.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\vcpkg\installed\x64-windows\include\pybind11\detail/type_caster_base.h(482,26): error C2027: use of undefined type '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\AxisAlignedBox.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\Program Files\Python311\include\pytypedefs.h(22): message : see declaration of '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\AxisAlignedBox.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\vcpkg\installed\x64-windows\include\pybind11\detail/type_caster_base.h(482,26): error C2027: use of undefined type '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\Angle.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
C:\Program Files\Python311\include\pytypedefs.h(22): message : see declaration of '_frame' (compiling source file C:\J\workspace\ign_math-pr-win\ws\gz-math\src\python_pybind11\src\Angle.cc) [C:\J\workspace\ign_math-pr-win\ws\build\gz-math7\test\FAKE_INSTALL-prefix\src\FAKE_INSTALL-build\src\python_pybind11\math7.vcxproj]
  Color.cc
  DiffDriveOdometry.cc
  Ellipsoid.cc
  Filter.cc

The buildfarm for Fortress and Garden uses the vcpkg formula pybind11:x64-windows 2.9.1 which seems to be the same version than in Ubuntu Jammy.

Implementation suggestion

Might be a problem with different versions of python mixed in the build: Python 3.11 coming from PATH and installed as a Windows system binary and Python 3.10 from vcpkg that supports well pybind11 2.9.

❯ grep -i python ~/Downloads/CMakeCache.txt  | grep '3[10,11]'
PYTHON_LIBRARY:FILEPATH=C:/vcpkg/installed/x64-windows/lib/python310.lib
FIND_PACKAGE_MESSAGE_DETAILS_PYTHON:INTERNAL=C:/Program Files/Python311/python.exe3.11.2
PYTHON_LIBRARIES:INTERNAL=C:/vcpkg/installed/x64-windows/lib/python310.lib
PYTHON_MODULE_EXTENSION:INTERNAL=.cp311-win_amd64.pyd
_Python3_EXECUTABLE:INTERNAL=C:/Program Files/Python311/python.exe
_Python3_INTERPRETER_PROPERTIES:INTERNAL=Python;3;11;2;64;;cp311-win_amd64;C:\Program Files\Python311\Lib;C:\Program Files\Python311\Lib;C:\Program Files\Python311\Lib\site-packages;C:\Program Files\Python311\Lib\site-packages
_Python3_LIBRARY_RELEASE:INTERNAL=C:/Program Files/Python311/libs/python311.lib
_Python3_RUNTIME_LIBRARY_RELEASE:INTERNAL=C:/Program Files/Python311/python311.dll

A possible test could be to pass GZ_PYTHON_VERSION (from gz-cmake) to be 3.10 and see if 3.11 is not in the mix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions