FloatingArrayDesign / MoorDyn

a lumped-mass mooring line model intended for coupling with floating structure codes
BSD 3-Clause "New" or "Revised" License
66 stars 37 forks source link

Figuring out how to proceed on Windows #135

Closed sanguinariojoe closed 9 months ago

sanguinariojoe commented 10 months ago

Windows is the worst, because is designed by the monkeys of the monkeys for the monkeys. Unfortunately we shall deal with it, offering a Windows way of life for people wanting to use MoorDyn (i.e. not spending much neurons on the task).

The Python solution is on its way:

https://github.com/FloatingArrayDesign/MoorDyn/pull/132

But on C we have some problems... Mainly because MinGW and MSVC are not compatible. Each one has its merits...

Thus, I suggest to change the documentation:

Can any of you, @RyanDavies19 or @AlexWKinley, try out the Windows installer? it is a bit outdated, but shall be functional anyway

RyanDavies19 commented 10 months ago

@sanguinariojoe I am on MacOS so I can't. However someone from the WECSim team has compiled for windows using CMake (with the Matlab wrapper). He said it worked fine once he disabled the Fortran and Python wrappers. @mattEhall if you have some time could you give the window compiling with cmake as well as the installer a shot?

AlexWKinley commented 10 months ago

Trying out the windows installer I've thus far run into 2 strange issues.

Firstly, during the install process, when I ask it to add MoorDyn to the system path the installer throws an error that the system path is too long, and it can't add to it. Screenshot 2023-09-21 125326

I'm certainly able to add to the path myself, so I'm not sure what's the cause of this error.

The next issue I ran into when trying to use the installed MoorDyn was that it wanted the moordynf.lib file but it didn't exist.

My cmake file looked like

cmake_minimum_required(VERSION 3.10)

project(MDTest)

add_executable(MDTest
    src/main.cpp
)

find_package(MoorDyn REQUIRED)
target_link_libraries(MDTest
    MoorDyn::moodyn
)

And the output of running cmake (through vscode) is

[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/A.Kinley/Documents/moordyn_install_test -Bc:/Users/A.Kinley/Documents/moordyn_install_test/build -G "Visual Studio 17 2022" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
[cmake] CMake Error at C:/Program Files/MoorDyn-2.2/lib/cmake/moordyn/MoorDynTargets.cmake:98 (message):
[cmake]   The imported target "MoorDyn::moordynf" references the file
[cmake] 
[cmake]      "C:/Program Files/MoorDyn-2.2/lib/moordynf.lib"
[cmake] 
[cmake]   but this file does not exist.  Possible reasons include:
[cmake] 
[cmake]   * The file was deleted, renamed, or moved to another location.
[cmake] 
[cmake]   * An install or uninstall procedure did not complete successfully.
[cmake] 
[cmake]   * The installation package was faulty and contained
[cmake] 
[cmake]      "C:/Program Files/MoorDyn-2.2/lib/cmake/moordyn/MoorDynTargets.cmake"
[cmake] 
[cmake]   but not all the files it references.
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   C:/Program Files/MoorDyn-2.2/lib/cmake/moordyn/MoorDynConfig.cmake:19 (include)
[cmake]   CMakeLists.txt:10 (find_package)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/A.Kinley/Documents/moordyn_install_test -Bc:/Users/A.Kinley/Documents/moordyn_install_test/build -G "Visual Studio 17 2022" -T host=x64 -A x64 exited with code: 1

I'm not familiar enough with how things are set up and the like to know if this is an error of my own causing, or if a file isn't getting included that should be.

Keep me in the loop if there's anything I can do to help with windows stuff, Kelson primarily uses Windows so I have access to both my development machine and other machines that are yet untouched by MoorDyn.

sanguinariojoe commented 10 months ago

Argh! Sorry! Totally my bad... the installer (master branch) is way more outdated than i thought. It is still using the intel one sdk.

I will try to craft you an installer later.

Ty so much!

On Thu, 21 Sept 2023, 19:00 AlexWKinley, @.***> wrote:

Trying out the windows installer I've thus far run into 2 strange issues.

Firstly, during the install process, when I ask it to add MoorDyn to the system path the installer throws an error that the system path is too long, and it can't add to it. [image: Screenshot 2023-09-21 125326] https://user-images.githubusercontent.com/129765925/269697166-8c18968f-484b-48eb-ac91-1c95783669c6.png

I'm certainly able to add to the path myself, so I'm not sure what's the cause of this error.

The next issue I ran into when trying to use the installed MoorDyn was that it wanted the moordynf.lib file but it didn't exist.

My cmake file looked like

cmake_minimum_required(VERSION 3.10)

project(MDTest)

add_executable(MDTest src/main.cpp )

find_package(MoorDyn REQUIRED) target_link_libraries(MDTest MoorDyn::moodyn )

And the output of running cmake (through vscode) is

[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/A.Kinley/Documents/moordyn_install_test -Bc:/Users/A.Kinley/Documents/moordyn_install_test/build -G "Visual Studio 17 2022" -T host=x64 -A x64 [cmake] Not searching for unused variables given on the command line. [cmake] -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621. [cmake] CMake Error at C:/Program Files/MoorDyn-2.2/lib/cmake/moordyn/MoorDynTargets.cmake:98 (message): [cmake] The imported target "MoorDyn::moordynf" references the file [cmake] [cmake] "C:/Program Files/MoorDyn-2.2/lib/moordynf.lib" [cmake] [cmake] but this file does not exist. Possible reasons include: [cmake] [cmake] The file was deleted, renamed, or moved to another location. [cmake] [cmake] An install or uninstall procedure did not complete successfully. [cmake] [cmake] * The installation package was faulty and contained [cmake] [cmake] "C:/Program Files/MoorDyn-2.2/lib/cmake/moordyn/MoorDynTargets.cmake" [cmake] [cmake] but not all the files it references. [cmake] [cmake] Call Stack (most recent call first): [cmake] C:/Program Files/MoorDyn-2.2/lib/cmake/moordyn/MoorDynConfig.cmake:19 (include) [cmake] CMakeLists.txt:10 (find_package) [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/A.Kinley/Documents/moordyn_install_test -Bc:/Users/A.Kinley/Documents/moordyn_install_test/build -G "Visual Studio 17 2022" -T host=x64 -A x64 exited with code: 1

I'm not familiar enough with how things are set up and the like to know if this is an error of my own causing, or if a file isn't getting included that should be.

Keep me in the loop if there's anything I can do to help with windows stuff, Kelson primarily uses Windows so I have access to both my development machine and other machines that are yet untouched by MoorDyn.

— Reply to this email directly, view it on GitHub https://github.com/FloatingArrayDesign/MoorDyn/issues/135#issuecomment-1729965658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMXKKAOSKADK47FQXSYMGLX3RXA7ANCNFSM6AAAAAA5BJ6QWQ . You are receiving this because you were mentioned.Message ID: @.***>

sanguinariojoe commented 10 months ago

@AlexWKinley you have the new installer here. Please, give it a shot

AlexWKinley commented 10 months ago

@sanguinariojoe Well besides the same path error problem, it unfortunately still doesn't seem to work, but for a different reason.

I used the same cmake file (although fixed the typo in target link libraries), and now it succesfully builds, but when trying to run, it tries to find a moordyn.dll, fails, and then exits. It seems like the installer provided a moordyn.lib, which somehow didn't get statically linked I guess? If I look at the executable dependencies, it lists moordyn.dll, and that it didn't find it image

I'll attach the entire test project folder, including the build folder, in case that provides any useful information. I did compile with clang on windows (using the windows toolchain), but compiling with MSVC ran into the same issue, and I figured the ninja files, and clang commands might be a little easier to look through than solution files.

We're in agreement on the frustration of windows. As always let me know what assistance I can provide. moordyn_install_test.zip

sanguinariojoe commented 9 months ago

I tried this and works just fine with your test @AlexWKinley . Regarding the PATH issues, it is caused by your own PATH which is already too long. In my testing computer it worked

AlexWKinley commented 9 months ago

@sanguinariojoe It looks like once I fix my path to have C:\Program Files\MoorDyn-2.2\bin, then worked with that build you linked. I would agree my path is probably longer than most users'. So I'm in agreement that things work.

sanguinariojoe commented 9 months ago

This is then fixed on #139