SCIInstitute / ShapeWorks

ShapeWorks
http://sciinstitute.github.io/ShapeWorks/
Other
104 stars 32 forks source link

build_dependencies can't build in Debug or RelWithDebInfo on Windows #449

Closed akenmorris closed 4 years ago

akenmorris commented 4 years ago

We've made significant progress in the branch try_windows_debug:

https://github.com/SCIInstitute/ShapeWorks/tree/try_windows_debug

At this point, VTK won't build with Debug or RelWithDebInfo:

D:\a\bdeps\vtk\ThirdParty\netcdf\vtknetcdf\libsrc4\nc4hdf.c(3638,25): error C2177: constant too big

I found this:

http://vtk.1045678.n5.nabble.com/Trouble-compiling-VTK-7-1-0-with-MSVC-2015-td5742220.html

They suggest, "I suspect that cmake did not find the Windows SDK", which doesn't really make any sense.

After several hours working on this, I'm giving up and suggesting that if developers want to build in Debug mode that they use either Mac or Linux (or take up where Oleks and I left off with this branch). I'm just creating the issue to document the status and progress.

medakk commented 4 years ago

FWIW, it looks like nc4hdf.c is moved to a different folder in the current version of VTK, from https://github.com/Kitware/VTK/tree/master/ThirdParty/netcdf/vtknetcdf/libsrc4 to https://github.com/Kitware/VTK/blob/master/ThirdParty/netcdf/vtknetcdf/libhdf5 and its smaller than the original (number of lines).

It might be worth trying it out with a newer version of VTK.

akenmorris commented 4 years ago

From nc4internal.h:

ifdef WIN32 / Windows, of course, has to be a little different. /

define X_FLOAT_MAX 3.402823466e+38f

else

define X_FLOAT_MAX 3.40282347e+38f

endif / WIN32 /

define X_FLOAT_MIN (-X_FLOAT_MAX)

define X_DOUBLE_MAX 1.7976931348623157e+308

define X_DOUBLE_MIN (-X_DOUBLE_MAX)

Perhaps for some reason this file is being parsed without WIN32 when on Debug/RelWithDebInfo

medakk commented 4 years ago

That may be, VS 2015 defines _WIN32, not WIN32

https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?redirectedfrom=MSDN&view=vs-2019

akenmorris commented 4 years ago

I can't imagine it should differ between Release and RelWithDebInfo (or Debug)

akenmorris commented 4 years ago

Working now. Adding -DWIN32 for the VTK build fixed it. The GitHub action does not work because the rest of the script for packaging assumes a Release build. I don't think there's much reason to deploy debug builds, so I won't worry about that. But we should probably add a "--debug" option to build_dependencies.sh for windows.

@0leks

prafulag commented 4 years ago

Thanks @akenmorris and @medakk! This is very helpful!

akenmorris commented 4 years ago

This was completed. Debut builds for all!

cchriste commented 4 years ago

I am unable to build a Debug build for Windows. Since issue #466 is still open, I'll add more there.

akenmorris commented 4 years ago

Apparently debug was working until we started using the libraries from conda (for OpenVDB). I think the main issue is that you typically can't mix Debug and Release stuff on Windows because they use a different C++ runtime. Some libraries like Qt will ship with both (the debug ones have a 'd' suffix). I could not find any way to ask conda to install debug versions of these libraries, so at this point I don't know how to build debug on windows.