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

MSBuild errors #1

Closed
cpmessina opened this issue Sep 5, 2022 · 11 comments · Fixed by #5
Closed

MSBuild errors #1

cpmessina opened this issue Sep 5, 2022 · 11 comments · Fixed by #5
Labels
help wanted Extra attention is needed

Comments

@cpmessina
Copy link

cpmessina commented Sep 5, 2022

Windows 10 21H2
Visual Studio 2022
Python 3.10.6

After checking out the git and executing 'pip3 install .', I'm getting these warnings and error:

C:\PythonCDT>pip3 install .

Processing c:\pythoncdt
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: PythonCDT
  Building wheel for PythonCDT (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for PythonCDT (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [207 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
      -- CDT_USE_BOOST is OFF
      -- CDT_USE_AS_COMPILED_LIBRARY is OFF
      -- CDT_USE_64_BIT_INDEX_TYPE is OFF
      -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
      -- pybind11 v2.10.0 dev1
      -- Configuring done
      -- Generating done
      -- Build files have been written to: C:/PythonCDT/build/temp.win-amd64-cpython-310/Release
      MSBuild version 17.3.1+2badb37d1 for .NET Framework
        Checking Build System
        Building Custom Rule C:/PythonCDT/CMakeLists.txt
        cdt_bindings.cpp
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(1455,57): warning C4267: 'argument': conversion from 'size_t' to 'CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(232,1): warning C4267: 'argument': conversion from 'size_t' to '_Ty', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    _Ty=std::seed_seq::result_type
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(223): message : while compiling class template member function 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::eraseOuterTrianglesAndHoles(void)' [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\cdt_bindings.cpp(369): message : see reference to function template instantiation 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::eraseOuterTrianglesAndHoles(void)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\type_traits(521): message : see reference to class template instantiation 'CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\pybind11\include\pybind11\pybind11.h(1487): message : see reference to class template instantiation 'std::is_polymorphic<CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>>' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\cdt_bindings.cpp(171): message : see reference to class template instantiation 'pybind11::class_<Triangulation>' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.h(742,1): warning C4267: 'initializing': conversion from 'size_t' to 'CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\cdt_bindings.cpp(171): message : see reference to function template instantiation 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::insertVertices<const pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::XY*,pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_6ad45f0f664944f44da928d31c47e79e>,pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_b9f715ea712ccc6ec232ce2dcd6d9db2>>(const TVertexIter,const TVertexIter,TGetVertexCoordX,TGetVertexCoordY)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t,
                    TVertexIter=const pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::XY *,
                    TGetVertexCoordX=pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_6ad45f0f664944f44da928d31c47e79e>,
                    TGetVertexCoordY=pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_b9f715ea712ccc6ec232ce2dcd6d9db2>
                ]
      C:\PythonCDT\cdt_bindings.cpp(282): message : see reference to function template instantiation 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::insertVertices<const pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::XY*,pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_6ad45f0f664944f44da928d31c47e79e>,pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_b9f715ea712ccc6ec232ce2dcd6d9db2>>(const TVertexIter,const TVertexIter,TGetVertexCoordX,TGetVertexCoordY)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t,
                    TVertexIter=const pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::XY *,
                    TGetVertexCoordX=pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_6ad45f0f664944f44da928d31c47e79e>,
                    TGetVertexCoordY=pybind11_init_PythonCDT::<lambda_daed6c85c55980a9a6bf4dfbe830eb2b>::()::<lambda_b9f715ea712ccc6ec232ce2dcd6d9db2>
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(489,1): warning C4267: 'initializing': conversion from 'size_t' to 'CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(440): message : while compiling class template member function 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::insertEdge(CDT::Edge,CDT::Edge)' [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.h(769): message : see reference to function template instantiation 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::insertEdge(CDT::Edge,CDT::Edge)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(1436): message : while compiling class template member function 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::insertVertices(const std::vector<CDT::V2d<T>,std::allocator<CDT::V2d<T>>> &)' [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\cdt_bindings.cpp(369): message : see reference to function template instantiation 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::insertVertices(const std::vector<CDT::V2d<T>,std::allocator<CDT::V2d<T>>> &)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(489,1): warning C4267: 'initializing': conversion from 'size_t' to 'const CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(633,1): warning C4267: 'initializing': conversion from 'size_t' to 'CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(581): message : while compiling class template member function 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::conformToEdge(CDT::Edge,CDT::EdgeVec,CDT::BoundaryOverlapCount)' [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.h(791): message : see reference to function template instantiation 'void CDT::Triangulation<coord_t,CDT::LocatorKDTree<T,32,32,32>>::conformToEdge(CDT::Edge,CDT::EdgeVec,CDT::BoundaryOverlapCount)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(633,1): warning C4267: 'initializing': conversion from 'size_t' to 'const CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(694,1): warning C4267: 'initializing': conversion from 'size_t' to 'CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\CDT.hpp(694,1): warning C4267: 'initializing': conversion from 'size_t' to 'const CDT::VertInd', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\CDT\CDT\include\KDTree.h(249,1): warning C4267: 'initializing': conversion from 'size_t' to 'KDTree::KDTree<TCoordType,32,32,32>::node_index', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    TCoordType=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\KDTree.h(248): message : while compiling class template member function 'KDTree::KDTree<TCoordType,32,32,32>::node_index KDTree::KDTree<TCoordType,32,32,32>::addNewNode(void)' [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    TCoordType=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\KDTree.h(148): message : see reference to function template instantiation 'KDTree::KDTree<TCoordType,32,32,32>::node_index KDTree::KDTree<TCoordType,32,32,32>::addNewNode(void)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    TCoordType=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\LocatorKDTree.h(66): message : see reference to class template instantiation 'KDTree::KDTree<TCoordType,32,32,32>' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    TCoordType=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\CDT.h(411): message : see reference to class template instantiation 'CDT::LocatorKDTree<T,32,32,32>' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    T=coord_t
                ]
      C:\PythonCDT\CDT\CDT\include\KDTree.h(249,1): warning C4267: 'initializing': conversion from 'size_t' to 'const KDTree::KDTree<TCoordType,32,32,32>::node_index', possible loss of data [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    TCoordType=coord_t
                ]
      C:\PythonCDT\pybind11\include\pybind11\detail/init.h(79,40): error C2397: conversion from '_Ty' to 'T' requires a narrowing conversion [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    _Ty=int
                ]
                and
                [
                    T=coord_t
                ]
      C:\PythonCDT\pybind11\include\pybind11\detail/init.h(199): message : see reference to function template instantiation 'Class *pybind11::detail::initimpl::construct_or_initialize<CDT::V2d<coord_t>,_Ty,_Ty,0>(_Ty &&,_Ty &&)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    Class=CDT::V2d<coord_t>,
                    _Ty=int
                ]
      C:\PythonCDT\pybind11\include\pybind11\pybind11.h(1581): message : see reference to function template instantiation 'void pybind11::detail::initimpl::constructor<int,int>::execute<pybind11::class_<V2d>,pybind11::arg,pybind11::arg,0>(Class &,const pybind11::arg &,const pybind11::arg &)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    Class=pybind11::class_<V2d>
                ]
      C:\PythonCDT\pybind11\include\pybind11\pybind11.h(1583): message : see reference to function template instantiation 'void pybind11::detail::initimpl::constructor<int,int>::execute<pybind11::class_<V2d>,pybind11::arg,pybind11::arg,0>(Class &,const pybind11::arg &,const pybind11::arg &)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
                with
                [
                    Class=pybind11::class_<V2d>
                ]
      C:\PythonCDT\cdt_bindings.cpp(65): message : see reference to function template instantiation 'pybind11::class_<V2d> &pybind11::class_<V2d>::def<int,int,pybind11::arg,pybind11::arg>(const pybind11::detail::initimpl::constructor<int,int> &,const pybind11::arg &,const pybind11::arg &)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      C:\PythonCDT\cdt_bindings.cpp(95): message : see reference to function template instantiation 'pybind11::class_<V2d> &pybind11::class_<V2d>::def<int,int,pybind11::arg,pybind11::arg>(const pybind11::detail::initimpl::constructor<int,int> &,const pybind11::arg &,const pybind11::arg &)' being compiled [C:\PythonCDT\build\temp.win-amd64-cpython-310\Release\PythonCDT.vcxproj]
      Traceback (most recent call last):
        File "C:\Users\cmessina\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\Users\cmessina\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\cmessina\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\build_meta.py", line 412, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\build_meta.py", line 397, in _build_with_temp_dir
          self.run_setup()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 128, in <module>
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 973, in run_commands
          self.run_command(cmd)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 992, in run_command
          cmd_obj.run()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 992, in run_command
          cmd_obj.run()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 132, in run
          self.run_command(cmd_name)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 992, in run_command
          cmd_obj.run()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run
          _build_ext.run(self)
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
          self.build_extensions()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 466, in build_extensions
          self._build_extensions_serial()
        File "C:\Users\cmessina\AppData\Local\Temp\pip-build-env-by1_hn3a\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 492, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 121, in build_extension
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for PythonCDT
Failed to build PythonCDT
ERROR: Could not build wheels for PythonCDT, which is required to install pyproject.toml-based projects

Not sure where to go from here. Has the PythonCDT been tested under Windows, or just the main CDT code? Any suggestions for getting it to compile?

Ultimately, I'm interested in seeing if this can be utilized in Blender, and at this point I think I just need a Windows compiled version of the PythonCDT module.

Thanks!

@artem-ogre
Copy link
Owner

Thank you for opening the issue. I did not test it under Windows but it should work with some fixes. I will look into it.

artem-ogre added a commit that referenced this issue Nov 10, 2022
@artem-ogre
Copy link
Owner

Hi, sorry for the long response time. I removed the line generating an error (<rant/>which could be a warning IMHO).
Could you please verify that it compiles now?

@cpmessina
Copy link
Author

cpmessina commented Dec 4, 2022

It compiles now, however, several of the tests are failing:

================================================= test session starts =================================================
platform win32 -- Python 3.10.8, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\PythonCDT2, configfile: pyproject.toml
collected 13 items

cdt_bindings_test.py ..F..FFFFFFFF                                                                               [100%]

====================================================== FAILURES =======================================================
______________________________________________________ test_Edge ______________________________________________________

    def test_Edge() -> None:
        """Test Edge class"""
        e = cdt.Edge(1, 2)
        assert e.v1 == 1 and e.v2 == 2, "Constructed wrong edge"
        e = cdt.Edge(2, 1)
        assert e.v1 == 1 and e.v2 == 2, "Constructed wrong edge"
>       e = cdt.Edge(np.array([2, 1], dtype=np.uint32))
E       RuntimeError: Incompatible format: expected a CDT::VertInd array!

e          = Edge(1, 2)

cdt_bindings_test.py:41: RuntimeError
_____________________________________________ test_triangulate_input_file _____________________________________________

    def test_triangulate_input_file() -> None:
        vv, ee = read_input_file("CDT/visualizer/data/Constrained Sweden.txt")
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.RESOLVE, 0.0)
        t.insert_vertices(vv)
        t.insert_edges(ee)
        t.erase_outer_triangles_and_holes()
        with tempfile.TemporaryDirectory() as tmp_dir:
            off_file = f"{tmp_dir}/cdt.off"
            save_triangulation_as_off(t, off_file)
            with open(off_file, 'rb') as f:
>               assert hashlib.md5(f.read()).hexdigest() == '609d662d6628942c7cc7558f9d5ee952', "Wrong OFF file contents"
E               AssertionError: Wrong OFF file contents
E               assert '7b02de7f72a9...5a866580a7e51' == '609d662d6628...7558f9d5ee952'
E                 - 609d662d6628942c7cc7558f9d5ee952
E                 + 7b02de7f72a9f57895e5a866580a7e51

ee         = [Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 4), Edge(4, 5), Edge(5, 6), ...]
f          = <_io.BufferedReader name='C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpwlc0diz2/cdt.off'>
off_file   = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpwlc0diz2/cdt.off'
t          = <PythonCDT.Triangulation object at 0x000001EFA515C3F0>
tmp_dir    = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpwlc0diz2'
vv         = [V2d(16.8367, 56.8269), V2d(16.8281, 56.8253), V2d(16.8169, 56.8258), V2d(16.8083, 56.8242), V2d(16.785, 56.81), V2d(16.7794, 56.8058), ...]

cdt_bindings_test.py:141: AssertionError
________________________________________________ test_conform_to_edges ________________________________________________

    def test_conform_to_edges() -> None:
        vv, ee = read_input_file("CDT/visualizer/data/ditch.txt")
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.RESOLVE, 0.0)
        t.insert_vertices(vv)
        t.conform_to_edges(ee)
        t.erase_outer_triangles_and_holes()
        with tempfile.TemporaryDirectory() as tmp_dir:
            off_file = f"{tmp_dir}/cdt.off"
            save_triangulation_as_off(t, off_file)
            with open(off_file, 'rb') as f:
>               assert hashlib.md5(f.read()).hexdigest() == 'df2503c614e2f98656038948b355b27e', "Wrong OFF file contents"
E               AssertionError: Wrong OFF file contents
E               assert 'f67da8a5301b...3591a76af1c75' == 'df2503c614e2...38948b355b27e'
E                 - df2503c614e2f98656038948b355b27e
E                 + f67da8a5301b7a026f33591a76af1c75

ee         = [Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 4), Edge(5, 6), Edge(6, 7), ...]
f          = <_io.BufferedReader name='C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpw8v1j3w8/cdt.off'>
off_file   = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpw8v1j3w8/cdt.off'
t          = <PythonCDT.Triangulation object at 0x000001EFA591F770>
tmp_dir    = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpw8v1j3w8'
vv         = [V2d(15.2817, -35.8483), V2d(16.9298, -19.532), V2d(15.2817, 0.904469), V2d(17.5891, 18.0448), V2d(16.1058, 40.7062), V2d(-16.6915, -35.601), ...]

cdt_bindings_test.py:154: AssertionError
______________________________________________ test_insert_vertices[vv0] ______________________________________________

vv = [V2d(-1, 0), V2d(0, 0.5), V2d(1, 0), V2d(0, -0.5)]

    @pytest.mark.parametrize("vv", [[cdt.V2d(-1, 0), cdt.V2d(0, 0.5), cdt.V2d(1, 0), cdt.V2d(0, -0.5)],
                                    np.array([[-1, 0], [0, 0.5], [1, 0], [0, -0.5]], dtype=np.float64),
                                    np.array([-1, 0, 0, 0.5, 1, 0, 0, -0.5], dtype=np.float64)])
    def test_insert_vertices(vv) -> None:
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.IGNORE, 0.0)
        t.insert_vertices(vv)
        assert len(t.vertices) == 7, "Wrong vertex count in triangulation"
        assert len(t.triangles) == 9, "Wrong triangle count in triangulation"
        assert len(t.fixed_edges) == 0, "Wrong fixed edge count in triangulation"
        assert t.vertices_triangles, "Wrong vertices triangles count in triangulation"
        with tempfile.TemporaryDirectory() as tmp_dir:
            off_file = f"{tmp_dir}/cdt.off"
            save_triangulation_as_off(t, off_file)
            with open(off_file, 'rb') as f:
>               assert hashlib.md5(f.read()).hexdigest() == 'c424c4f2691dc3b9aabd39dcf2e17c53', "Wrong OFF file contents"
E               AssertionError: Wrong OFF file contents
E               assert '54ab6ccbc06d...9ca1e5c9c43c2' == 'c424c4f2691d...d39dcf2e17c53'
E                 - c424c4f2691dc3b9aabd39dcf2e17c53
E                 + 54ab6ccbc06dc8542b69ca1e5c9c43c2

f          = <_io.BufferedReader name='C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpkga1_kz_/cdt.off'>
off_file   = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpkga1_kz_/cdt.off'
t          = <PythonCDT.Triangulation object at 0x000001EFA5859430>
tmp_dir    = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpkga1_kz_'
vv         = [V2d(-1, 0), V2d(0, 0.5), V2d(1, 0), V2d(0, -0.5)]

cdt_bindings_test.py:171: AssertionError
______________________________________________ test_insert_vertices[vv1] ______________________________________________

vv = array([[-1. ,  0. ],
       [ 0. ,  0.5],
       [ 1. ,  0. ],
       [ 0. , -0.5]])

    @pytest.mark.parametrize("vv", [[cdt.V2d(-1, 0), cdt.V2d(0, 0.5), cdt.V2d(1, 0), cdt.V2d(0, -0.5)],
                                    np.array([[-1, 0], [0, 0.5], [1, 0], [0, -0.5]], dtype=np.float64),
                                    np.array([-1, 0, 0, 0.5, 1, 0, 0, -0.5], dtype=np.float64)])
    def test_insert_vertices(vv) -> None:
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.IGNORE, 0.0)
        t.insert_vertices(vv)
        assert len(t.vertices) == 7, "Wrong vertex count in triangulation"
        assert len(t.triangles) == 9, "Wrong triangle count in triangulation"
        assert len(t.fixed_edges) == 0, "Wrong fixed edge count in triangulation"
        assert t.vertices_triangles, "Wrong vertices triangles count in triangulation"
        with tempfile.TemporaryDirectory() as tmp_dir:
            off_file = f"{tmp_dir}/cdt.off"
            save_triangulation_as_off(t, off_file)
            with open(off_file, 'rb') as f:
>               assert hashlib.md5(f.read()).hexdigest() == 'c424c4f2691dc3b9aabd39dcf2e17c53', "Wrong OFF file contents"
E               AssertionError: Wrong OFF file contents
E               assert '54ab6ccbc06d...9ca1e5c9c43c2' == 'c424c4f2691d...d39dcf2e17c53'
E                 - c424c4f2691dc3b9aabd39dcf2e17c53
E                 + 54ab6ccbc06dc8542b69ca1e5c9c43c2

f          = <_io.BufferedReader name='C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpfc6txg8b/cdt.off'>
off_file   = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpfc6txg8b/cdt.off'
t          = <PythonCDT.Triangulation object at 0x000001EFA595D3F0>
tmp_dir    = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpfc6txg8b'
vv         = array([[-1. ,  0. ],
       [ 0. ,  0.5],
       [ 1. ,  0. ],
       [ 0. , -0.5]])

cdt_bindings_test.py:171: AssertionError
______________________________________________ test_insert_vertices[vv2] ______________________________________________

vv = array([-1. ,  0. ,  0. ,  0.5,  1. ,  0. ,  0. , -0.5])

    @pytest.mark.parametrize("vv", [[cdt.V2d(-1, 0), cdt.V2d(0, 0.5), cdt.V2d(1, 0), cdt.V2d(0, -0.5)],
                                    np.array([[-1, 0], [0, 0.5], [1, 0], [0, -0.5]], dtype=np.float64),
                                    np.array([-1, 0, 0, 0.5, 1, 0, 0, -0.5], dtype=np.float64)])
    def test_insert_vertices(vv) -> None:
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.IGNORE, 0.0)
        t.insert_vertices(vv)
        assert len(t.vertices) == 7, "Wrong vertex count in triangulation"
        assert len(t.triangles) == 9, "Wrong triangle count in triangulation"
        assert len(t.fixed_edges) == 0, "Wrong fixed edge count in triangulation"
        assert t.vertices_triangles, "Wrong vertices triangles count in triangulation"
        with tempfile.TemporaryDirectory() as tmp_dir:
            off_file = f"{tmp_dir}/cdt.off"
            save_triangulation_as_off(t, off_file)
            with open(off_file, 'rb') as f:
>               assert hashlib.md5(f.read()).hexdigest() == 'c424c4f2691dc3b9aabd39dcf2e17c53', "Wrong OFF file contents"
E               AssertionError: Wrong OFF file contents
E               assert '54ab6ccbc06d...9ca1e5c9c43c2' == 'c424c4f2691d...d39dcf2e17c53'
E                 - c424c4f2691dc3b9aabd39dcf2e17c53
E                 + 54ab6ccbc06dc8542b69ca1e5c9c43c2

f          = <_io.BufferedReader name='C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpf7v_nx62/cdt.off'>
off_file   = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpf7v_nx62/cdt.off'
t          = <PythonCDT.Triangulation object at 0x000001EFA59A7270>
tmp_dir    = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpf7v_nx62'
vv         = array([-1. ,  0. ,  0. ,  0.5,  1. ,  0. ,  0. , -0.5])

cdt_bindings_test.py:171: AssertionError
___________________________________________ test_insert_conform_edges[ee0] ____________________________________________

ee = [Edge(0, 1), Edge(2, 3), Edge(3, 4), Edge(5, 6)]

    @pytest.mark.parametrize("ee", [[cdt.Edge(0, 1), cdt.Edge(2, 3), cdt.Edge(3, 4), cdt.Edge(5, 6)],
                                    np.array([[0, 1], [2, 3], [3, 4], [5, 6]], dtype=np.uint32),
                                    np.array([0, 1, 2, 3, 3, 4, 5, 6], dtype=np.uint32)])
    def test_insert_conform_edges(ee) -> None:
        # insert edges
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.IGNORE, 0.0)
        t.insert_vertices(np.array([[0, 0], [4, 0], [5, 1], [2, 1], [-1, 1], [0, 2], [4, 2]], dtype=float))
        t.insert_edges(ee)
        assert len(t.vertices) == 10, "Wrong vertex count in triangulation"
        assert len(t.triangles) == 15, "Wrong triangle count in triangulation"
        assert len(t.fixed_edges) == 4, "Wrong fixed edge count in triangulation"
        assert t.vertices_triangles, "Wrong vertices triangles count in triangulation"
        with tempfile.TemporaryDirectory() as tmp_dir:
            off_file = f"{tmp_dir}/cdt.off"
            save_triangulation_as_off(t, off_file)
            with open(off_file, 'rb') as f:
>               assert hashlib.md5(f.read()).hexdigest() == '8424ba2c8f8ebabe1bea4141464a347b', "Wrong OFF file contents"
E               AssertionError: Wrong OFF file contents
E               assert '9505f58d9063...accb0a3602fd8' == '8424ba2c8f8e...a4141464a347b'
E                 - 8424ba2c8f8ebabe1bea4141464a347b
E                 + 9505f58d90636bc7e4caccb0a3602fd8

ee         = [Edge(0, 1), Edge(2, 3), Edge(3, 4), Edge(5, 6)]
f          = <_io.BufferedReader name='C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpb3efw4ug/cdt.off'>
off_file   = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpb3efw4ug/cdt.off'
t          = <PythonCDT.Triangulation object at 0x000001EFA59A81B0>
tmp_dir    = 'C:\\Users\\cmessina\\AppData\\Local\\Temp\\tmpb3efw4ug'

cdt_bindings_test.py:190: AssertionError
___________________________________________ test_insert_conform_edges[ee1] ____________________________________________

ee = array([[0, 1],
       [2, 3],
       [3, 4],
       [5, 6]], dtype=uint32)

    @pytest.mark.parametrize("ee", [[cdt.Edge(0, 1), cdt.Edge(2, 3), cdt.Edge(3, 4), cdt.Edge(5, 6)],
                                    np.array([[0, 1], [2, 3], [3, 4], [5, 6]], dtype=np.uint32),
                                    np.array([0, 1, 2, 3, 3, 4, 5, 6], dtype=np.uint32)])
    def test_insert_conform_edges(ee) -> None:
        # insert edges
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.IGNORE, 0.0)
        t.insert_vertices(np.array([[0, 0], [4, 0], [5, 1], [2, 1], [-1, 1], [0, 2], [4, 2]], dtype=float))
>       t.insert_edges(ee)
E       RuntimeError: Incompatible format: expected a CDT::VertInd array!

ee         = array([[0, 1],
       [2, 3],
       [3, 4],
       [5, 6]], dtype=uint32)
t          = <PythonCDT.Triangulation object at 0x000001EFA5916F30>

cdt_bindings_test.py:181: RuntimeError
___________________________________________ test_insert_conform_edges[ee2] ____________________________________________

ee = array([0, 1, 2, 3, 3, 4, 5, 6], dtype=uint32)

    @pytest.mark.parametrize("ee", [[cdt.Edge(0, 1), cdt.Edge(2, 3), cdt.Edge(3, 4), cdt.Edge(5, 6)],
                                    np.array([[0, 1], [2, 3], [3, 4], [5, 6]], dtype=np.uint32),
                                    np.array([0, 1, 2, 3, 3, 4, 5, 6], dtype=np.uint32)])
    def test_insert_conform_edges(ee) -> None:
        # insert edges
        t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.IGNORE, 0.0)
        t.insert_vertices(np.array([[0, 0], [4, 0], [5, 1], [2, 1], [-1, 1], [0, 2], [4, 2]], dtype=float))
>       t.insert_edges(ee)
E       RuntimeError: Incompatible format: expected a CDT::VertInd array!

ee         = array([0, 1, 2, 3, 3, 4, 5, 6], dtype=uint32)
t          = <PythonCDT.Triangulation object at 0x000001EFA58690B0>

cdt_bindings_test.py:181: RuntimeError
=============================================== short test summary info ===============================================
FAILED cdt_bindings_test.py::test_Edge - RuntimeError: Incompatible format: expected a CDT::VertInd array!
FAILED cdt_bindings_test.py::test_triangulate_input_file - AssertionError: Wrong OFF file contents
FAILED cdt_bindings_test.py::test_conform_to_edges - AssertionError: Wrong OFF file contents
FAILED cdt_bindings_test.py::test_insert_vertices[vv0] - AssertionError: Wrong OFF file contents
FAILED cdt_bindings_test.py::test_insert_vertices[vv1] - AssertionError: Wrong OFF file contents
FAILED cdt_bindings_test.py::test_insert_vertices[vv2] - AssertionError: Wrong OFF file contents
FAILED cdt_bindings_test.py::test_insert_conform_edges[ee0] - AssertionError: Wrong OFF file contents
FAILED cdt_bindings_test.py::test_insert_conform_edges[ee1] - RuntimeError: Incompatible format: expected a CDT::VertInd array!
FAILED cdt_bindings_test.py::test_insert_conform_edges[ee2] - RuntimeError: Incompatible format: expected a CDT::VertInd array!
============================================= 9 failed, 4 passed in 0.75s =============================================

@artem-ogre
Copy link
Owner

Hi, all interested! Unfortunately I don't have a working Windows environment and also have very little free time.
So I'm looking for help 🙂
Could someone perhaps create the reproducer with github actions or some other means?

@artem-ogre artem-ogre added the help wanted Extra attention is needed label Feb 23, 2024
@SioulisChris
Copy link

Hi, cpmessina. The first error has to do with how numpy works in windows. Please look at pybind and stackoverflow. Using dytpe=np.uintc instead of np.uint32 fixes the edge creation tests.

artem-ogre pushed a commit that referenced this issue Apr 15, 2024
@artem-ogre
Copy link
Owner

artem-ogre commented Apr 15, 2024

Hi, @SioulisChris Thank you very much for taking your time and providing the explanation.
Indeed, in CDT indices are defined as unsinged int because we can't assume uint32_t to be available on older platforms (pre c++11).
Would the proper fix be to use np.uintc everywhere in the tests? Could you please check out the fix branch?

@SioulisChris
Copy link

SioulisChris commented Apr 15, 2024

Yes, changing the dtype in cdt_bindings_test.py makes assertions valid.

The remaining issue is "Wrong OFF file contents" in Windows. I think that line 190 in cdt_bindings_test.py should be commented out. It hardcodes OFF file as "/tmp/cdt.off" which is problematic in Windows. Saving the triangulation is repeated afterwards in OS independent manner.

All the assertions with the hardcoded values fail. I guess the hash codes computed are machine related!

If I comment out the hash tests, the remaining tests pass.

@SioulisChris
Copy link

Changed the hash tests in Windows like this:
# with open(off_file, 'rb') as f:
# assert hashlib.md5(f.read()).hexdigest() == '9cb9dbaca4943ff0e3aab6c1d31f5a35', "Wrong OFF file contents"
with open(off_file, 'r') as f:
assert hashlib.md5(f.read().encode('utf-8')).hexdigest() == '9cb9dbaca4943ff0e3aab6c1d31f5a35', "Wrong OFF file contents"
and 13 tests pass. Can you check on MAC?

artem-ogre pushed a commit that referenced this issue Apr 16, 2024
@artem-ogre
Copy link
Owner

Thank you, I updated the branch. Does this work on Windows? It passes on Linux, and I don't have a mac to test on. When I get some time I will add GitHub actions for the three OSes.

@SioulisChris
Copy link

You also need to replace lines 181 & 182 with:
assert md5_checksum(off_file) == '8424ba2c8f8ebabe1bea4141464a347b', "Wrong OFF file contents"
Afterwards all tests pass.

artem-ogre pushed a commit that referenced this issue Apr 16, 2024
artem-ogre added a commit that referenced this issue Apr 16, 2024
artem-ogre added a commit that referenced this issue Apr 16, 2024
@artem-ogre artem-ogre linked a pull request Apr 16, 2024 that will close this issue
artem-ogre added a commit that referenced this issue Apr 16, 2024
@artem-ogre
Copy link
Owner

Again, thank you a lot for your help @SioulisChris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants