Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Cross compilation

Saúl Ibarra Corretgé edited this page Jul 29, 2014 · 3 revisions

Ubuntu and MinGW-w64 toolchain

Ubuntu 12.04 mingw-w64 package is missing some definitions needed to build libuv, the following commands can be used to patch libuv sources and work around the problem:

# Create a header with some definitions missing mingw-w64 2.0.1
# which is the version shipped with ubuntu 12.04
# ref: http://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/20120923143935.5105c12a7166e2afeff98385@gmail.com/
cat > "src/win/missing.h" << EOF
#include <ntddndis.h>
#include <naptypes.h>
typedef int MIB_TCP_STATE;
EOF

# patch src/win/util.c to include the generated header after winsock2.h include
sed -i '/#include <winsock2.h>/a#include ".\/missing.h"' src/win/util.c

NOTE: this is not a problem with recent versions of the MinGW-w64 toolchain.

Install the required mingw packages with sudo apt-get install binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64, then:

sh autogen.sh
./configure --disable-shared --enable-static --host=x86_64-w64-mingw32
make
make check

The make check command will fail to execute(unless wine is installed), but it will generate the test/run-tests.exe file which can be dropped into a windows machine(or virtual machine) to run the tests

Clone this wiki locally