seacas icon indicating copy to clipboard operation
seacas copied to clipboard

Building Exodus on Windows with netCDF fails

Open LeeJP1983 opened this issue 4 years ago • 7 comments

Hello,

I am not sure if there is something I am missing, but I am trying to build Exodus on Windows. I am using x64 Native Tools Command Prompt for VS 2019 and CMake fails due to an execute_command(sh -c ...) call. (Hence my problem, as the Windows Command Prompt can't use sh.)

We're trying to do the CMake build and Visual Studio build in a single step and the tribits/common_tpl/FindNetCDF.cmake:276 fails because we can't run nc_config on Windows. Do you have any advice for how we might be able to do this? We had no issues doing this on Linux.

Thanks, Jerimiah

LeeJP1983 avatar Aug 05 '20 02:08 LeeJP1983

I am definitely not a windows programmer so have very little to offer as advise. The SEACAS system including Exodus is built on every commit on AppVeyor using the commands in the .appveyor.yml file. I would suggest looking at the cmake configuration used in that file and see if that helps.

If you do get a good build, please let me know how to improve the documentation.

gsjaardema avatar Aug 05 '20 13:08 gsjaardema

Thanks for the response Greg,

I'm using that to guide us.

Can you confirm if pthreads is supported for Windows?

-Jerimiah

LeeJP1983 avatar Aug 05 '20 20:08 LeeJP1983

I can neither confirm nor deny... Sorry, we don't typically run on Windows and only verify that the library will build and run some tests.

gsjaardema avatar Aug 06 '20 13:08 gsjaardema

Thanks Greg,

I'll keep at it for now. I was able to get a static library built, but the cmake install is creating a symlink to a .a file instead of the .lib file I would expect.

LeeJP1983 avatar Aug 06 '20 14:08 LeeJP1983

Here are a few notes of what I've had to do to build on Windows, without using MinGW:

CMAKE_BUILD_TYPE, the value for this variable, must be all caps, otherwise it will only build release. This is because TribitsGlobalMacros.cmake does a STREQUAL comparison. I would recommend that this be modified to do a case insensitive regex MATCHES.

In regards to pthreads, we can build with the following cmake variables: '-DCMAKE_C_FLAGS=-DHAVE_STRUCT_TIMESPEC -ID:/3rdpartylibs/pthreads/2.9.1/build/win64/include', '-DCMAKE_CXX_FLAGS=-DHAVE_STRUCT_TIMESPEC -ID:/3rdpartylibs/pthreads/2.9.1/build/win64/include'

The other issue is the use of the netCDF nc_config script. Instead of relying on the nc_config script to determine what dependencies are needed, I had to add all of the dependencies manually. That is, instead of setting NetCDF_ROOT, I instead had to set Netcdf_LIBRARY_DIRS, Netcdf_INCLUDE_DIRS and TPL_Netcdf_LIBRARIES. However we had to add slightly more than just netCDF and HDF5, as our HDF5 static library depends on szip and zlib, those libraries also had to be added in.

Thanks for the guidance.

LeeJP1983 avatar Aug 10 '20 14:08 LeeJP1983

I've discussed the CMAKE_BUILD_TYPE issue with the TriBITs developer (a wrapper around CMake used by SEACAS and Trilinos). His discussion is in https://github.com/TriBITSPub/TriBITS/issues/131

gsjaardema avatar Aug 13 '20 15:08 gsjaardema

Stale issue message

github-actions[bot] avatar Nov 06 '20 01:11 github-actions[bot]