Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Python bindings of manifpy on Windows and switch manif version to 0.0.5 #1701

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

traversaro
Copy link
Member

Remove workaround added in #838 (comment) .

@traversaro
Copy link
Member Author

Hopefully this will work out of the box, if not we can also try to update manif to 0.0.5, this was already tested in ami-iit/bipedal-locomotion-framework#874 .

@giotherobot
Copy link
Member

giotherobot commented Sep 4, 2024

Building on windows results in:
image
Sorry for image...

@traversaro
Copy link
Member Author

Ok, we see the same error in CI:

2024-09-04T10:31:21.0311241Z C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DEIGEN_DEFAULT_TO_ROW_MAJOR -Dmanifpy_EXPORTS -ID:\a\robotology-superbuild\robotology-superbuild\src\manif\include -ID:\a\robotology-superbuild\robotology-superbuild\src\manif\external\tl -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Include -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include\eigen3 -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG -std:c++17 /GL /bigobj /MP /showIncludes /Fopython\CMakeFiles\manifpy.dir\bindings_so2.cpp.obj /Fdpython\CMakeFiles\manifpy.dir\ /FS -c D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_so2.cpp
2024-09-04T10:31:21.0319107Z D:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include\pybind11/pybind11.h(1669): error C2661: 'pybind11::cpp_function::cpp_function': no overloaded function takes 8 arguments
2024-09-04T10:31:21.0323530Z D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_lie_group_base.h(5): note: see reference to function template instantiation 'pybind11::class_<manif::SO2d,manif::LieGroupBase<_Derived>> &pybind11::class_<manif::SO2d,manif::LieGroupBase<_Derived>>::def<manif::SO2<double>(__cdecl manif::SO2<double>::* )(const manif::LieGroupBase<_Derived> 

@traversaro
Copy link
Member Author

Let's try to update to 0.0.5 at this point.

@traversaro
Copy link
Member Author

Let's try to update to 0.0.5 at this point.

Done in 950214f . You can do it manually to test by switching the remote to https://github.com/artivis/manif and the tag to 0.0.5 .

@traversaro
Copy link
Member Author

Also with 0.0.5 the build fails with:

[6/9] Building CXX object python\CMakeFiles\manifpy.dir\bindings_rn.cpp.obj
FAILED: python/CMakeFiles/manifpy.dir/bindings_rn.cpp.obj 
C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DEIGEN_DEFAULT_TO_ROW_MAJOR -Dmanifpy_EXPORTS -ID:\a\robotology-superbuild\robotology-superbuild\src\manif\include -ID:\a\robotology-superbuild\robotology-superbuild\src\manif\external\tl -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Include -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include\eigen3 -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG -std:c++17 /GL /bigobj /MP /showIncludes /Fopython\CMakeFiles\manifpy.dir\bindings_rn.cpp.obj /Fdpython\CMakeFiles\manifpy.dir\ /FS -c D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_rn.cpp
D:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include\pybind11/pybind11.h(1669): error C2661: 'pybind11::cpp_function::cpp_function': no overloaded function takes 8 arguments
D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_lie_group_base.h(5): note: see reference to function template instantiation 'pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>> &pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>>::def<manif::Rn<double,1>(__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const,pybind11::arg,pybind11::arg_v,pybind11::arg_v,char[358]>(const char *,Func &&,const pybind11::arg &,const pybind11::arg_v &,const pybind11::arg_v &,const char (&)[358])' being compiled
        with
        [
            Func=manif::Rn<double,1> (__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const
        ]
D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_lie_group_base.h(104): note: see reference to function template instantiation 'pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>> &pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>>::def<manif::Rn<double,1>(__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const,pybind11::arg,pybind11::arg_v,pybind11::arg_v,char[358]>(const char *,Func &&,const pybind11::arg &,const pybind11::arg_v &,const pybind11::arg_v &,const char (&)[358])' being compiled
        with
        [
            Func=manif::Rn<double,1> (__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const
        ]
D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_rn.cpp(23): note: see reference to function template instantiation 'void wrap_lie_group_base<manif::R1d,manif::LieGroupBase<manif::R1d>>(pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>> &)' being compiled

ninja: build stopped: subcommand failed.

@traversaro
Copy link
Member Author

The only reference to a similar error I can find is emlearn/emlearn#40 .

@traversaro
Copy link
Member Author

Also with 0.0.5 the build fails with:

[6/9] Building CXX object python\CMakeFiles\manifpy.dir\bindings_rn.cpp.obj
FAILED: python/CMakeFiles/manifpy.dir/bindings_rn.cpp.obj 
C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DEIGEN_DEFAULT_TO_ROW_MAJOR -Dmanifpy_EXPORTS -ID:\a\robotology-superbuild\robotology-superbuild\src\manif\include -ID:\a\robotology-superbuild\robotology-superbuild\src\manif\external\tl -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Include -external:ID:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include\eigen3 -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG -std:c++17 /GL /bigobj /MP /showIncludes /Fopython\CMakeFiles\manifpy.dir\bindings_rn.cpp.obj /Fdpython\CMakeFiles\manifpy.dir\ /FS -c D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_rn.cpp
D:\a\robotology-superbuild\robotology-superbuild\.pixi\envs\default\Library\include\pybind11/pybind11.h(1669): error C2661: 'pybind11::cpp_function::cpp_function': no overloaded function takes 8 arguments
D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_lie_group_base.h(5): note: see reference to function template instantiation 'pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>> &pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>>::def<manif::Rn<double,1>(__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const,pybind11::arg,pybind11::arg_v,pybind11::arg_v,char[358]>(const char *,Func &&,const pybind11::arg &,const pybind11::arg_v &,const pybind11::arg_v &,const char (&)[358])' being compiled
        with
        [
            Func=manif::Rn<double,1> (__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const
        ]
D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_lie_group_base.h(104): note: see reference to function template instantiation 'pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>> &pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>>::def<manif::Rn<double,1>(__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const,pybind11::arg,pybind11::arg_v,pybind11::arg_v,char[358]>(const char *,Func &&,const pybind11::arg &,const pybind11::arg_v &,const pybind11::arg_v &,const char (&)[358])' being compiled
        with
        [
            Func=manif::Rn<double,1> (__cdecl manif::Rn<double,1>::* )(const manif::LieGroupBase<manif::R1d> &,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>,tl::optional<Eigen::Ref<Eigen::Matrix<double,1,1,1,1,1>,0,Eigen::InnerStride<1>>>) const
        ]
D:\a\robotology-superbuild\robotology-superbuild\src\manif\python\bindings_rn.cpp(23): note: see reference to function template instantiation 'void wrap_lie_group_base<manif::R1d,manif::LieGroupBase<manif::R1d>>(pybind11::class_<manif::R1d,manif::LieGroupBase<manif::R1d>> &)' being compiled

ninja: build stopped: subcommand failed.

I reported the problem upstream in artivis/manif#311, and tried to add a workaround in f064809 that relies on robotology/ycm-cmake-modules#461 .

@traversaro
Copy link
Member Author

Great, the solution worked great when using the Visual Studio generator and setting CMAKE_GENERATOR_TOOLSET to ClangCL, validating also robotology/ycm-cmake-modules#461 . The solution when ninja is usesd does not work as just passing the clang-cl.exe as C/C++ compiler CMake ends up picking the really old clang 5 that gets installed on Windows if you install the compilers meta package, via the old classic flang package. This is yet another thing that will be solved by conda-forge/conda-forge-pinning-feedstock#1359, but for now we can hardcode the path to the clang-cl shipped with visual studio (the same used by ClangCL's CMAKE_GENERATOR_TOOLSET) and hopefully everything should work.

@traversaro
Copy link
Member Author

traversaro commented Sep 5, 2024

Image for docs:

clangclinstall

clangclinstall2019

@traversaro
Copy link
Member Author

Great, the solution worked great when using the Visual Studio generator and setting CMAKE_GENERATOR_TOOLSET to ClangCL, validating also robotology/ycm-cmake-modules#461 . The solution when ninja is usesd does not work as just passing the clang-cl.exe as C/C++ compiler CMake ends up picking the really old clang 5 that gets installed on Windows if you install the compilers meta package, via the old classic flang package. This is yet another thing that will be solved by conda-forge/conda-forge-pinning-feedstock#1359, but for now we can hardcode the path to the clang-cl shipped with visual studio (the same used by ClangCL's CMAKE_GENERATOR_TOOLSET) and hopefully everything should work.

Ok, I did this and it seems to work.

@traversaro
Copy link
Member Author

Ok, I also added some docs in 7625d46, the PR is ready for review.

@traversaro traversaro changed the title Build Python bindings of manifpy on Windows Build Python bindings of manifpy on Windows and switch manif version to 0.0.5 Sep 5, 2024
@traversaro
Copy link
Member Author

fyi @GiulioRomualdi this changes the version of manif to 0.0.5, that has been already tested in blf CI in ami-iit/bipedal-locomotion-framework#874 .

@traversaro traversaro merged commit 6ae5ba0 into master Sep 5, 2024
29 checks passed
@traversaro traversaro deleted the enablemanifpywindows branch September 5, 2024 11:59
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.

3 participants