I'm trying to run the command "cabal build" the Week02 code of plutus-pioneer-program but it has this error and I have tried everything but the same error keeps appear:

Failed to build lzma-
Build log (
Configuring library for lzma-
Preprocessing library for lzma-
compiling dist/build/LibLzma_hsc_make.c failed (exit code 1)
rsp file was: "dist/build/hsc2hscall1082370-0.rsp"
command was: /nix/store/d2fqghv083a8q7j8sjb2m5q6i840h691-gcc-wrapper-10.2.0/bin/cc -c dist/build/LibLzma_hsc_make.c -o dist/build/LibLzma_hsc_make.o -D__GLASGOW_HASKELL__=810 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Idist/build/autogen -Idist/build/global-autogen -include dist/build/autogen/cabal_macros.h -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc- -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc- -I/nix/store/grcf3skqwdw35pki3d0gf7mj0flskni7-gmp-6.2.1-dev/include -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc- -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc- -I/nix/store/wxb1awkkkbjp26jwqf854488qbzlkk25-libffi-3.3-dev/include -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc-
error: LibLzma.hsc:44:10: fatal error: lzma.h: No such file or directory
compilation terminated.

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

Here are the steps I do:

  1. cd into plutus-apps directory then
$ git checkout 81ba78edb1d634a13371397d8c8b19829345ce0d
$ nix-shell
  1. Now I'm inside the nix-shell, I cd into plutus-pioneer-program's Week2 code and then run
[nix-shell:.../plutus-pioneer-program/code/week02]# cabal update
[nix-shell:.../plutus-pioneer-program/code/week02]# cabal build

That's all, the error above appears. After investigating, I think the error is caused by missing lzma.h, I installed liblzma-dev from this thread, but the error remains.

Can anyone help me out please? Thank you very much!

  • I am also facing the same issue. Have you found any solution?
    – χerфmiи
    Nov 16, 2022 at 8:10

2 Answers 2


After the command


execute in the shell

nix-shell -p lzma

I believe you are using the wrong git commit for plutus-apps for week02. It should be 6aff97d596ac9d59460aab5c65627b1c8c0a1528 according to https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week02/cabal.project#L63

In other words, you should cd into the plutus-apps directory and then:

$ git checkout 6aff97d596ac9d59460aab5c65627b1c8c0a1528
$ nix-shell

And then proceed with the rest of the process the same way you were doing before.

Your Answer

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

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