normals_Hough icon indicating copy to clipboard operation
normals_Hough copied to clipboard

Python wrapper does not compile under Windows out of the box

Open kad-vliegr opened this issue 4 years ago • 2 comments

The Python wrapper does not compile under Windows. In this fork I added some quick and dirty fixes you could maybe use.

The issues I encountered:

  • setup.py does not include the numpy's include directory.
  • The compile flags specified in setup.py only apply to GCC, not to MSVC.
  • MSVC's math.h does not define M_PI unless _USE_MATH_DEFINES is defined.
  • The typedef kd_tree uses the matrix type Eigen::MatrixX3d. This results in the KDTreeEigenMatrixAdaptor's IndexType to be __int64 under MSVC. In MSVC, long int cannot be converted to __int64 and resulted in type errors at places where knnSearch() and list_of_triplets() were called. I solved this by introducing a typedef pointIdxType which is __int64 when using MSVC and long int otherwise.

kad-vliegr avatar Nov 25 '20 10:11 kad-vliegr

Hello, Thanks a lot for sharing the fix for Windows.

aboulch avatar Apr 01 '21 08:04 aboulch

Hi, is it possible to compile using MinGW in windows? I got two errors during compiling

C:/mingw/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cmath:1085:11: error: '::copysign' has not been declared
   using ::copysign;
           ^~~~~~~~
In file included from C:/mingw/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/sys/stat.h:26,
                 from C:\Python3.7\include/pyport.h:224,
                 from C:\Python3.7\include/Python.h:63,
                 from src\NormalEstimatorHough.cpp:4:
C:/mingw/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/sys/types.h:68:16: error: conflicting declaration 'typedef _pid_t pid_t'
 typedef _pid_t pid_t;
                ^~~~~
In file included from C:\Python3.7\include/Python.h:8,
                 from src\NormalEstimatorHough.cpp:4:
C:\Python3.7\include/pyconfig.h:187:13: note: previous declaration as 'typedef int pid_t'
 typedef int pid_t;

sean85914 avatar May 06 '22 15:05 sean85914