You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Description**
The Linux section of the README lists GHC and Cabal as dependencies, but
more packages are needed. Specifically, in a fresh new Ubuntu as
provided via the Docker hub, users also need to install `libz-dev` and
`pkg-config`. The programs `alex` and `happy` also need to be available.
The instructions should be updated to include those packages.
**Type**
- Bug: Installation instructions are incomplete.
**Additional context**
None.
**Requester**
- Martin Halle (Technische Universität Hamburg, TUHH).
**Method to check presence of bug**
Installing Copilot in a fresh Ubuntu image with only GHC and Cabal
produces the following error:
```
Configuring zlib-0.7.1.0...
cabal: The program 'pkg-config' version >=0.9.0 is required but it could not
be found.
```
Adding that program reports similar errors regarding the packages listed above.
**Expected result**
Replicating the installation instructions from the README in a fresh
Docker Ubuntu image should render an installation capable of Compiling
one of the sample specifications included with Copilot.
The following Dockerfile and auxiliary file use the installation
instructions in the README to install Copilot from scratch in a fresh
Ubuntu image and compile a Copilot example, after which it prints the
message "Success". We slightly modify the instructions to remove sudo,
which is available in most Linux distributions and not needed when
running in Docker as root, add --yes as an argument to apt-get to avoid
being prompted for confirmation, and add copilot-c99 as a package to be
installed by Cabal, so that it is exposed to the user:
```
--- Dockerfile-verify-591
FROM ubuntu:jammy
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install --yes ghc cabal-install alex happy pkg-config libz-dev
WORKDIR copilot
RUN cabal update
RUN cabal v2-install --lib copilot copilot-c99
ADD Heater.hs /tmp/Heater.hs
RUN runhaskell /tmp/Heater.hs
--- Heater.hs
module Main where
import Language.Copilot
import Copilot.Compile.C99
import Prelude hiding ((>), (<), div)
-- External temperature as a byte, range of -50C to 100C
temp :: Stream Word8
temp = extern "temperature" Nothing
-- Calculate temperature in Celsius.
-- We need to cast the Word8 to a Float. Note that it is an unsafeCast, as there
-- is no direct relation between Word8 and Float.
ctemp :: Stream Float
ctemp = (unsafeCast temp) * (150.0 / 255.0) - 50.0
spec = do
-- Triggers that fire when the ctemp is too low or too high,
-- pass the current ctemp as an argument.
trigger "heaton" (ctemp < 18.0) [arg ctemp]
trigger "heatoff" (ctemp > 21.0) [arg ctemp]
-- Compile the spec
```
This case does not require running the image; building it is enough to
carry out the test.
**Solution implemented**
Update README to include `libz-dev`, `pkg-config`, `alex` and `happy` in
the `apt-get` line under "Other Linux distributions".
Adjust preceding text to indicate that these are all dependencies, not
just the Haskell toolchain.
**Further notes**
None.
0 commit comments