Invalid MEX-file
Hello,
I am trying to implement ZMQ in MATLAB, with the following versions:
Branch: Master MATLAB R2015b x 64 bits Visual Studio 2013 compiler x 32 bits ZeroMQ 4.0.4 x64 bits, libzmq v120
But it seems that I have problems with the compilation of the MEX-files since I got this message from MATLAB:
Error using zmq.core.ctx_new Invalid MEX-file 'C:\Program_Files\matlab-zmq-master\lib+zmq+core\ctx_new.mexw64': The specified module could not be found.
Error in collector (line 7) context = zmq.core.ctx_new();
However, the invalid MEX-file exists and is in the right location, maybe the problem is that my compiler is generating MEX-files wrongly. I tried changing the ZeroMQ for x32 version without any success. I used MinGW-w64 and I got the same error. Additionally, I tested it in another PC using MATLAB 2013b and Visual Studio 2012 and the same error was presented.
I would be so grateful if someone could help me or say me advices to try to debug it.
Thank you in advance.
Anderson will have to help you since you're using Windows. However if you review some previous issues there may be some advice in there because this is a common problem when building on Windows.
On 13 March 2017 at 12:48, jalvarmon [email protected] wrote:
Hello,
I am trying to implement ZMQ in MATLAB, with the following versions:
Branch: Master MATLAB R2015b x 64 bits Visual Studio 2013 compiler x 32 bits ZeroMQ 4.0.4 x64 bits, libzmq v120
But it seems that I have problems with the compilation of the MEX-files since I got this message from MATLAB:
Error using zmq.core.ctx_new Invalid MEX-file 'C:\Program_Files\matlab-zmq-master\lib+zmq+core\ctx_new.mexw64': The specified module could not be found.
Error in collector (line 7) context = zmq.core.ctx_new();
However, the invalid MEX-file exists and is in the right location, maybe the problem is that my compiler is generating MEX-files wrongly. I tried changing the ZeroMQ for x32 version without any success. I used MinGW-w64 and I got the same error. Additionally, I tested it in another PC using MATLAB 2013b and Visual Studio 2012 and the same error was presented.
I would be so grateful if someone could help me or say me advices to try to debug it.
Thank you in advance.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fagg/matlab-zmq/issues/40, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqWhJ5FCtg99AeYztUV-c_LJUQlu38mks5rlXNBgaJpZM4MbhKy .
Sorry for the delay guys.
@jalvarmon, indeed seems scaring compiler problem. Maybe the fastest way to get you running matlab-zmq is to use Microsoft SDK 7.1 (Visual Studio 10.0). Is it possible?
Or maybe a 64 bit version of Visual Studio 2013? (Or another combination of compiler version and binary from http://zeromq.org/distro:microsoft-windows)
Note that, the official binary distribution of ZMQ for windows use Visual Studio, so you cannot use mingw, unless you compile ZMQ itself using the same compiler.
It can be fixed by add zmq bin path to your system path, then reboot your computer.
I get the exact same error.
Can you please tell me where to find the zmq bin? This is all I have in my zmq folder:

Also, these are all the related softwares I have. Do I need to install anything else?
Windows 10 Pro MATLAB R2020b ZMQ libzmq-v141-mt-4_3_2

binary distribution of ZMQ for windows
Please, can you update this Matlab-ZMQ to work with Matlab R2021b? Matlab R2016a was the last supporting SDK 7.1 compiler. I installed it, but Matlab R2021b doesn't recognize it. Announce: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2016a_SupportedCompilers.pdf
I got and old ZMQ 4.0.4 windows installer and installed ok. On Matlab R2021b, Matlab-ZMQ tests all passed 100% ok (after compiling with Visual Studio C++ 2019 and included ZMQ bin folder to Windows System Path). But when I try to connect Matlab-ZMQ client to a local ZMQ server (MQL-ZMQ sending data from Metatrader 5), Matlab crashes after getting "answer 1" for connection and the error message is related to Mex files.
Do you think if I compile the mex files on Matlab R2016a, they will work after copying them to Matlab R2021b? On Windows 10 64bits, I'm using MQL-ZMQ as server to send live financial data from Metatrader 5 to Matlab. https://github.com/dingmaotu/mql-zmq
Thanks for this great tool!!
binary distribution of ZMQ for windows
Please, can you update this Matlab-ZMQ to work with Matlab R2021b? Matlab R2016a was the last supporting SDK 7.1 compiler. I installed it, but Matlab R2021b doesn't recognize it. Announce: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2016a_SupportedCompilers.pdf
I got and old ZMQ 4.0.4 windows installer and installed ok. On Matlab R2021b, Matlab-ZMQ tests all passed 100% ok (after compiling with Visual Studio C++ 2019 and included ZMQ bin folder to Windows System Path). But when I try to connect Matlab-ZMQ client to a local ZMQ server (MQL-ZMQ sending data from Metatrader 5), Matlab crashes after getting "answer 1" for connection and the error message is related to Mex files.
Do you think if I compile the mex files on Matlab R2016a, they will work after copying them to Matlab R2021b? On Windows 10 64bits, I'm using MQL-ZMQ as server to send live financial data from Metatrader 5 to Matlab. https://github.com/dingmaotu/mql-zmq
Thanks for this great tool!!
Quite simply: no.
I have neither the time nor the resources. I personally also cannot support Windows. I suggest you try and send a PR if you get it working.
I also suspect this is more a configuration problem and not a code problem.
Good news.. On Matlab R2016a (Win 10 64bits) it works perfectly.. no mex issues when compiling. R2016a recognizes the SDK 7.1 compiler and so I used it for compiling it. Works perfect on R2016a. Also successful: Copied the entire compiled Matlab-ZMQ folder from R2016a to Matlab R2021b and works without recompile. Soon I will try to share some practical and organized solution..
Please, I tested the subscriber client script (Examples > sub_client.m) to receive values from publisher server. Do you know how can I receive automatic subscriber updates directly to workspace just when new value is available? Or subscriber client has to ask for updates everytime? Is there any "while" approach to automatic update?
Thanks!