Discussion:
[zeromq-dev] CZMQ Windows Build
HG Choi
2013-10-01 10:59:38 UTC
Permalink
To Developers,

I usually prefer to deal with Linux, but I must now build a Windows client
application that makes use of ZMQ, CZMQ, and FMQ. I was able to build the
latest ZMQ successfully. Now I am trying to build the latest release of
CZMQ in Windows 7 x86_64 architecture. I have tried to use the MVS project
included in the download but I have not succeeded. I would just like to
know if building the latest CZMQ in windows has been tested. If so, and it
worked, there is no more to be said.

I will keep trying to do so with MSV, but am also considering using MinGW
or Cygwin. Or is a cross compile from Linux to Windows using the right
compiler a viable option?

Any sort of guidance on the issue would be helpful!

Thank you,

HG Choi
Laurent Alebarde
2013-10-01 13:16:58 UTC
Permalink
Some months ago, I could build libzmq, czmq and libcurve under MinGW,
and also via cross-compilation. I remember I had to suppress the
hardcoded compiler/linker substitute CC=gcc in
builds/mingw32/Makefile.mingw32, and do : mingw32-make -f Makefile.mingw32

Finally, I found it easier to use cross compilation. I created this
script, from here
<http://www.tinc-vpn.org/examples/cross-compiling-windows-binary/> :
#!/bin/sh
PREFIX=i686-pc-mingw32
export CC=$PREFIX-gcc
export CXX=$PREFIX-g++
export CPP=$PREFIX-cpp
export RANLIB=$PREFIX-ranlib
export PATH="/usr/$PREFIX/bin:$PATH"
export DEL=rm exec "$@"

say, name it set4cross

Modify Makefile.mingw32 : suppress CC=gcc, remplace g++ by $(CXX), and
del by $(DEL).

Then, build with (say i686-pc-mingw32 is your cross compiler name) :
./set4cross ./autogen.sh
./configure --host=i686-pc-mingw32
./set4cross make -f Makefile.mingw32
mkdir /usr/i686-pc-mingw32/lib
ln -s <some path>/builds/mingw32/libzmq.dll <your main project
path>/libzmq.dll
ln -s <some path>/builds/mingw32/libzmq.dll.a
/usr/i686-pc-mingw32/lib/libzmq.dll.a
ln -s /usr/lib/gcc/i686-pc-mingw32/4.7.3/libgcc_s_sjlj-1.dll <your main
project path>/libgcc_s_sjlj-1.dll
ln -s /usr/lib/gcc/i686-pc-mingw32/4.7.3/libstdc++-6.dll <your main
project path>/libstdc++-6.dll

Check you have also (your cross compiler path may be different) - if
not, make a symbolic link :
/usr/i686-pc-mingw32/lib/libstdc++.dll.a
/usr/i686-pc-mingw32/usr/include/zmq_utils.h
/usr/i686-pc-mingw32/usr/include/zmq.h

I did test a project from the Guide both under wine and in a Windows XP
VirtualBox with success
I have not updated my windows builds in the time between.

Please, let us informed of your trials.

Cheers,


Laurent.
Post by HG Choi
To Developers,
I usually prefer to deal with Linux, but I must now build a Windows
client application that makes use of ZMQ, CZMQ, and FMQ. I was able to
build the latest ZMQ successfully. Now I am trying to build the latest
release of CZMQ in Windows 7 x86_64 architecture. I have tried to use
the MVS project included in the download but I have not succeeded. I
would just like to know if building the latest CZMQ in windows has
been tested. If so, and it worked, there is no more to be said.
I will keep trying to do so with MSV, but am also considering using
MinGW or Cygwin. Or is a cross compile from Linux to Windows using the
right compiler a viable option?
Any sort of guidance on the issue would be helpful!
Thank you,
HG Choi
_______________________________________________
zeromq-dev mailing list
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Ho-Gyun Choi
2013-10-04 05:46:23 UTC
Permalink
I have successfully cross-compiled the latest ZMQ and CZMQ for Windows 7
x86_64 from an Ubuntu Linux machine. I used the x86_64_w64-mingw32 toolset.
Thank you Laurent for the guidance, it was very helpful.

But for future reference, by adding the CXXFLAGS= -static-libgcc
-static-libstdc++ during compilation allowed me to avoid directly dealing
with libgcc_s_sjlj-1.dll and libstdc++-6.dll.

Now on to porting libSodium and FileMQ!

I will post a new thread about this issue, but for now:
On a side note, I was not able to 100% pass the self-tests for czmq. After
running czmqselftest.exe, the program aborts with an assertion at zmutex.c
line: 159: zmutex_try_lock()
I noticed that this function was just merged in recently. Maybe there is an
issue with the windows definition of this function?

Other wise, all the other tests pass with out errors.

Thank you,

Ho-Gyun Choi
Laurent Alebarde
2013-10-04 07:18:18 UTC
Permalink
Nice it works. And thanks for the static tips.

For czmq, I have not tried recent master.

For libsodium, I used successfully the same approach than for libzmq.

All the tests had passed.

Cheers,

Laurent
Post by Ho-Gyun Choi
I have successfully cross-compiled the latest ZMQ and CZMQ for Windows 7
x86_64 from an Ubuntu Linux machine. I used the x86_64_w64-mingw32 toolset.
Thank you Laurent for the guidance, it was very helpful.
But for future reference, by adding the CXXFLAGS= -static-libgcc
-static-libstdc++ during compilation allowed me to avoid directly dealing
with libgcc_s_sjlj-1.dll and libstdc++-6.dll.
Now on to porting libSodium and FileMQ!
On a side note, I was not able to 100% pass the self-tests for czmq. After
running czmqselftest.exe, the program aborts with an assertion at zmutex.c
line: 159: zmutex_try_lock()
I noticed that this function was just merged in recently. Maybe there is an
issue with the windows definition of this function?
Other wise, all the other tests pass with out errors.
Thank you,
Ho-Gyun Choi
_______________________________________________
zeromq-dev mailing list
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Pieter Hintjens
2013-10-04 09:47:36 UTC
Permalink
Post by Ho-Gyun Choi
On a side note, I was not able to 100% pass the self-tests for czmq. After
running czmqselftest.exe, the program aborts with an assertion at zmutex.c
line: 159: zmutex_try_lock()
I noticed that this function was just merged in recently. Maybe there is an
issue with the windows definition of this function?
Yes, there definitely is.

-Pieter

Loading...