+++
title = "openindiana - getting rubinius to work"
date = "2011-11-14T21:39:48+00:00"
author = "Gibheer"
draft = true
+++

Hey there! This time, we will get rubinius running on openindiana. As there is not package for llvm yet, it get's compiled within the build.

I got it this far because of crsd. He told me how to get llvm running, so that we could get rubinius to compile.
After that [dbussink](https://twitter.com/#!/dbussink) got rbx to compile within two days! He found some really strange things, but in the end, rubinius can run on a solaris platform!

requirements
============

But first, you have to fulfill some requirements. First you have to add the sfe publisher to get the gcc4.
You can do that with the command

    pkg set-publisher -O http://pkg.openindiana.org/sfe sfe

After that install the following packages

* developer/gcc-3
* system/header
* system/library/math/header-math
* gnu-tar
* gnu-make
* gnu-binutils
* gnu-coreutils
* gnu-findutils
* gnu-diffutils
* gnu-grep
* gnu-patch
* gnu-sed
* gawk
* gnu-m4
* bison
* git

Yeah, that's alot of gnu, but we need it to get everything going. The cause of this are the old versions of solaris software, which do not support many features. The default compiler is even gcc 3.4.3!

After you have installed these packages, install the following package from sfe.

* runtime/gcc

The order is important, as gcc3 and gcc4 set symlinks in /usr/bin. If you install them in another order, the symlink is not correct and you end up having a lot of work.

some patching
=============

After that, we have to fix a small bug in gcc with editing the file `/usr/include/spawn.h`.

    73,76d72
    < #ifdef __cplusplus
    <   char *const *_RESTRICT_KYWD argv,
    <   char *const *_RESTRICT_KYWD envp);
    < #else
    79d74
    < #endif
    86,89d80
    < #ifdef  __cplusplus
    <   char *const *_RESTRICT_KYWD argv,
    <   char *const *_RESTRICT_KYWD envp);
    < #else
    92d82
    < #endif

This fixes a bug in gcc with [the \_\_restrict key word](http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347).

fix the path
============

Now that we installed and fix a bunch of things, we need to include the gnu path into our own. Use the following command to get this done

    export PATH="/usr/gnu/bin:$PATH"

Yes, it needs to be at the first place or else one of the old solaris binaries get's chosen and then, nothing works and produces weired errors.

getting rbx to compile
======================

with an own build
-----------------

If you want to build rbx yourself, get the code from [https://github.com/rubinius/rubinius.git](https://github.com/rubinius/rubinius.git). After that, configure and rake and everything should be fine.

with rvm
---------

If you want to get it working with rvm, install rvm like normal. After that you can simply install rbx with

    rvm install rbx

That's all you need.

conclusion
==========

After dbussink fixed all the errors, rbx compiles fine, when the toolchain is there. To get to this point was not easy, but we did it. So have a lot of fun with hacking on and using rubinius!
