Cross Compiling on Linux for Windows

1k views Asked by At

I'm currently using MXE to perform cross compilation, attempting to cross compile with 0MQ that is using the libzmq bindings for C++ for the first time. I've already put the zmq.hpp & zmq.h files in the include folder, but I'm getting an error that says -lzmq cannot be found. I was wondering is there a way to manually add libzmq library to MXE for this purpose?

Error:

/home/mxe/usr/lib/gcc/i686-pc-mingw32/4.8.1/../../../../i686-pc-mingw32/bin/ld: cannot find -lzmq
collect2: error: ld returned 1 exit status
make[1]: *** [release/myapp.exe] Error 1
make[1]: Leaving directory `/home/Desktop/myapp'
make: *** [release] Error 2
2

There are 2 answers

0
don bright On

You can probably ask on the MXE mailing list, they are very helpful.

However you may also be able to add zmq by looking at the MXE instructions for creating packages, which are here:

 http://mxe.cc/#creating-packages

Basically MXE is based on a huge collection of Makefiles and patches to make them work under MXE. To add a package you need to create a '.mk' makefile under the 'src' directory, and then figure out how to make a patch. The xz library is a nice simple example:

 https://github.com/mxe/mxe/blob/master/src/xz.mk

Good luck.

0
fkl On

Not sure about your precise scenario, but working with MXE a few times, I learned to use everything from the current working directory instead of going for the standard headers and locations.

i.e. in your case try by placing

zmq.hpp & zmq.h in /home/Desktop/myapp

with include statements using "" instead of <>