Differences between revisions 13 and 53 (spanning 40 versions)
Revision 13 as of 2011-07-25 17:17:01
Size: 5880
Editor: 94-195-174-26
Comment: Clarified cause of ghc bug which causes filet-o-fish to not compile
Revision 53 as of 2016-12-22 21:49:03
Size: 4915
Comment: correct apt-get syntax
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The instructions below assume you are using a recent version of Linux. The instructions below assume you are using a recent version of Ubuntu.

To run Barrelf
ish on the Pandaboard, have a look at [[PandaBoard]].
Line 7: Line 9:
 * GCC 4.x
    4.4.5 and 4.5.2 are known to work. However, 4.4.5 throws compile warnings when building the current release as it does not support flags used by the Makefile, so 4.5.x is recommended.
 * GNU binutils 2.19 and 2.20 are known to work
 * GCC 5.4.0
 * GNU binutils 2.26.1 are known to work
Line 11: Line 12:
 * GHC 6.10 or 6.12.2
      earlier versions of GHC are unsupported.
      GHC 6.12.1 has a known bug and is unable to build our tools
 * The Parsec 2.1 and GHC-paths packages. These can usually be downloaded from your distribution mirrors or failing that, using cabal.
      If in doubt, just try compiling Barrelfish and GHC will alert you if it fails to find either package installed.
 * Non-kvm QEMU. The kvm version causes runtime errors, see known issues.
 * GHC and some additional libraries
      Some versions of GHC are not supported. See [[#ghc|Section on GHC]] for more information
Line 18: Line 15:
We are running nightly build tests on the latest Ubuntu LTS release (16.04.x) 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 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 freebsd-glue libelf-freebsd-dev libusb-1.0-0-dev qemu-utils gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
$ cabal install bytestring-trie
}}}}

Note: Sometimes cabal fails because its repository, [[hackage.haskell.org]], is down. In this case a mirror can be used, for example as documented in [[https://www.fpcomplete.com/blog/2015/03/hackage-mirror]].
Line 22: Line 27:
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 clone http://hg.barrelfish.org
git clone git://git.barrelfish.org/git/barrelfish
Line 33: Line 34:
cd hg.barrelfish.org cd barrelfish
Line 37: Line 38:

=== 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
      * freebsd-glue
      * libelf-freebsd-dev
      * and via Cabal: bytestring-trie

==== GHC Versions ====
<<Anchor(ghcVers)>>
7.10.3 is the version we use internally (read: the version Ubuntu 16.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 ===
Line 42: Line 68:
or, if you wish to build the 32-bit version:
{{{{
../hake/hake.sh -s .. -a x86_32
}}}}
Line 48: Line 71:
../hake/hake.sh -s .. -a arm ../hake/hake.sh -s .. -a armv7
Line 50: Line 73:
or or (experimental)
Line 52: Line 75:
../hake/hake.sh -s .. -a arm11mp ../hake/hake.sh -s .. -a armv8
Line 54: Line 77:

To see what make targets are available for building Barrelfish run
{{{{
make help-platforms
}}}}

To see what make targets are available for running Barrelfish run
{{{{
make help-boot
}}}}
Line 57: Line 91:
../hake/Main.hs:369:25:
    Not in scope: data constructor `Opt_DeriveDataTypeable'
stack overflow: use +RTS -K<size> to increase it
Line 60: Line 93:
Apply the following patch to hake/Main.hs: [[https://lists.inf.ethz.ch/pipermail/barrelfish-users/attachments/20110519/833cc2f8/attachment.obj|Main.hs.patch]] Try to avoid having the build directory in the source tree
Line 64: Line 97:
Now we can build Barrelfish: Now we can build Barrelfish. The following target builds the basic binaries for X86.
Line 66: Line 99:
make make X86_64_Basic
Line 71: Line 104:
make -j 5 make -j 5 X86_64_Basic
Line 76: Line 109:
make sim make qemu_x86_64
Line 78: Line 111:
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.
To change options for QEMU, such as allocating more cores, you might want to execute the '''tools/qemu_wrapper.sh''' directly.
The following commands allocates 4 cores.
{{{{
../tools/qemu-wrapper.sh --menu ./platforms/x86/menu.lst.x86_64 --arch x86_64 --smp 4
}}}}

Line 82: Line 122:
=== QEMU-kvm ===
If you get the following error when booting Barrelfish:
=== 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:
Line 85: Line 125:
ERROR: pci.0 in AcpiOsInstallInterruptHandler() ../usr/pci/acpica_osglue.c:831
ERROR: failed to route interrupt
Failure: ( pci) Unknown global system interrupt number [PCI_ERR_UNKNOWN_GSI]
Assertion failed on core 0 in pci: r == 0, function init_acpi, file ../usr/pci/acpi.c, line 725.
Aborted
/usr/bin/ld: fatal error: -pie and -static are incompatible
collect2: error: ld returned 1 exit status
make: *** [x86_64/sbin/cpu] Error 1
Line 91: Line 129:
This is most likely due to Barrelfish being run inside QEMU-kvm.
To fix this you can add '-no-kvm' to the QEMU_CMD in build/symbolic_targets.mk
Alternatively, if you have an intel CPU, you can issue the following command as root: 'rmmod kvm_intel kvm'
Line 95: Line 130:
=== GHC 6.12.2 ===
There is a bug in some versions of GHC 6.12.2 on ubuntu and GHC 6.12.1 which causes the Barrelfish build to fail.
If you see errors like the following:
{{{{
../tools/fof/IL/FoF/Compile.lhs:71:18:
    Can't find interface-file declaration for variable freshVar
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression: freshVar binding
    In the definition of `loc': loc = freshVar binding
    In the definition of `getFreshVar':
        getFreshVar binding
                      = (loc, binding1)
                      where
                          loc = freshVar binding
                          binding1 = binding {freshVar = loc + 1}
 
../tools/fof/IL/FoF/Compile.lhs:72:23:
    Can't find interface-file declaration for variable freshVar
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression: binding {freshVar = loc + 1}
    In the definition of `binding1':
        binding1 = binding {freshVar = loc + 1}
    In the definition of `getFreshVar':
        getFreshVar binding
                      = (loc, binding1)
                      where
                          loc = freshVar binding
                          binding1 = binding {freshVar = loc + 1}
 
../tools/fof/IL/FoF/Compile.lhs:92:6:
    Can't find interface-file declaration for variable freshVar
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the expression:
        stableBinding
          {freshVar = freshVar upBinding, defStructs = defStructs upBinding,
           defUnions = defUnions upBinding, defEnums = defEnums upBinding}
    In the definition of `passFreshVar':
        passFreshVar upBinding stableBinding
                       = stableBinding
                           {freshVar = freshVar upBinding, defStructs = defStructs upBinding,
                            defUnions = defUnions upBinding, defEnums = defEnums upBinding}
}}}}
Upgrade your version of GHC if possible, or compile and install a newer version of GHC from source and prepend the path where it is installed to your PATH variable.
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.

To run Barrelfish on the Pandaboard, have a look at PandaBoard.

Requirements

Barrelfish requires the following tools to compile correctly:

  • GCC 5.4.0
  • GNU binutils 2.26.1 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 (16.04.x) 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 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 freebsd-glue libelf-freebsd-dev libusb-1.0-0-dev qemu-utils gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
$ cabal install bytestring-trie

Note: Sometimes cabal fails because its repository, hackage.haskell.org, is down. In this case a mirror can be used, for example as documented in https://www.fpcomplete.com/blog/2015/03/hackage-mirror.

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
    • freebsd-glue
    • libelf-freebsd-dev
    • and via Cabal: bytestring-trie

GHC Versions

7.10.3 is the version we use internally (read: the version Ubuntu 16.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

Valid arm targets are:

../hake/hake.sh -s .. -a armv7

or (experimental)

../hake/hake.sh -s .. -a armv8 

To see what make targets are available for building Barrelfish run

make help-platforms

To see what make targets are available for running Barrelfish run

make help-boot

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. The following target builds the basic binaries for X86.

make X86_64_Basic

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 X86_64_Basic

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

make qemu_x86_64

To change options for QEMU, such as allocating more cores, you might want to execute the tools/qemu_wrapper.sh directly. The following commands allocates 4 cores.

../tools/qemu-wrapper.sh --menu ./platforms/x86/menu.lst.x86_64 --arch x86_64  --smp 4

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)