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

Cannot load 'libzmq.dll' [126] #17

Closed
ChaddersCheese opened this issue Mar 10, 2018 · 9 comments
Closed

Cannot load 'libzmq.dll' [126] #17

ChaddersCheese opened this issue Mar 10, 2018 · 9 comments

Comments

@ChaddersCheese
Copy link

ChaddersCheese commented Mar 10, 2018

Whenever I try and run the below script, I get the error: Cannot load 'libzmq.dll' [126]

The file libzmq.dll is everywhere in my bindings, so it's not that the file does not exist.

Somebody else (maybe) seems to be having a similar issue here: https://www.mql5.com/en/forum/104158

Any ideas???

#include <Zmq/Zmq.mqh>
//+------------------------------------------------------------------+
//| Hello World client in MQL                                        |
//| Connects REQ socket to tcp://localhost:5555                      |
//| Sends "Hello" to server, expects "World" back                    |
//+------------------------------------------------------------------+
void OnInit()
  {
   Comment("Started");
// Prepare our context and socket
   Context context("helloworld");
   Socket socket(context,ZMQ_REQ);

   Print("Connecting to hello world server…");
   socket.connect("tcp://*:5555");

// Do 10 requests, waiting each time for a response
   for(int request_nbr=0; request_nbr!=10 && !IsStopped(); request_nbr++)
     {
      ZmqMsg request("Hello");
      PrintFormat("Sending Hello %d...",request_nbr);
      socket.send(request);

      // Get the reply.
      ZmqMsg reply;
      socket.recv(reply);
      PrintFormat("Received World %d",request_nbr);
     }
  }

@dingmaotu
Copy link
Owner

Can you give me your environment detail? Like your OS, your CPU architecture, your MetaTrader version, etc.

@ChaddersCheese
Copy link
Author

Thanks Ding. I am on Windows 10, 64 bit, MT4 and MetaEditor 4.

I could try this on a virtual machine. If this is your recommendation, which OS would be best?

@dingmaotu
Copy link
Owner

Hi, make sure that 1. you are using 32bit DLL; 2. the DLL is compiled on Windows with VC++ 2015, you should have vc2015 runtime installed. Can you verify the two points?

@ChaddersCheese
Copy link
Author

ChaddersCheese commented Mar 18, 2018

Hi Ding. Here's a summary of what I've done so far:

Installed ZeroMQ and Pyzmq using the 64 bit download from the following:
https://github.com/MrYsLab/xideco/wiki/Installing-ZeroMQ-On-Windows

Also PIP installed Pyzmq.

Copied and pasted all your bindings into the equivalent folders on my computer. These all went in to "C:\Users\User\AppData\Roaming\MetaQuotes\Terminal\61007F7......\MQL4". I copied and pasted the libzmq.dll file from your 'MT4' folder into my 'Libraries' folder.

When I wrote this originally, I had:
MQL4\Libraries\MT4\libzmq.dll = Error: 'Cannot load 'libzmq.dll' [126]'
But this has now been changed to:
MQL4\Libraries\libzmq.dll = New error: 'MQL4\Libraries\libzmq.dll is not 32-bit version'
But I definitely downloaded the version in your MT4 folder.

I can confirm I have Microsoft Visual C++ 2015 Redistributable (x64) - 14.0.23918 installed.

I have a strong suspicion that I am missing something simple, especially considering ZeroMQ's installation procedure seems so complicated (I haven't followed these instructions):
http://zeromq.org/docs:windows-installations

Thanks again,
Anthony

@dingmaotu
Copy link
Owner

You should have only one 32bit libzmq.dll in your path and libsodium.dll is also needed. And the vc2015 redistributable should be 32bit, too.

@ChaddersCheese
Copy link
Author

This is now working. No errors when I git cloned the dlls.

Thanks for all your help.
Anthony

@dingmaotu
Copy link
Owner

@ChaddersCheese you are welcome. Then this issue will be closed.

@jothism
Copy link

jothism commented Dec 8, 2020

Traceback (most recent call last):
File "c:\users\jothinath\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\jothinath\appdata\local\programs\python\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Jothinath\AppData\Local\Programs\Python\Python39\Scripts\jupyter-notebook.EXE_main
.py", line 4, in
File "c:\users\jothinath\appdata\local\programs\python\python39\lib\site-packages\notebook\notebookapp.py", line 51, in
from zmq.eventloop import ioloop
File "c:\users\jothinath\appdata\local\programs\python\python39\lib\site-packages\zmq_init
.py", line 50, in
load_libzmq()
File "c:\users\jothinath\appdata\local\programs\python\python39\lib\site-packages\zmq_init
.py", line 28, in _load_libzmq
from . import libzmq
ImportError: DLL load failed while importing libzmq: The specified module could not be found.

@maoyongsheng
Copy link

You should have only one 32bit libzmq.dll in your path and libsodium.dll is also needed. And the vc2015 redistributable should be 32bit, too.

请问macos环境怎么办,m1芯片的

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