Compiling R3/Ren-c

The relevant data is on the Trello card for both Linux and Windows.

If you're on Windows you can do the MSYS path as detailed above but that I think gives you a Windows 32 bit build. Perhaps someone can advise on how to do a 64 bit build. And you won't be able to do the FFI builds without more effort. This also needs a HOWTO.

Windows 10 users can also install the WSL or Windows Subsystem for Linux which allows you to run Linux where windows os calls are re-mapped to native windows calls. And you can do 64 bit linux builds.

OSX and Android users need to advise on how to do their builds.

You can build both 32 bit or 64 bit binaries with the MinGW tools that can be installed as part of MSYS (I recommend MSYS2, as it's probably the best maintained wrt packages and ease of installing these using a port of the Arch Linux package manager, pacman).

Of course now that WSL is available it's your call whether that's a better road to take if you want to be using GNU tools and build Linux or Windows binaries.

I'm only getting 32 bit builds with MYSYS. I need MSYS2 then?

Well, the targets you can build for depend on the MinGW toolchain you installed, and, I'm guessing you installed either of:

  • a 32 bit MSYS with a 32bit->32bit (i.e. non-cross compiling) MinGW toolchain
  • a 64 bit MSYS with a 32bit->32bit MinGW toolchain

If you're not using MSYS2, it can get pretty confusing as documentation is not the greatest, but you could try and find the appropriate 32bit->64bit MinGW toolchain and install that as well.

My recommendation is to scrap that and install MSYS2/MinGW-w64 just because of the organized ecosystem around it. WRT the toolchain (MinGW-w64), you would install the 64bit->64bit native one or the 64bit->32bit one, or both, depending on whether you want to target both 64bit and 32bit host versions.

The MSYS2 wiki gives a pretty good overview of what's what.

As I mentioned before, though, now that WSL is available (and I know you have it installed), you can target Windows binaries from that (you'd just be doing it from Linux rather than Windows). You just need to install the appropriate MinGW cross-compiling toolchain. See the answer from Markus Laire here. If you're targeting Windows from WSL, though, it could be that the cross-compiling toolchain available is somewhat behind the toolchain available natively under Windows (as I described above). In any case, you can try it out and see if it works for you.

I have written a wiki entry on Ren-cpp for building on Mac (OS X) - https://github.com/metaeducation/ren-cpp/wiki/Building-for-OS-X

Steps just for Ren/C would be:

  • Install Xcode or Command Line Tools

  • From Terminal do:

      git clone https://github.com/metaeducation/ren-c
      cd ren-c/make
      curl http://rebolsource.net/downloads/osx-x86/r3-g25033f8 > r3-make
      chmod +x r3-make
      make -f makefile.boot
    

The best place for these instructions would be in the Ren-C repo (rather than Trello). It's ok for CMake instructions to be on ren-c wiki but I think plain-text make builds should be in a README-macos.md or probably better a combined HOWTO-BUILDME.md (or similarly named file!) for all platforms.

Thoughts?

I'm looking to just get a way to aggregate the ways of building things. I also wrote a walk through on how to build Ren garden but I have no idea where it's gone :cry:

I successfully compiled Ren-C for OS X Leopard (PPC) using the last available version of XCode for that system.

I used TigerBrew to install a few pieces (including Git) that make it a smoother ride.

Cross Compiling for Android on Linux

(Of course, you need Android NDK)

OS_ID=0.13.2 # for Android >= 5; 0.13.1 for Android <= 4
TOOLS=/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi- # your NDK toolchain prefix
PLATFORM=/opt/android-ndk/platforms/android-19/arch-arm # Android platform, keep <= 19
cd ren-c/make

make -f makefile.boot OS_ID=$OS_ID make
make clean prep
TOOLS=$TOOLS EXTRA_CC_FLAGS=--sysroot=$PLATFORM make

optional, if you're experimenting annoying warnings when running

android-elf-cleaner r3

(see https://github.com/kost/android-elf-cleaner)

The now obsolete walk through for building ren-garden is [here] (https://docs.google.com/document/d/14fETMf-YmnJ1NLN4Jql4Fli_wPQ7Bkl6aEbCSMjw7pc/edit?usp=sharing) on googledocs, and last edited in Sept 2015