AndrewGibbs/PathFinder

MEX compilation on Windows

Closed this issue · 7 comments

Dear Andrew,

I'm using MATLAB R2024a on Windows 11 with Microsoft Visual C++ 2022 (C). I've also tried MATLAB R2023b as well. I couldn't run "compileAll" successfully on my machine as it complains about syntax error at "mex_compilation\PathFinder.h(26)", which I suspect is caused by the "double complex" declaration. Is this a known problem on Windows with MSVC or am I missing something with MEX compilation?

Best,
Shukui

Hi @JackC92. Thank you for raising this.

I've added a Windows OS component to the continuous integration tests, and this is also failing - confirming this problem isn't due to your setup - it's a Windows OS issue. I just read up a little about this and you are correct, the Windows MSVC compiler does not recognise complex.h.

For now, you can run PathFinder without MEX. This is straightforward and there are instructions on how to do this in the README.

I'll keep you posted on any possible fixes for this.

Good news @JackC92 - there is an easy fix for this. Please follow these instructions. And please let me know if any other issues arise.

Thanks for the instructions! I can now run the examples in the examples folder with MEX.

However, I find that PathFinder gets stuck when computing PathFinder(pi,0,[],[1 0 0],100,10,'infcontour',[true true]), the example in the README. Then MATLAB just quits silently without any crash report, and nothing shows up upon reopening MATLAB.

Sorry to hear this is still causing you problems @JackC92. As you may have guessed by now - I don't use Windows! But in that respect, your feedback has been very useful. I will have to wait until I can get hold of a Windows machine before I can fix it. The good news is that it's probably something simple if the example codes are running (and the CI tests are passing too). In the meantime - please could you tell me if you get the same error when running the following command?

PathFinder(5*pi/4,pi/4,[],[1 0 0],100,10,'infcontour',[true true])

I think the bug is line 57 in sd_path_ode_euler.c, where the array is length 0 when other_stationary_points_len == 0.

Thanks! I've attempted to fix it on the windows-dev branch. I also added a test to the Windows CI, which tests precisely the problem integral you mentioned, and this was done successfully. Would you be able to update from that branch and try again?

I've checked out the windows-dev branch and the MEX functions on the windows-dev branch are now working smoothly.