It seems the command-line toolchain of choice changes every fortnight on Windows (except if you're in the MSVC camp, but that's a no-go for ooc at the time of this writing).
The new kid on the block is msys2, which I first had doubts about, but it turns out it's a great way to get a shell, install the packages you need via pacman (!) and get started with ooc on windows.
- Follow the detailed MSYS2 installation guide, installing the 32-bit version (i686).
pacman -S git make wget tar mingw-w64-i686-gcc
export PATH=/mingw32/bin:$PATH
git clone https://github.com/fasterthanlime/rock.git
cd rock
GC_FLAGS="--build=i686-pc-mingw32 --enable-threads=win32" make rescue
- Congrats, you've got a fresh rock!
You might want to add that PATH
-setting command to your ~/.profile
or your ~/.bashrc
so
you don't forget about it when running MSYS2 again. The reason it's needed is that the
default gcc package while build msys binaries (that depend on their version of cygwin, a weird
unix/windows hybrid) instead of mingw32 binaries (only native win32 stuff).
If you get errors while running make, something about mismatched memory addresses between child & parent
when loading a DLL, follow the instructions in this ticket
(in case link goes down: close MSYS2, run autorebase.bat
from the install folder, start again - shazam.)
MSYS2 is such that using their 64-bit install, you can produce 32-bit binaries as well. How it works is, they have two binary prefixes, /mingw32 and /mingw64 (in the file system root of the install).
While I wouldn't recommend using their 64-bit distro, you can still make it produce 32-bit binaries
with rock. I haven't succeeded in building libgc for 64-bit, because the version bundled with rock
has some weird #ifdef in gcconfig.h
that makes the compilation fail. The fix is probably trivial,
I just don't really have the time to look into it now.
The procedure is the same as above, except you'd install the 64-bit (x86_64) version, and add
ARCH=32
before make rescue.
The ARCH
environment variable is there to override rock's arch detection in its Makefile(s).
Once c_rock.exe
has been compiled as a 32-bit binary, it'll produce 32-bit binaries by default, and
so will the rock.exe
it generates.
Thanks for sharing!