DOI-BOR / ostrich

An optimization toolkit for model calibration
GNU General Public License v2.0
1 stars 1 forks source link

Makefile or CMake recipe for Windows? #42

Closed Zeitsperre closed 3 months ago

Zeitsperre commented 2 years ago

Hi there,

I've been working on a build of Ostrich for Windows on conda-forge (https://github.com/conda-forge/ostrich-feedstock/pull/2) and have run into some difficulties. If it's possible, I would like to know the following:

In the case that my approach is not compatible with Windows (ie: the Makefile does not support Windows), would it be possible for someone to generate a CMakeLists.txt for the last Ostrich release (i.e.: https://github.com/usbr/ostrich/releases/tag/v21.03.16)? This would help me out immensely (and would probably be much faster than patching the Makefile).

Thanks,

lsmatott commented 2 years ago

Hi Trevor,

It's been a long time since I built OSTRICH for Windows, but I never had any difficulty using MS Visual Studio (https://visualstudio.microsoft.com/vs/features/cplusplus/). It's been even longer since I did anything using Cygwin (I previously would use MinGW instead and now just use WSL2 for gcc builds on Windows), but I think you can install gcc suite for use with Cygwin. Depending on the compiler and version you end up using, I think you'll need either complete c++17 filesystem support (not developmental) or you'll need third-party filesystem libraries like those packaged with Boost.

--- L. Shawn Matott

From: Trevor James Smith @.> Sent: Tuesday, March 1, 2022 5:02 PM To: usbr/ostrich @.> Cc: Subscribed @.***> Subject: [usbr/ostrich] Makefile or CMake recipe for Windows? (Issue #42)

Hi there,

I've been working on a build of Ostrich for Windows on conda-forge (conda-forge/ostrich-feedstock#2https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fconda-forge%2Fostrich-feedstock%2Fpull%2F2&data=04%7C01%7Clsmatott%40buffalo.edu%7C1ecc7de2de4546acee3208d9fbcf0bd8%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637817688941408685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hdwqGntoXg%2F0b4wcsaGPQ2wwSyQRonN6rtT6ynmNG1w%3D&reserved=0) and have run into some difficulties. If it's possible, I would like to know the following:

In the case that my approach is not compatible with Windows (ie: the Makefile does not support Windows), would it be possible for someone to generate a CMakeLists.txt for the last Ostrich release (i.e.: https://github.com/usbr/ostrich/releases/tag/v21.03.16https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusbr%2Fostrich%2Freleases%2Ftag%2Fv21.03.16&data=04%7C01%7Clsmatott%40buffalo.edu%7C1ecc7de2de4546acee3208d9fbcf0bd8%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637817688941408685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=bvEbd0saDSDP6OzZPgbfifIjPlXE7nRakZJf8h5ozQc%3D&reserved=0)? This would help me out immensely (and would probably be much faster than patching the Makefile).

Thanks,

- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusbr%2Fostrich%2Fissues%2F42&data=04%7C01%7Clsmatott%40buffalo.edu%7C1ecc7de2de4546acee3208d9fbcf0bd8%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637817688941408685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pQ8p79gCa6vqYMC9ivXedqr42ulor9P8UVs744IHWII%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB6LJVFYA2KSOYZML6KBSFLU52HTXANCNFSM5PVIXT6A&data=04%7C01%7Clsmatott%40buffalo.edu%7C1ecc7de2de4546acee3208d9fbcf0bd8%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637817688941408685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=BJLpSiaryxpchC%2B%2FUwcxabJ85wqL0Z0qdHcBb6fen2Q%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Clsmatott%40buffalo.edu%7C1ecc7de2de4546acee3208d9fbcf0bd8%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637817688941408685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=X16hNsYUQLVuXbugq7e4MsExULJqFBAf5KNv5as%2Bpzo%3D&reserved=0 or Androidhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Clsmatott%40buffalo.edu%7C1ecc7de2de4546acee3208d9fbcf0bd8%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637817688941408685%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ldMJHBl3AuCFF0hkzsCIyXoUkWouvwTT7uRaff%2BM754%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

Zeitsperre commented 2 years ago

Hi Shawn, thanks for the response and the advice.

To give you a very quick overview, I have Ostrich nearly building in a dockerized environment with VC++, except for the calls to this Microsoft ActiveX Data Objects library. I do however have the option of setting the runtime to use MinGW with GCC, so I'll see if I can get it working with the GCC compiler. If this works, we'll have Windows builds for Ostrich installable via Anaconda!

lsmatott commented 2 years ago

Hi Trevor,

The msado library is needed for optional Access database integration ... it is for supporting models that store their output in Access databases. It may be simplest to just stub out the relevant code using an #ifdef ....

The relevant files are:

ADOConnection.cpp ADOConnection.h

The code currently uses _WIN32 to include/exclude the ADO functionality. You could add some #ifdef logic .... Something like the following ....

ifdef _WIN32

ifndef WIN32_DOCKER

/* import the dll, etc */

else

/* not supported, use Linux stubs */

endif

else

/* not supported, use Linux stubs */

endif

From: Trevor James Smith @.> Sent: Wednesday, March 2, 2022 2:07 PM To: usbr/ostrich @.> Cc: Loren Matott @.>; Comment @.> Subject: Re: [usbr/ostrich] Makefile or CMake recipe for Windows? (Issue #42)

Hi Shawn, thanks for the response and the advice.

To give you a very quick overview, I have Ostrich nearly building in a dockerized environment with VC++, except for the calls to this Microsoft ActiveX Data Objects library. I do however have the option of setting the runtime to use MinGW with GCC, so I'll see if I can get it working with the GCC compiler. If this works, we'll have Windows builds for Ostrich installable via Anaconda!

- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusbr%2Fostrich%2Fissues%2F42%23issuecomment-1057280396&data=04%7C01%7Clsmatott%40buffalo.edu%7C08c25f3e8e134ee0e28608d9fc7fe0fd%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637818448432830509%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Ju91qIGqMNVD8zSng5yfgMZPyJh1TVsVORnIIY51CeA%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB6LJVB7J6N5QHFKM2QSF7TU56355ANCNFSM5PVIXT6A&data=04%7C01%7Clsmatott%40buffalo.edu%7C08c25f3e8e134ee0e28608d9fc7fe0fd%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637818448432830509%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5ZDNFdpLZknhL3VsULo7r1qAHm%2F3tWjshjXx4DOZ02g%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Clsmatott%40buffalo.edu%7C08c25f3e8e134ee0e28608d9fc7fe0fd%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637818448432830509%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CcBMOSWPBhvufmyIIGiQAHEPbUJrN3ppJHSiqnxx17o%3D&reserved=0 or Androidhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Clsmatott%40buffalo.edu%7C08c25f3e8e134ee0e28608d9fc7fe0fd%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637818448432830509%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=hV%2BvQCabtOFEdVxLVkkm5Egi3tblBm7%2Fqwj8Tr%2BICqU%3D&reserved=0. You are receiving this because you commented.Message ID: @.**@.>>

dloney commented 2 years ago

Hi Trevor, Another option is to do the build against the dev branch. Right now the functionality is reduced, but the build should be platform independent. It depends on what algorithms you want access to. Right now it has coverage of the GA and LM methods.

Zeitsperre commented 2 years ago

I can't say for sure what we need for our projects (I only package and maintain), but I think the plan is for @julemai and I to tackle this together next month. Thanks again for all the help!

julemai commented 2 years ago

What we mainly need is DDS and SCE in this project. But I guess we can also implement @lsmatott's suggestion above to make it a clean implementation? Or is the "msado" functionality supposed to go away?

lsmatott commented 2 years ago

When I was at UW we used a Windows-based model of pharmaceuticals in surface water that stored its output in an Access database. So that's what motivated the ADO dependency. I seem to recall a couple models from my time at the EPA either read or wrote Access databases .... Maybe WASP and SWAT?

--- Shawn

From: Julie @.> Sent: Thursday, March 3, 2022 9:53 AM To: usbr/ostrich @.> Cc: Loren Matott @.>; Mention @.> Subject: Re: [usbr/ostrich] Makefile or CMake recipe for Windows? (Issue #42)

What we mainly need is DDS and SCE in this project. But I guess we can also implement @lsmatotthttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flsmatott&data=04%7C01%7Clsmatott%40buffalo.edu%7Cb68e33b5a72f4af04ee708d9fd257aad%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637819159684839332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pfC38A9x%2FX%2FR10F10jPApe4ky1jbD2502fQk6VfWlTQ%3D&reserved=0's suggestion above to make it a clean implementation? Or is the "msado" functionality supposed to go away?

- Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fusbr%2Fostrich%2Fissues%2F42%23issuecomment-1058120550&data=04%7C01%7Clsmatott%40buffalo.edu%7Cb68e33b5a72f4af04ee708d9fd257aad%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637819159684839332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8YE0lV%2FHVtegHGUkfc99RHLRdxyTpCNIkgoraRSwrpg%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB6LJVB67HCX5CJOTALOCBTU6DG33ANCNFSM5PVIXT6A&data=04%7C01%7Clsmatott%40buffalo.edu%7Cb68e33b5a72f4af04ee708d9fd257aad%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637819159684839332%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ajAAcHPqVqgfUHEIRxTV2qJdBXazY%2FcX3OqBjCLSZf8%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Clsmatott%40buffalo.edu%7Cb68e33b5a72f4af04ee708d9fd257aad%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637819159684995561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=egyLN5zDH%2B2xqW2z6cD6swv6ibcUjJsOUextIU7nfZo%3D&reserved=0 or Androidhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Clsmatott%40buffalo.edu%7Cb68e33b5a72f4af04ee708d9fd257aad%7C96464a8af8ed40b199e25f6b50a20250%7C0%7C0%7C637819159684995561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7421nmoH1nej7YnYmiI0dqdb8YvmifTuOwQcBS4Ylv4%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.**@.>>