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

libzmq for ZeroMQ for Mono on Windows? #157

Open
dsblank opened this issue Mar 3, 2014 · 9 comments
Open

libzmq for ZeroMQ for Mono on Windows? #157

dsblank opened this issue Mar 3, 2014 · 9 comments

Comments

@dsblank
Copy link

dsblank commented Mar 3, 2014

Hello, I have successfully built clrzmq/src/ZeroMQ on Windows for Mono, but I can't figure out what libzmq.dll nor where to put it. Any suggestions?

@mafairnet
Copy link

Windows
Windows/System32
Windows/SysWOW64

@dsblank
Copy link
Author

dsblank commented Mar 3, 2014

Which libzmq.dll will work? I can put different versions of libzmq.dll in the directory of the .exe, but none appear to be the correct libzmq.dll. Which version?

@mafairnet
Copy link

The correct one it's depending on your OS architecture (x86 -> 32 bits, x64 ->64bits)

@dsblank
Copy link
Author

dsblank commented Mar 3, 2014

Thanks for attempting to help, but I cannot make this work. I think it is a problem in getting the correct version of the libzmq.dll (2.2.0?). I get an error if I attempt to refer to:

ZeroMQ.ZmqVersion.Current

SystemError: An exception was thrown by the type initializer for ZeroMQ.Interop.LibZmq

That suggests that clrzmq is finding the libzmq.dll, but it is not the correct version for ZeroMQ for Mono.

@dsblank
Copy link
Author

dsblank commented Mar 4, 2014

Do you need additional information?

@dsblank
Copy link
Author

dsblank commented Mar 13, 2014

Some additional detail: we're using the same managed DLL (with the ZeroMQ namespace, from the Mono folder) on Linux, Mac, and Windows. We have the correct low-level libraries for Mac, and Linux (and everything works fine), but have not been able to find the correct low-level libraries for Windows for that particular managed DLL. Any ideas?

@dsblank
Copy link
Author

dsblank commented Mar 15, 2014

I think I have come to the conclusion that you can't use Mono on Windows with this code. Why do I want to use Mono on Windows? Because we have one code base for all platforms. Here is the problem:

If you build src\clrzmq.Mono.sln, and then compile and run this program with Mono on Windows:

using System;
using ZeroMQ;
namespace TestZMQ
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Hello World! " + ZeroMQ.ZmqVersion.Current);
        }
    }
}

You get:

Unhandled Exception: System.TypeInitializationException: An exception was thrown
 by the type initializer for ZeroMQ.Interop.LibZmq ---> System.TypeInitializatio
nException: An exception was thrown by the type initializer for Errno ---> Syste
m.ArgumentOutOfRangeException: Current platform doesn't support this value.
Parameter name: value
EADDRINUSE
  at Mono.Unix.Native.NativeConvert.ThrowArgumentException (System.Object value)
 [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Mono.Pos
ix\Mono.Unix.Native\NativeConvert.generated.cs:21
  at Mono.Unix.Native.NativeConvert.FromErrno (Errno value) [0x0000e] in C:\cygw
in\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Mono.Posix\Mono.Unix.Native\N
ativeConvert.generated.cs:197
  at ZeroMQ.Interop.Platform+Errno..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at ZeroMQ.Interop.LibZmq..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at ZeroMQ.ZmqVersion.GetCurrentVersion () [0x00000] in <filename unknown>:0
  at System.Lazy`1[ZeroMQ.ZmqVersion].InitValue () [0x0014f] in C:\cygwin\tmp\mo
nobuild\build\BUILD\mono-2.10.8\mcs\class\corlib\System\Lazy.cs:155
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An except
ion was thrown by the type initializer for ZeroMQ.Interop.LibZmq ---> System.Typ
eInitializationException: An exception was thrown by the type initializer for Er
rno ---> System.ArgumentOutOfRangeException: Current platform doesn't support th
is value.
Parameter name: value
EADDRINUSE
  at Mono.Unix.Native.NativeConvert.ThrowArgumentException (System.Object value)
 [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Mono.Pos
ix\Mono.Unix.Native\NativeConvert.generated.cs:21
  at Mono.Unix.Native.NativeConvert.FromErrno (Errno value) [0x0000e] in C:\cygw
in\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Mono.Posix\Mono.Unix.Native\N
ativeConvert.generated.cs:197
  at ZeroMQ.Interop.Platform+Errno..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at ZeroMQ.Interop.LibZmq..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at ZeroMQ.ZmqVersion.GetCurrentVersion () [0x00000] in <filename unknown>:0
  at System.Lazy`1[ZeroMQ.ZmqVersion].InitValue () [0x0014f] in C:\cygwin\tmp\mo
nobuild\build\BUILD\mono-2.10.8\mcs\class\corlib\System\Lazy.cs:155
Press any key to continue . . .

@dsblank
Copy link
Author

dsblank commented Mar 15, 2014

Found the issue:

There was a confusion between MONO and UNIX flags:

in the file SocketProxy.cs:

line 398, change UNIX to MONO
line 407, change UNIX to MONO

@markwkjr
Copy link

I corrected this issue using Visual Studio 2015 by adding Reference to the project ZeroMQ.VS instead of the release ZeroMQ.dll

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

3 participants