1

Summary

When running cabal repl inside any week in the Plutus Pioneer Program, it fails with the error message:

cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: lzma.h
* Missing (or bad) C library: lzma
  • However, when running which lzma I get a path to /Applications/anaconda3/bin/lzma
  • Also when trying to brew install lzma I am told that lzma is now included in xz.

Overview/Description

When trying to build the cabal repl for the Plutus Pioneer Program on macOS Monterrey, cabal fails with an error message stating it can't find the lzma library. I've tried using cabal new-build --extra-include-dirs="<path to lzma>" (the path I got from running which lzma on the terminal) and extra-include-dirs: /opt/homebrew/include extra-lib-dirs: /opt/homebrew/lib to no avail.

Steps to Reproduce

Following the instructions on cardanoacademy, cardano stack exchange, and IOG's technical community discord to build the cabal repl for the Plutus Pioneer Program.

  1. Inside plutus-apps - git checkout 3746610e53654a1167aeb4c6294c6096d16b0502
  2. Run command nix-shell
  3. Inside nix-shell - git checkout (tag of the corresponding week on the cabal.project file, e.g. ee59880f47ab835dbd73bea0847dab7869fc20d8 for week01).
  4. Run command Cabal update
  5. Run command Cabal repl

Test Results

Failed to build lzma-0.0.0.3. The failure occurred during the configure step.
Build log (
/Users/macadmin/.cabal/logs/ghc-8.10.2.20201118/lzm-0.0.0.3-09eda932.log ):
Configuring library for lzma-0.0.0.3..
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: lzma.h
* Missing (or bad) C library: lzma
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

cabal: Failed to build lzma-0.0.0.3 (which is required by
plutus-pioneer-program-week01-0.1.0.0). See the build log above for details.

Environment Setup and Configuration

OS: macOS Monterrey version 12.4 Model Name: MacBook Pro

Any help or guidance would be greatly appreciated.

3
  • which lzma likely returned the path to the executable. extra-include-dirs probably wants a path to source code eg source for lzma. Try locate lzma.h (or similar command for Mac) to see if it's on your system and use that path in extra-include-dirs. If it isn't you should be able to locate and install the lzma source. Jul 7, 2022 at 2:28
  • Looks like 'liblzma-dev' is the source package that you want to install, and you might need to use --extra-lib-dirs instead. Jul 7, 2022 at 2:36
  • @MC_Brisbane-JUSTPool I did locate lzma.h and got a list of paths, I tried them all with --extra-include-dirs and still the same issue, plus an added treat of Not in scope: type constructor or class ‘GHC.GenTickish’ which I'm also looking into. I've tried brew install liblzma-dev and get lzma is now part of the xz formula. Weird thing is, I can see lzma.h all over the place, how does it not see it? I've even tried installing the Haskell package and nothing.
    – mayanhavoc
    Jul 13, 2022 at 17:52

1 Answer 1

2

Two weeks just to realize I hand't followed instructions properly. To be completely fair, it's hard to find documentation that links setting up the plutus playground with the plutus pioneer program, but the information is there.

The problem is simple, I was using the wrong git checkout tag. I was using this reference and incorrectly assumed that the git checkout for the plutus pioneer program's respective week was to be done inside the nix-shell.

It is not. IOHK's guide is pretty straightforward, complete and up to date as far as I can tell.

Basically,

  1. The git checkout for the respective week needs to be done first inside the /plutus-apps directory (i.e. git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a for week01)
  2. Run nix-shell
  3. Inside the nix-shell navigate to the plutus-pioneer-program/code/<week no> and run cabal update,
  4. Run cabal build
  5. Run cabal repl
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.