Out in the Open

by carlin on October 4th, 2009

Part of the fun of trying new platforms to test specific software is getting past the initial hurdles. On OpenSolaris it was figuring out how to install Git, Subversion, GNU Make and GCC (which I easily found out how to do). On Haiku it was figuring out why the compile was failing and how I could fix it. On OpenSolaris the second time round it was figuring out why the compile was failing when it didn’t the first time. I have tried a few other platforms and never got anywhere with them due to problems that I could not figure out how to get past; on Minix I had trouble with the compiler failing and the configure script not working, on Hurd I had trouble with … well … getting it to boot. So wondering what challenges I would face I tried OpenBSD.

OpenBSD installed nicely, configured the network correctly (having internet connectivity is a big bonus) and already had GCC. However, getting Rakudo and Parrot turned out to be difficult. Git and Subversion are not installed by default and after wrestling with the package manager and trying to install the dependencies I gave up, tar’d up a fresh Rakudo/Parrot on my main machine and SFTP’d it across. Full of apprehension as to what would go wrong, I ran Parrot’s Configure.pl script. It worked and spat out a Makefile. So I ran make install-dev. It ran for a few seconds and then failed with:

Byte order is not compatible

It was Google to the rescue turning up this PerlMonks post. The problem was I had cloned, checkedout and tar’d the files on a 64-bit machine, so I repeated the process on my laptop, SFTP’d the new tar and Parrot compiled quite nicely.

So I cd’d back to Rakudo and ran perl Configure.pl since I had used the –prefix flag on Parrot to install it to parrot_install/ in the Rakudo directory it should have detected the parrot_config automatically but I got an error:

===SORRY!===
Parrot revision r41448 required (currently r0)

To automatically checkout (svn) and build a copy of parrot r41448,
try re-running Configure.pl with the '--gen-parrot' option.
Or, use the '--parrot-config' option to explicitly specify
the location of parrot_config to be used to build Rakudo Perl.

I wasn’t paying attention and thought it hadn’t found the parrot_config binary, so I tried again with perl Configure.pl --parrot-config=parrot_install/bin/parrot_config and it did the same thing. So after I actually read the error message I figured it out; r0?

Parrot compiles its SVN revision number into the parrot_config binary, but since SVN wasn’t installed on the box it defaulted it to r0. My simple hack was to do:

$ echo 0 > build/PARROT_REVISION

From Rakudo’s directory. This makes the configure script expect a Parrot with revision 0, which it thought I had. After that it created a makefile and Rakudo compiled as expected.

I got the spectests by tar’ing up the directory on my laptop and SFTP’ing it across.

4 hours later I got the results:

S02-magicals/config failed because OpenBSD isn’t a known OS. Now fixed.

S03-operators/arith #163 and S32-num/power #11 fail because, like OpenSolaris, OpenBSD thinks 1**Inf = NaN.

S29-context/sleep #2 and 4 also fail because OpenBSD sleeps for too long if ‘use Test’ is included. I think this is the result of system slowness.

> say sleep 3;
3.25350594520569
> use Test; say sleep 3;
21.6377711296082

What to try next? NetBSD?

Angering the sun gods

by carlin on September 30th, 2009

I must have commited hubris the last time I tried Rakudo on Solaris and had no trouble.

I booted up a fresh OpenSolaris partition today, the first time in about two weeks, installed all the tools and downloaded rakudo, however Parrot’s Configure.pl script gave out errors and it died during the build process as a result. Utterly confused (as it was working without any hassle two weeks ago) I decided to try Sun Studio’s C Compiler, and it built fine. So I ran the spectest and had a few failures that I do not remember getting last time.

The first failure was in S03-operators/arith.t #163 fails. This test checks that 1**Inf returns 1, however on OpenSolaris:

> say 1**Inf
NaN

On Ubuntu:

> say 1**Inf
1

Utterly perplexed I asked on IRC but received no answer as to why this was happening, so I made a note to report it later.

I moved on then to sedate my curiosity into $*OS. I thought its value depended on the result of uname -s but OpenSolaris reports that as ‘SunOS’ while its $*OS variable is ’solaris’, so while digging into the code (I never did figure out how it works) I found that $*OSVER is defined in Rakudo. On my Ubuntu box it returns:
#49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009
and on Solaris it returns nada. It’s defined, but an empty string. Something to do with how Parrot works it out, I tried to dig into the source but didn’t understand it.

So having found a few issues I decided to look into my initial problems; GCC not working. I tried to compile it a few more times, each time it failing until the answer just came to me; Rakudo’s configure script was recently changed to pass –optimize to Parrot by default. It made sense, it Just Worked(tm) two weeks ago, in that time the –optimize flag was made a default and now it doesn’t work, so I tried building Parrot with GCC without the flag and it worked! Here the Parrot bug that was filed.

My original intent was to see what spectests faster, Rakudo with GCC-Parrot or Rakudo with SSCC-Parrot. So I started spectesting the GCC-compiled-Parrot Rakudo and some strange failures came up that didn’t fail on the first run; t/spec/S32-num/log # 12 and 16. (Just an aside, S32-num/power #11 also fails but that’s because of 1**Inf). Confused I looked at the tests but couldn’t work it out, I thought I might have missed those failures in my first run so I rebuilt both Rakudo’s, one with GCC and one with SunStudio CC and set the spectests going. While they were spectesting I had a thought and decided to test the test:

On Ubuntu:
> say log(-Inf)
NaN

On OpenSolaris:
> say log(-Inf)
-Inf

Then I had a weird thought … on the Rakudo using a Parrot compiled with SunStudio CC:
> say log(-Inf)
NaN

Oops?

I have no idea what is going on here, but I do know that Parrot and Rakudo need more people using other platforms ;-)

If I was using OpenSolaris as my $ONE_TRUE_OS I would have noticed this two weeks ago … I would love to be doing that but I life has been so easy with Ubuntu I don’t think I could handle the switch.

Just a postscript, when the –optimize change was made I booted my Haiku box, cloned a fresh Rakudo and rebuilt from scratch to test if it affected anything … curses!

Rakudo in 17 syllables

by carlin on September 21st, 2009

Update 27/09/09: As of Parrot revision 41493 none of this is necessary, Parrot’s generic platform code checks if the time functions are available and replaces them if need-be (which is all moving the file from darwin’s code to generic was doing anyway).

The Haiku OS project released their Alpha 1 a few days ago and since then I have been trying it on and off. I like what I see and by their official release I expect it will be a very nice operating system.

As I did with OpenSolaris I wanted to put my time using the system to good use and test Rakudo on it. I happily discovered that GCC, Make, Subversion, Git and Perl are already installed by default so it was just a matter of getting Rakudo and building it.

As I unhappily discovered there are some issues which require a bit of hacking to get it to work. My methods are probably not ideal but they work ;-)

The first step was opening a terminal window; right-click, select Add-Ons and select OpenTerminal (or press OPT-ALT-T, opt is the ‘Super key’ or ‘Windows key’).

I checked out Rakudo with the familar:
~> git clone git://github.com/rakudo/rakudo.git
cd rakudo

Generated Parrot:
~> perl Configure.pl --gen-parrot

And it is this point that things go wrong. The Parrot build fails when building the time function, my quick and easy work around was to copy the hires_timer.c file from the darwin-specific code to the generic-code.

~/rakudo/parrot/config/gen/platform> mv generic/hires_timer.c generic/hires_timer.c.bak
~/rakudo/parrot/config/gen/platform> cp darwin/hires_timer.c generic/hires_timer.c

Attempting to rebuild Parrot got me past the initial hurdle but it still fails when dealing with the glut libraries. Luckily running

~/rakudo/parrot> perl Configure.pl --help

Yielded the –without-opengl flag for Parrot. Compiling Parrot without OpenGL (which doesn’t seem to be necessary anyway) makes it skip anything glut-related.

So all I needed to do was pass that command to Parrot, and repeating the help command in Rakudo’s directory informed me that I could do that the easy way with:

~/rakudo> perl Configure.pl --gen-parrot --gen-parrot-option='--without-opengl'

After this, Parrot compiled quite nicely and all was left was:

~/rakudo> make install

And there it is, a working perl6 binary on Haiku:

oh-haiku

The spectests completed with only one failure which, as with Solaris, was easily fixed.

So now that you have successfully compiled Parrot and Rakudo on Haiku, run:
~> gcc --version

As you can see, by default, the Haiku project uses gcc 2.5 (which is 8 years old). They do this to retain compatibility with old BeOS programs. There is a GCC4 available, but apparently Parrot doesn’t need it.

However, assuming you don’t want a Parrot from the dark-ages, you can compile it with GCC4 by using:

~/rakudo> perl Configure.pl --gen-parrot --gen-parrot-option='--without-opengl' --gen-parrot-option='--cc=/boot/develop/abi/x86/gcc4/tools/gcc-4.3.3-haiku-090629/bin/gcc'

Make sure you wipe out your parrot_install first with ~/rakudo> rm -r parrot_install

Enjoy :-)

Solar powered Rakudo

by carlin on September 15th, 2009

Lately I have been thinking more and more that Ubuntu is not the operating system for me. Don’t get me wrong, it is fantastic and I would easily recommend it to anyone wanting to try Linux but in the interest of expanding my horizons I decided to try something different. My first thought was another Linux distribution, Gentoo being one I have meant to try for a long time now but instead I took the plunge into something completely different and installed OpenSolaris, an open source Unix-like OS based on Sun’s Solaris.

My first impression was how nice the UI looked (funny how we tend to notice the unimportant things first ;-) ) , my second impression was that it seemed rather familiar coming from Ubuntu.

To put my adventuring to good use I wanted to test Rakudo on it.

To install Rakudo in OSOL you need GCC, GNU Make, Subversion and Git. Perl is already installed.

To install these I did:

carlin@aethon:~$ pkg install SUNWgcc
carlin@aethon:~$ pkg install SUNWgmake
carlin@aethon:~$ pkg install SUNWgit
carlin@aethon:~$ pkg install SUNWsubversion

Then checked out Rakudo:

carlin@aethon:~$ git clone git://github.com/rakudo/rakudo.git
carlin@aethon:~$ cd rakudo

Configured Rakudo and generated Parrot:

carlin@aethon:~/rakudo$ perl Configure.pl --gen-parrot

And then ran make:

carlin@aethon:~/rakudo$ gmake install

You have to type gmake to use GNU Make. The default make command runs Sun’s make utility and I wasn’t able to get it to work.

Everything seemed to go as expected and at the end I had a working Rakudo:

carlin@aethon:~/rakudo$ ./perl6
> say 'OH HAI';
OH HAI

The spectest didn’t turn up platform-specific usualness, except that Solaris wasn’t a known OS to rakudo; which was easily fixed.

BEGIN {}

by carlin on September 15th, 2009

Starting a new blog.

In the past I have been terrible at keeping blogs updated and generally end up deleting them. I will try not to do that this time ;-)