arm-linux-gnueabi cross compiler for OS X

I spent some time getting a decent cross compiler toolchain for arm-linux-gnueabi running on Mac OS X, including GNU binutils 2.22, gcc 4.6.2 and OCaml 3.12.1. The cross compiler toolchain targets ARM boards running Debian/armel squeeze or later.

The stuff is available from my local MacPorts repository. To get it working on your Mac, make sure to update to the latest MacPorts first, using:

$ sudo port selfupdate
$ sudo port upgrade outdated

Continue by cloning my MacPorts repository and editing the MacPorts sources.conf file (as superuser):

$ git clone git@github.com:bmeurer/MacPorts.git
$ cd MacPorts/ports
$ sudo vim /opt/local/etc/macports/sources.conf

Add a new line to the file before the line with the [default] tag

file:///path/to/MacPorts/ports [nosync]

where /path/to/MacPorts is the path to the MacPorts repository clone. Once done, run

$ portindex

in the MacPorts/ports subdirectory to add the ports from my local MacPorts repository to the list of available ports (remember to rerun portindex everytime you pull from my repository). Now you can continue installing the cross compiler ports, using either

$ sudo port install arm-linux-gnueabi-gcc

to install just the binutils, gcc and the basic runtime, or

$ sudo port install arm-linux-gnueabi-ocaml-compiler

to also install the OCaml cross compiler and its runtime. Installing the toolchain will take some time depending on the available bandwidth and the overall speed of your machine.

Once done, your new cross compiler will be ready in /opt/local, with its system root in /opt/local/arm-linux-gnueabi/sysroot and related tools in /opt/local/bin, prefixed with arm-linux-gnueabi-, i.e.

$ arm-linux-gnueabi-as --version
GNU assembler (MacPorts 2011/12/02) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-linux-gnueabi'.

$ arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (MacPorts 2011/12/02) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ arm-linux-gnueabi-ocamlopt -config
version: 3.12.1
standard_library_default: /opt/local/arm-linux-gnueabi/sysroot/usr/lib/ocaml
standard_library: /opt/local/arm-linux-gnueabi/sysroot/usr/lib/ocaml
standard_runtime: /opt/local/arm-linux-gnueabi/bin/ocamlrun
ccomp_type: cc
bytecomp_c_compiler: arm-linux-gnueabi-gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
bytecomp_c_libraries: -lm  -ldl -ltermcap -lpthread
native_c_compiler: arm-linux-gnueabi-gcc -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
native_c_libraries: -lm  -ldl
native_pack_linker: arm-linux-gnueabi-ld -r  -o 
ranlib: arm-linux-gnueabi-ranlib
cc_profile: -pg
architecture: arm
model: default
system: linux
asm: arm-linux-gnueabi-as
ext_obj: .o
ext_asm: .s
ext_lib: .a
ext_dll: .so
os_type: Unix
default_executable_name: a.out
systhread_supported: true

To help with cross compilation of OCaml projects using ocamlfind, the arm-linux-gnueabi-ocaml-compiler port also installs a custom ocamlfind configuration file /opt/local/etc/arm-linux-gnueabi-ocamlfind.conf, which you can use to utilize the cross compiler toolchain by setting the environment variable OCAMLFIND_CONF to point to this file.

Published: 2011-12-04 — Comments

Red-Black Trees for OCaml

I decided that it was about time to get used to OASIS, that new all-in-one build system generator for OCaml projects. So I started by getting it up and running using various local MacPorts. Once everything was up and running, I started to switch my implementation of Red-Black Trees for OCaml to use OASIS instead of my custom Makefile-based approach. That went amazingly well, and so here’s my first release, version 0.1.0, of ocaml-rbtrees featuring an OASIS-generated build system.

Download: https://github.com/downloads/bmeurer/ocaml-rbtrees/ocaml-rbtrees-0.1.0.tar.gz

Git repository: https://github.com/bmeurer/ocaml-rbtrees

For those of you using MacPorts on Mac OS X, ocaml-rbtrees 0.1.0 is also available from my local MacPorts Portfile repository as caml-rbtrees.

Published: 2011-10-16 — Comments

Towards a native toplevel for the OCaml language

This paper presents the current state of our work on an interactive toplevel for the OCaml language based on the optimizing native code compiler and runtime. Our native toplevel is up to 100 times faster than the default OCaml toplevel, which is based on the byte code compiler and interpreter. It uses Just-In-Time techniques to compile toplevel phrases to native code at runtime, and currently works with various Unix-like systems running on x86 or x86-64 processors.

http://arxiv.org/abs/1110.1029

Published: 2011-10-06 — Comments

Native toplevel test release 3.12.1+ocamlnatjit2

After several additional hours of testing and bugfixing it was time for another test release of our new OCaml native code toplevel ocamlnat. The test release includes a fully featured OCaml 3.12.1 distribution plus our new toplevel ocamlnat, which is up to 100 times faster than the byte code toplevel. See the website for installation instructions and additional information.

Website: http://benediktmeurer.de/ocaml-experimental

Download: http://benediktmeurer.de/files/source/ocaml-3.12.1+ocamlnatjit2.tar.bz2

Git repository: https://github.com/bmeurer/ocaml-experimental

Published: 2011-10-06 — Comments