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

Compile a Windows Executable for the Coastal Dune Model #96

Open
micitz opened this issue Feb 5, 2021 · 10 comments
Open

Compile a Windows Executable for the Coastal Dune Model #96

micitz opened this issue Feb 5, 2021 · 10 comments

Comments

@micitz
Copy link

micitz commented Feb 5, 2021

Hello,

I am trying to make an executable for CDM to run on my Windows machine in the lab (Windows 10). The program is written in C++ and compiles fine as a Unix executable on my macbook, however I need to incorporate it into a larger model framework that requires Windows. A previous version of this model (link) has previously been compiled into a windows executable using Visual Studio so I know it has been done before but I can’t figure out how to do it (also I have no experience using Visual Studio). The github repository with the model source code is in the following link: (link). The model also requires the FFT headers found in this library: (link).

I had been trying to compile the model using Cygwin and mingw but kept running into an error regarding system headers that require linux: #include <sys/utsname.h> and #include <unistd.h> found in the main.cc file in the github repository.

If you know how to get this compiled into an .exe to run on windows or know a place that can help with that, that would be much appreciated!

Thanks,
Michael

@mdpiper
Copy link
Member

mdpiper commented Feb 5, 2021

@micitz @mcflugen has a fork and branch of the CDM repository where he builds the model with CMake (if you haven't used it, CMake is a wonderful tool that allows cross-platform builds) using conda to handle dependencies. I haven't tried it on Windows, but I think this would be a good place to start. Let me know how it goes; I'm not a Windows expert, but if you run into problems, I can try to help.

@mcflugen
Copy link
Member

mcflugen commented Feb 5, 2021

@micitz, @mdpiper beat me to it. Yes, have a look at my fork of the CDM. I've added some general instructions to the README file for building using conda. I've successfully built it on Mac and Linux but have not tried Windows.

@micitz
Copy link
Author

micitz commented Feb 9, 2021

Thanks for the help! I've gotten to the make -j4 step and now have problems with the make command specifically. I should note as well that I got this far by skipping the new virtualenv step which was causing issues finding packages that I already had installed, I don't know if that is what is now causing the issue.

I've tried some solutions including using minGW, GnuWin, and chocolatey but none of them have been successful they all cause the No targets specified and no makefile found error (for make -j4) and No rule to make target 'install' (for make install)

@mdpiper
Copy link
Member

mdpiper commented Feb 9, 2021

@micitz Note that the cmake build process is slightly different on Windows than what @mcflugen set up for Linux/macOS. Here's a simple example of a project that builds on Windows that I looked at recently.

@mcflugen
Copy link
Member

mcflugen commented Feb 9, 2021

@micitz Another issue is that neither unistd.h or utsname.h is available for Windows. Looking at the code, however, I'm not sure that anything from unistd.h is being used and the stuff from utsname.h looks like it can be safely commented out.

@mcflugen
Copy link
Member

@micitz See the above pull request. I've tried to update the code so it will build on Windows.

We should also set up continuous integration on the repository even if it just tests the builds but not the code itself.

@mcflugen
Copy link
Member

@micitz I've built a conda package for the Coastal Dune Model that is available for Linux, Mac, and Windows. I'll update the installation instructions in the README but it should be pretty straightforward.

First, from an Anaconda prompt, create a conda environment to run cdm in,

$ conda create -n cdm
$ conda activate cdm

Second, install the Coastal Dune Model from the conda-forge channel,

$ conda install coastal-dune-model -c conda-forge

This will install a new command, coastal-dune-model that you can run. I don't have a default.par file so I wasn't able to test it out. If you could point me to one, that would be great and I'll see if I can get at least a simple test together to make sure that it runs correctly on all platforms.

@micitz
Copy link
Author

micitz commented Feb 23, 2021 via email

@mcflugen
Copy link
Member

@micitz It's great to hear you were able to get it installed and (mostly) working! 🎉

Thanks in advance for sending the updated input file! It will be good to have at least some testing in place and to have an example input file for new users of the CDM-3.

@congxin1992
Copy link

congxin1992 commented Oct 25, 2023

Thanks. I tried this version of CDM 3.0. However, an error occurs 'ERROR: Required parameter 'Init-shore.alongshore_grad' not found!' There is a new parameter that was added in this version that needs to be put in the params file for it to work. I would appreciate it if @micitz @mcflugen could provide an example input file for its use. I can not find out the meaning of this symbol. Help~I set another 2 parameters, and then the example in CDM 2.0 was run successfully. Could anyone provide an introduction file of the input/output parameters for CDM and an example of Windsurf in MATLAB?
E-mail: [email protected]; [email protected]

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

No branches or pull requests

4 participants