[zeromq-dev] default MAX_SOCKETS on Windows set to 63?
Charles Remes
lists at chuckremes.com
Tue Feb 18 17:18:29 CET 2014
Aha! That solved it. It finally built a libzmq.dll with the correct FD_SETSIZE.
Now my question is why the top-level Makefile doesn’t work. At minimum it should know that it’s on a mingw32 platform and then invoke that child Makefile to build things correctly.
Makefiles are an arcane art beyond my ken…
On Feb 17, 2014, at 9:12 PM, KIU Shueng Chuan <nixchuan at gmail.com> wrote:
> Oops. Should have been "mingw32-make -f Makefile.mingw32"
>
> On 18 Feb 2014 11:04, "Charles Remes" <lists at chuckremes.com> wrote:
> I am using an msys shell to do the compilation directly on Windows (no cross-compiling). I just tried to run “mingw32-make Makefile.mingw32” from the proper directory but it just said “Nothing to be done for Makefile.mingw32” and exited.
>
> I wish I could figure out the secret incantation to get my FD_SETSIZE override to work. Better yet, it would be useful if the generated Makefile automatically set it to that value when run in a mingw32 build host.
>
>
> On Feb 17, 2014, at 5:42 PM, KIU Shueng Chuan <nixchuan at gmail.com> wrote:
>
>> Looking at the ctx.cpp source, setting of MAX_SOCKETS goes through clipped_maxsocket() which clips it to "max_fds()-1", where max_fds() is equal to FD_SETSIZE as returned by zmq::select_t::max_fds(). So your issue does appear to be related to FD_SETSIZE.
>>
>>
>>
>> I tried it out again on zeromq4-x 571c668fa2e0b101f607b4c4a34c30da2f174499.
>>
>> Cross-compile on Linux using MinGW32:
>> > CPPFLAGS=-DFD_SETSIZE=1024 ./configure --host=i686-pc-mingw32
>>
>> > grep CPPFLAGS Makefile
>> CPPFLAGS = -pedantic -Werror -Wall -Wno-long-long -D_REENTRANT -D_THREAD_SAFE -DFD_SETSIZE=1024 -DZMQ_FORCE_SELECT
>>
>> Adding the following snippet in one of the source files shows that it does get picked up.
>> #if FD_SETSIZE!=1024
>> #error "FD_SETSIZE wrong"
>> #endif
>>
>>
>>
>> If you are compiling directly on Windows and do not want to install MSYS (using MSYS may yield other quirks!), an alternative to using configure is to go to the subdir builds/mingw32.
>> There is a simple Makefile.mingw32 there.
>> Just run "mingw32-make Makefile.mingw32"
>> Haven't tried this for some time and it is supposed to be automatically generated nowadays.
>>
>>
>>
>> On Tue, Feb 18, 2014 at 12:27 AM, Charles Remes <lists at chuckremes.com> wrote:
>> I’ve tried a few different ways of providing FD_SETSIZE but nothing has worked for me so far.
>>
>> I have tried:
>>
>> * CFLAGS=-DFD_SETSIZE=1024 ./configure
>>
>> * CPPFLAGS=-DFD_SETSIZE=1024 ./configure
>>
>> Neither one is picked up properly by the system. What else should I try?
>>
>> On Feb 14, 2014, at 5:56 PM, KIU Shueng Chuan <nixchuan at gmail.com> wrote:
>>
>>> https://github.com/zeromq/czmq/issues/104
>>>
>>> If compiling using the configure script you need to provide FD_SETSIZE.
>>>
>>> On 15 Feb 2014 01:28, "Charles Remes" <lists at chuckremes.com> wrote:
>>> I received a bug report from a user who compiled zeromq 4.0.3 on Windows using 32-bit mingw. The code that blew up was:
>>>
>>> context = LibZMQ.zmq_ctx_new
>>> rc = LibZMQ.zmq_ctx_set(context, ZMQ::MAX_SOCKETS, 1023)
>>>
>>> At this point, “rc” was returning -1 and the error message is “Invalid Argument”. After playing around with this a bit I discovered that the default MAX_SOCKETS was 63 on this platform.
>>>
>>> context = LibZMQ.zmq_ctx_new
>>> print LibZMQ.zmq_ctx_set(context, ZMQ::MAX_SOCKETS) # => prints “63”
>>>
>>> So, trying to set a value above 63 always fails.
>>>
>>> For further confirmation, I ran “make check” and noted that “test_ctx_options” also fails (though it doesn’t tell me why).
>>>
>>> Does anyone know why MAX_SOCKETS is set to 63 when compiling on Windows using mingw? When I look at the source, MAX_SOCKETS_DFLT is set to 1023!
>>>
>>> cr
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140218/864ef118/attachment.htm>
More information about the zeromq-dev
mailing list