Skip to content

Commit da787ad

Browse files
Merge branch 'develop-missing-dependencies'. Close #591.
**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.
2 parents f055d82 + b3bc4e4 commit da787ad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

copilot/CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2025-01-30
2+
* Include missing dependencies in installation instructions. (#591)
3+
14
2025-01-07
25
* Version bump (4.2). (#577)
36
* Bump upper version constraint on filepath. (#570)

copilot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ Copilot you must install a Haskell compiler (GHC) and the package manager
102102
Cabal. We currently support all versions of GHC from 8.6.5 to modern versions
103103
(9.8 as of this writing). You can install the toolchain using
104104
[ghcup](https://www.haskell.org/ghcup/) or, if you are on Debian/Ubuntu,
105-
directly with `apt-get`:
105+
you can use `apt-get` to install all dependencies as follows:
106106

107107
```sh
108-
$ sudo apt-get install ghc cabal-install
108+
$ sudo apt-get install ghc cabal-install alex happy pkg-config libz-dev
109109
```
110110

111111
Once the compiler is installed, install Copilot from

0 commit comments

Comments
 (0)