<p>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.</p>
<p>The problem is simple, I was using the wrong <strong>git checkout tag</strong>. I was using <a href="https://tutorials.cardanoacademy.io/plutus-pioneer-program/setting-up-plutus-playground/cloning-plutus-repository" rel="nofollow noreferrer">this reference</a> and incorrectly assumed that the <code>git checkout</code> for the plutus pioneer program's respective week was to be done <strong>inside</strong> the <code>nix-shell</code>.</p>
<p><strong>It is not</strong>. <a href="https://iohk.zendesk.com/hc/en-us/articles/4415402727321-Running-a-local-version-of-Plutus-playground" rel="nofollow noreferrer">IOHK's guide</a> is pretty straightforward, complete and up to date as far as I can tell.</p>
<p>Basically,</p>
<ol>
<li>The git checkout for the respective week needs to be done first inside the <code>/plutus-apps</code> directory (i.e. <code>git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a</code> for week01)</li>
<li>Run <code>nix-shell</code></li>
<li>Inside the <code>nix-shell</code> navigate to the <code>plutus-pioneer-program/code/&lt;week no&gt;</code> and run <code>cabal update</code>,</li>
<li>Run <code>cabal build</code></li>
<li>Run <code>cabal repl</code></li>
</ol>

CC BY-SA 4.0
2022-07-14T04:05:43.827Z
Glad you got it working.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-07-14T00:41:04.310Z
2022-07-14T00:41:04.310Z
mayanhavoc
<h2>Summary</h2>
<p>When running cabal repl inside any week in the Plutus Pioneer Program, it fails with the error message:</p>
<pre><code>cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: lzma.h
* Missing (or bad) C library: lzma
</code></pre>
<ul>
<li>However, when running <code>which lzma</code> I get a path to <code>/Applications/anaconda3/bin/lzma</code></li>
<li>Also when trying to <code>brew install lzma</code> I am told that <code>lzma</code> is now included in <code>xz</code>.</li>
</ul>
<h2>Overview/Description</h2>
<p>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 <code>cabal new-build --extra-include-dirs=&quot;&lt;path to lzma&gt;&quot;</code> (the path I got from running <code>which lzma</code> on the terminal) and <code>extra-include-dirs: /opt/homebrew/include  extra-lib-dirs: /opt/homebrew/lib</code> to no avail.</p>
<h2>Steps to Reproduce</h2>
<p>Following the instructions on <a href="https://tutorials.cardanoacademy.io/plutus-pioneer-program/setting-up-plutus-playground/cloning-plutus-repository" rel="nofollow noreferrer">cardanoacademy</a>, <a href="https://cardano.stackexchange.com/questions/6287/lessons-learned-setting-up-plutus-playground-feedback-welcome">cardano stack exchange</a>, and IOG's technical community discord to build the cabal repl for the Plutus Pioneer Program.</p>
<ol>
<li>Inside plutus-apps - git checkout 3746610e53654a1167aeb4c6294c6096d16b0502</li>
<li>Run command <code>nix-shell</code></li>
<li>Inside <code>nix-shell</code> - <code>git checkout</code> (tag of the corresponding week on the cabal.project file, e.g. ee59880f47ab835dbd73bea0847dab7869fc20d8 for week01).</li>
<li>Run command <code>Cabal update</code></li>
<li>Run command <code>Cabal repl</code></li>
</ol>
<h2>Test Results</h2>
<pre><code>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 &quot;-dev&quot; 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.
</code></pre>
<h2>Environment Setup and Configuration</h2>
<p>OS: macOS Monterrey version 12.4
Model Name: MacBook Pro</p>
<p>Any help or guidance would be greatly appreciated.</p>

CC BY-SA 4.0
2022-07-07T02:28:01.710Z
`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.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-07-07T02:36:56.490Z
Looks like 'liblzma-dev' is the source package that you want to install, and you might need to use `--extra-lib-dirs` instead.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-07-13T17:52:10.093Z
@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
<plutus-pioneer-program><cabal><repl>
Cabal repl fails because of missing dependency lzma
# Cabal repl fails because of missing dependency lzma

(Asked by: username_0 on 2022-07-07)

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="" (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.

Inside plutus-apps - git checkout 3746610e53654a1167aeb4c6294c6096d16b0502
Run command nix-shell
Inside nix-shell - git checkout (tag of the corresponding week on the cabal.project file, e.g. ee59880f47ab835dbd73bea0847dab7869fc20d8 for week01).
Run command Cabal update
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.

**Tags:** plutus-pioneer-program, cabal, repl
> **Comments:**
> **username_1**: `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.  
> **username_1**: Looks like 'liblzma-dev' is the source package that you want to install, and you might need to use `--extra-lib-dirs` instead.  
> **username_0**: @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.  

---

## 1 answers

### Answer by username_0 on 2022-07-14. Score: 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](https://tutorials.cardanoacademy.io/plutus-pioneer-program/setting-up-plutus-playground/cloning-plutus-repository) 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](https://iohk.zendesk.com/hc/en-us/articles/4415402727321-Running-a-local-version-of-Plutus-playground) 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/` and run `cabal update`,
4. Run `cabal build`
5. Run `cabal repl`

> **Comments:**
> **username_1**: Glad you got it working.  

---

