Differences between revisions 1 and 47 (spanning 46 versions)
Revision 1 as of 2011-07-11 13:55:09
Size: 1496
Editor: wwwcache
Comment:
Revision 47 as of 2016-04-29 23:35:28
Size: 4583
Comment: Add curl dependency
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
The goal of this article is to guide you through compiling and running Barrelfish inside Qemu and also with writing and running programs on Barrelfish itself.
The instructions below assume you are using a recent version of Linux.
## page was renamed from Getting Started
The goal of this article is to guide you through compiling and running Barrelfish inside QEMU, and to write and run programs on Barrelfish itself.
The instructions below assume you are using a recent version of Ubuntu.

=== Requirements ===
Barrelfish requires the following tools to compile correctly:
 * GCC 4.8.2
 * GNU binutils 2.24 are known to work
 * GNU make
 * GHC and some additional libraries
      Some versions of GHC are not supported. See [[#ghc|Section on GHC]] for more information

We are running nightly build tests on the latest Ubuntu LTS release (14.04.1) and are ensuring Barrelfish always builds using the Ubuntu versions of the above-mentioned tools. You can get a full build environment on Ubuntu by running the following command

{{{{
$ sudo apt-get install build-essential bison flex cmake gcc-multilib qemu-system-x86 qemu-system-arm ghc libghc-src-exts-dev libghc-ghc-paths-dev libghc-parsec3-dev libghc-random-dev libghc-ghc-mtl-dev libghc-src-exts-dev libghc-async-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libgmp3-dev cabal-install curl
$ cabal install bytestring-trie
}}}}
Line 6: Line 22:
First we need to get the latest version of Barrelfish from the mercurial repository, use the following command: First we need to get the latest version of Barrelfish from the mercurial repository. Use the following command:
Line 8: Line 24:
hg clone http://hg.barrelfish.org
}}}}
or, if you are using an HTTP proxy
{{{{
hg --config http_proxy.host=ipOfYourProxyServer:portOfYourProxyServer --config http_proxy.user=user --config http_proxy.passwd=password pull http://hg.barrelfish.org
git clone git://git.barrelfish.org/git/barrelfish
Line 15: Line 27:
Once you have cloned the repository cd into it and create a build directory and enter it === Configuring ===

Once you have cloned the repository, cd into it, create a build directory, and enter it:
Line 17: Line 31:
cd hg.barrelfish.org cd barrelfish
Line 22: Line 36:
Then create the required makefile === Prepare for build: The hake build system ===
<<Anchor(ghc)>>

We use [[http://barrelfish.org/TN-003-Hake.pdf|hake]] to build barrelfish.

    * You need ghc. See the [[http://git.barrelfish.org/?p=barrelfish;a=blob;f=README|README]]. Please, read section [[#ghcVers|GHC Versions]] for more details.
    * Packages (already installed if you've followed the steps in the requirement section)
      * libghc-ghc-paths-dev
      * libghc-parsec3-dev
      * libghc-ghc-mtl-dev
      * libghc-src-exts-dev
      * libghc-async-dev
      * libghc-src-exts-dev
      * libghc-random-dev
      * libgmp3-dev
      * and via Cabal: bytestring-trie

==== GHC Versions ====
<<Anchor(ghcVers)>>
7.6.3 is the version we use internally (read: the version Ubuntu 14.04 LTS ships). Note that Haskell/GHC tends to be not very backwards compatible even for different minor versions. Therefore, it is strongly recommended to use the version that Ubuntu LTS is currently shipping.


=== Build barrelfish ===

Then create the required makefile:
Line 26: Line 64:
or, if you wish to build the 32-bit version or, if you wish to build the 32-bit version:
Line 30: Line 68:
Valid arm targets are:
{{{{
../hake/hake.sh -s .. -a arm
}}}}
or
{{{{
../hake/hake.sh -s .. -a arm11mp
}}}}
or
{{{{
../hake/hake.sh -s .. -a arm_gem5
}}}}
Line 31: Line 81:
Now we can build Barrelfish '''Note:''' If you get the following error:
{{{{
../hake/Main.hs:369:25:
    Not in scope: data constructor `Opt_DeriveDataTypeable'
}}}}
Apply the following patch to hake/Main.hs: [[https://lists.inf.ethz.ch/pipermail/barrelfish-users/attachments/20110519/833cc2f8/attachment.obj|Main.hs.patch]]

'''Note:''' If you get the following error:
{{{{
stack overflow: use +RTS -K<size> to increase it
}}}}
Try to avoid having the build directory in the source tree

=== Compiling ===

Now we can build Barrelfish:
Line 36: Line 101:
To speed things up you can specify a number of jobs, this should be roughly the same as the number of cores, so on a 4-core machine you could use To speed things up you can specify a number of jobs. This should ideally be slightly more than the number of cores, so on a 4-core machine you could use:
Line 38: Line 103:
make -j 4 make -j 5
Line 41: Line 106:
Once that has completed, you can issue the following command to run Barrelfish on Qemu Once that has completed, you can issue the following command to run Barrelfish on QEMU:
Line 45: Line 110:
To allocate more cores to Qemu, instead of the default 2, you can edit the symbolic_targets.mk file in the build directory. Editing the QEMU_CMD line for the architecture you have built Barrelfish for. To allocate more cores to QEMU, instead of the default 2, you can edit the symbolic_targets.mk file in the build directory. Do this by editing the QEMU_CMD line for the architecture you've chosen for Barrelfish.

== Known Issues ==

=== Gold linker ===
GNU binutils includes an ELF linker named "''gold''" which is faster than the default BFD linker for large C++ applications. However, when linking Barrelfish's CPU driver you may see the following error:
{{{{
/usr/bin/ld: fatal error: -pie and -static are incompatible
collect2: error: ld returned 1 exit status
make: *** [x86_64/sbin/cpu] Error 1
}}}}

To fix this issue uninstall the ''binutils-gold'' package. For further details on why this occurs see [[http://sourceware-org.1504.n7.nabble.com/patch-ob-Disallow-pie-and-static-td150575.html#a33326172|this discussion]].

The goal of this article is to guide you through compiling and running Barrelfish inside QEMU, and to write and run programs on Barrelfish itself. The instructions below assume you are using a recent version of Ubuntu.

Requirements

Barrelfish requires the following tools to compile correctly:

  • GCC 4.8.2
  • GNU binutils 2.24 are known to work
  • GNU make
  • GHC and some additional libraries
    • Some versions of GHC are not supported. See Section on GHC for more information

We are running nightly build tests on the latest Ubuntu LTS release (14.04.1) and are ensuring Barrelfish always builds using the Ubuntu versions of the above-mentioned tools. You can get a full build environment on Ubuntu by running the following command

$ sudo apt-get install build-essential bison flex cmake gcc-multilib qemu-system-x86 qemu-system-arm ghc libghc-src-exts-dev libghc-ghc-paths-dev libghc-parsec3-dev libghc-random-dev libghc-ghc-mtl-dev libghc-src-exts-dev libghc-async-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libgmp3-dev cabal-install curl
$ cabal install bytestring-trie

Getting Barrelfish

First we need to get the latest version of Barrelfish from the mercurial repository. Use the following command:

git clone git://git.barrelfish.org/git/barrelfish

Configuring

Once you have cloned the repository, cd into it, create a build directory, and enter it:

cd barrelfish
mkdir build
cd build

Prepare for build: The hake build system

We use hake to build barrelfish.

  • You need ghc. See the README. Please, read section GHC Versions for more details.

  • Packages (already installed if you've followed the steps in the requirement section)
    • libghc-ghc-paths-dev
    • libghc-parsec3-dev
    • libghc-ghc-mtl-dev
    • libghc-src-exts-dev
    • libghc-async-dev
    • libghc-src-exts-dev
    • libghc-random-dev
    • libgmp3-dev
    • and via Cabal: bytestring-trie

GHC Versions

7.6.3 is the version we use internally (read: the version Ubuntu 14.04 LTS ships). Note that Haskell/GHC tends to be not very backwards compatible even for different minor versions. Therefore, it is strongly recommended to use the version that Ubuntu LTS is currently shipping.

Build barrelfish

Then create the required makefile:

../hake/hake.sh -s .. -a x86_64

or, if you wish to build the 32-bit version:

../hake/hake.sh -s .. -a x86_32

Valid arm targets are:

../hake/hake.sh -s .. -a arm

or

../hake/hake.sh -s .. -a arm11mp

or

../hake/hake.sh -s .. -a arm_gem5

Note: If you get the following error:

../hake/Main.hs:369:25:
    Not in scope: data constructor `Opt_DeriveDataTypeable'

Apply the following patch to hake/Main.hs: Main.hs.patch

Note: If you get the following error:

stack overflow: use +RTS -K<size> to increase it

Try to avoid having the build directory in the source tree

Compiling

Now we can build Barrelfish:

make

To speed things up you can specify a number of jobs. This should ideally be slightly more than the number of cores, so on a 4-core machine you could use:

make -j 5

Once that has completed, you can issue the following command to run Barrelfish on QEMU:

make sim

To allocate more cores to QEMU, instead of the default 2, you can edit the symbolic_targets.mk file in the build directory. Do this by editing the QEMU_CMD line for the architecture you've chosen for Barrelfish.

Known Issues

Gold linker

GNU binutils includes an ELF linker named "gold" which is faster than the default BFD linker for large C++ applications. However, when linking Barrelfish's CPU driver you may see the following error:

/usr/bin/ld: fatal error: -pie and -static are incompatible
collect2: error: ld returned 1 exit status
make: *** [x86_64/sbin/cpu] Error 1

To fix this issue uninstall the binutils-gold package. For further details on why this occurs see this discussion.

BarrelfishWiki: Getting_Started (last edited 2016-12-22 21:49:03 by MoritzHoffmann)