Building vanillawish/undroidwish on Windows
Not logged in

Building vanillawish/undroidwish on Windows

By Stephan Effelsberg

The crucial part in building undroidwish on Windows is the setup of the environment. This set of instructions is the result from building undroidwish on Windows 7 Pro 32 using MSys2.

Tool: MSys2

Install MSys2 from the homepage or use a package manager like Chocolatey. Once you have MSys2 you can install any necessary package via its package manager pacman, e.g

    pacman -S <name of package>

Some tools like CMake are nice to have a system-wide install. In this case just make sure that the tools are listed in the PATH.

Tool: MinGW

Install MinGW, then copy some of the binaries to give them their necessary names, see for example these instructions on the Enlightenment wiki. Unfortunately, the binaries of a Windows installation of MinGW don't have the names of the cross compiler suite of MinGW. Consult the build script that you're finally going to call to learn about the names of the individual binaries. This is an excerpt from build-undroidwish-win32.sh:
# the toolchain
if test -d /opt/mingw64/bin ; then
  # use -march=i386 -mtune=i386 for Win2000 and/or old CPUs w/o
  # SSE like VIA C3
  echo using toolchain from /opt/mingw64/bin
  PATH="/opt/mingw64/bin:$PATH"
  STRIP="x86_64-w64-mingw32-strip"
  OBJCOPY="x86_64-w64-mingw32-objcopy"
  AR="x86_64-w64-mingw32-ar"
  RANLIB="x86_64-w64-mingw32-ranlib"
  CC="x86_64-w64-mingw32-gcc -m32 -march=i386 -mtune=i386 -DTCL_UTF_MAX=3"
  CC_OLD="x86_64-w64-mingw32-gcc -m32 -march=i386 -mtune=i386 -D_WIN32_WINNT=0x0400 -DTCL_UTF_MAX=3"
  CXX="x86_64-w64-mingw32-g++ -m32 -march=i386 -mtune=i386 -fno-exceptions -DTCL_UTF_MAX=3"
  RC="x86_64-w64-mingw32-windres -F pe-i386"
  NM="x86_64-w64-mingw32-nm"
  export STRIP OBJCOPY AR RANLIB CC CC_OLD CXX RC NM
else
  # would like to use -march=i386 -mtune=i386, too, but then gcc-4.8
  # cannot link due to missing atomic support for this CPU, thus must
  # have Pentium at least
  echo using toolchain prefix i686-w64-mingw32
  STRIP="i686-w64-mingw32-strip"
  OBJCOPY="i686-w64-mingw32-objcopy"
  AR="i686-w64-mingw32-ar"
  RANLIB="i686-w64-mingw32-ranlib"
  CC="i686-w64-mingw32-gcc -m32 -march=i586 -mtune=generic -DTCL_UTF_MAX=3"
  CC_OLD="i686-w64-mingw32-gcc -m32 -march=i586 -mtune=generic -D_WIN32_WINNT=0x0400 -DTCL_UTF_MAX=3"
  CXX="i686-w64-mingw32-g++ -m32 -march=i586 -mtune=generic -fno-exceptions -DTCL_UTF_MAX=3"
  RC="i686-w64-mingw32-windres -F pe-i386"
  NM="i686-w64-mingw32-nm"
  TWAPI_LDFLAGS="-L${AWDIR}/undroid/compat/win32/lib32"
  export STRIP OBJCOPY AR RANLIB CC CC_OLD CXX RC NM TWAPI_LDFLAGS
fi

What if ... I instead rename the environment variables in the script to reflect the names of the binaries?

When compiling libwebsockets, you may encounter a strange case of CMAKE_AR-NOTFOUND. I don't know why ar is so special to CMake but if you search for it you can find many surprised developers who stumbled upon it.

Tool: CMake

Get it from cmake.org or a package manager.

Tool: rsync

For calling init of the build script.

    pacman -S rsync

Tool: make

    pacman -S make

Tool: nasm

nasm.us or via package manager. Needed for jpeg-turbo.

    pacman -S nasm

Tool: Perl

    pacman -S perl

Tool: bc

curl calls curl-config and this script needs bc to calculate the version number requirements.

    pacman -S bc

Tool: pkg-config

    pacman -S pkg-config

What if ... I forget pgk-config?

You will not get error messages but some modules will silently be ignored, e.g. the jsmpeg video driver. You will only learn about this when trying to use an ignored module.

Tool: texinfo

ffidl may complain about a missing makeinfo.

    pacman -S texinfo

Starting the shell

There are some options to start the MSys shell (and you surely have already started one in order to install the tools). Make sure that the shell is being run as an MSys shell, not a MinGW shell, by checking uname. The result should look like

MSYS_NT_6.1-7601

and not like

MINGW_NT_6.1-7601

Now follow the simple build instructions to get your wish.

What if ... I run a shell in MinGW mode?

Some modules may give you error messages like "Please use win32/Makefile.gcc instead." or "... is not a cygwin compiler."