Skip to content

Windows native builds

Alasdair Macmillan edited this page Dec 22, 2015 · 15 revisions

You'll need to install:

mingw, including (for 32-bit platforms):

  • mingw-developer-toolkit
  • mingw32-base
  • mingw32-gcc-g++
  • msys-base

Add the MSYS bin directory (C:\MinGW\msys\1.0\bin) to the system path (Control Panel -> System Settings -> Advanced System Settings -> Environment variables)

Restart the command line (if started), and test that the "ls" command works (it should).

Install Git for Windows: http://git-scm.com/download/win. I told it to install itself only for the Windows command line prompt, but since MSYS BASH is also reading the same environment variables, it works there too. Restart your command line prompt to pickup the change.

Install the YASM compiler: http://yasm.tortall.net/Download.html - I recommend dropping it in C:\MinGW\bin and symlinking it as "yasm". I downloaded version 1.2.0, to avoid an additional library dependency I didn't have.

LibVPX

TODO: Insert instructions from cross-compiling section

Seems to be working fine, apart from erroring out when trying to strip the library variables. At this point we can take over the process by adding some code to the Makefile:

In the Makefile immediately after "define archive_template", add this to the top of the rule:

@echo " [HACK] libvpx.dll"

$(qexec)$$(CC) $$? -o libvpx.dll -shared -static-libgcc

NOTE: Each line above should start with a TAB character, otherwise it won't work (Makefile syntax)

LibMKV

Use this command:

gcc webmenc.c third_party/libmkv/EbmlWriter.c -I . -shared -o libmkv.dll -static-libgcc -lvpx -L .

LibYUV

When installing depot_tools, you have to put the checkout at the START of the path.

Follow the Linux instructions, but instead of using the "ninja/gyp" system to compile things, Follow the Linux instructions using Make. When the code is compiled, run:

gcc -o libyuv.dll `ls source/*.o` -shared -static-libgcc

Which will re-use the compiled files.

NOTE: I had a hard time getting this working under a 32-bit Windows Server 2008 VM. A bit of python tools in "gclient_utils" was throwing some sort of "Not implemented" exception when trying to count the number of CPU cores, then trying to execute a Python 3.x module (which doesn't exist under Python 2.7).

To workaround this issue, set NUMBER_OF_PROCESSORS=1 in Windows System Properties (Environment variables) and restart your shell - this should make it work.

NOTE: When I last followed these instructions (for the 32-bit compile), the Makefile had disappeared. Instead I ran:

C:\Users\Administrator\dev\trunk>g++ source/*.cc -I include -shared -o libyuv.dll

To produce the DLL. I don't know if this included any assembly optimisations... ----- REWRITE LINE -----

Much suffering there is.

So far its has involved:

Final Known state

I didn't write down most of what I did, because a lot of it didn't work. However. the following is known about the final state:

  • The Windows PATH environment variable having (at the end of the variable) Depot Tools checkout (for libyuv) AND the BIN folder for MinGW's msys installation (which was slightly different from what win-builds installed)
  • Dropping down to the BASH prompt from MinGW's msys installation and running a command from win-builds made the terminal use the compiler from win-builds.
  • I used a old-ish installation of MingGW (~2010), because the later one had issues for me (and I was following the instructions for one of the libraries). I used the latest version of win-builds, which seemed to install more recent versions of things into MingGW.

Compiling native code interface

Very similar, but also link against the other generated libraries.

Clone this wiki locally