Use of GHC in Open Embedded Environments

dpquigl dpquigl at tycho.nsa.gov
Mon Apr 6 14:27:36 UTC 2015


Hello Everyone,

I sent a couple of private messages to Simon and he suggested I post to
the list instead to get more eyes on the problem.

I have been working for the better part of 3 days on trying to get GHC
to build within an Open Embedded environment. Open Embedded is used to
set up embedded build environments that are completely isolated from the
build  platform. The problem I'm encountering is due to the way GHC
builds its requiring the build and host platforms to be the same. I want
to create a GHC build where the build and host are different so I can
guarantee the isolation of the Haskell used to build our programs and
libraries on target. I looked extensively through the cross compilation
wiki page and even tried specifying paths into configure script to
specify the tools from within my toolchain to build with and I am still
running into problems. It seems that even if the top level makefile gets
configured properly the build environment for the modules created with
cabal under libraries do not retain any of that configuration
information.

The reason this is important is that I'm working on OpenXT which is a
recently Open Sources version of a product Citrix use to have called Xen
Client XT. The idea of OpenXT is that we use Xen to decompose what is
traditionally a monolithic system into several VMs which serve specific
purposes. For example we have the user interface for the platform which
manages things like sound levels and bringing up and shutting down VMs
into its own domain called the UI domain. We also separate out
networking into its own domain as well where the network card is mapped
exclusively into that domain and it manages creating and running virtual
network adapters for other VMs on the platform.

We use haskell in two different ways in this system. We personally want
to use OpenXT as a research platform and we have special purpose mini
domains for doing things like measurement and attestation and we have
components of these written in Haskell to do formal verification of the
domains. What OpenXT is using Haskell for directly is as part of its
management engine for the platform. We have a haskell and ocaml(just for
glue) based versions of metadata storage and platform management APIs.
Now when we build the platform we want to remove the dependency on the
host platform GHC version. We try to do this by building what would
essentially be a stage 1 compiler which will then be used to build the
runtime and tools used in the final platform VMs. The issue is that the
GHC build does not recognize the use case of host and build machines
being different. They expect host and build to be the same and target to
be different. Because of this even if we specify each component
individually on the configure line for the base GHC build when the build
gets to the point of building the libraries it seems to have this
information completely vanish. I think this is because it is using cabal
to build the libraries and cabal isn't taking into account that GHC is
built for a second platform and we want to build those libraries for
that same platform.

Dave



More information about the ghc-devs mailing list