<p>You are missing a C header file. Specifically, the part of the error message:</p>
<pre><code>* Missing (or bad) header file: crypto_scrypt.h
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.
</code></pre>
<p>On Debian based Linux systems (eg Debian, Ubuntu, Mint and probably others),
you can used <code>apt-file</code> to find which packages provides the file:</p>
<pre><code>&gt; apt-file search crypto_scrypt.h
libnode-dev: /usr/include/nodejs/src/crypto/crypto_scrypt.h
</code></pre>
<p>so that installing the <code>libnode-dev</code> package (part of <code>nodejs</code>):</p>
<pre><code>sudo apt install libnode-dev
</code></pre>
<p>will sort your problems out.</p>

CC BY-SA 4.0
2023-04-18T02:02:10.603Z
Hey thanks for your reply! When i run `apt-file search crypto_scrypt.h` nothing comes back, and installing `libnode-dev` didnt change the error message unfortunately :(
NaeriKailash
CC BY-SA 4.0
2023-04-18T03:55:05.033Z
Are you on Debian or a Debian derived system? If so, which one?
Erik de Castro Lopo
CC BY-SA 4.0
2023-04-19T08:27:48.723Z
My machine is a mac with m2 chip, but cabal is running in docker and this is the info about the image:
`cat /etc/os-release`
```NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
```
NaeriKailash
CC BY-SA 4.0
2023-04-19T12:09:13.393Z
If you are running in docker supposedly its supposed to act just like Ubuntu on `x86-64` . Maybe you need to add the `universe` and `multiverse` repos for Ubuntu.
Erik de Castro Lopo
CC BY-SA 4.0
2023-04-19T20:58:08.723Z
Just checked, they're both already enabled :/
NaeriKailash
CC BY-SA 4.0
2023-04-20T03:44:39.680Z
The Ubuntu version you are using is from 2020 (`VERSION="20.04.5 LTS (Focal Fossa)"`), Maybe try the most recent LTS version which should be `22.???`.
Erik de Castro Lopo
CC BY-SA 4.0
2023-04-21T02:27:50.403Z
hey I upgraded to 22.04 and now a whole bunch of other packages are broken/cant be found too and the scrypt error remains the same.. im wondering if i should try running cabal a different way >.< this is crazy complicated
NaeriKailash
CC BY-SA 4.0
2023-04-22T02:25:02.610Z
Which packages? Haskell packages or others?
Erik de Castro Lopo
CC BY-SA 4.0
2023-04-23T21:36:06.213Z
Here are the new errors:

<no location info>: error:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM between [9 and 13)
ghc: could not execute: opt-10
cabal: Failed to build scrypt-0.5.0 (which is required by
elysium-contract-0.1.0.0)
Failed to build streaming-commons-0.2.2.1 (which is required by
elysium-contract-0.1.0.0)
Failed to build x509-store-1.6.7 (which is required by
elysium-contract-0.1.0.0)
Failed to build zlib-bindings-0.1.1.5 (which is required by
elysium-contract-0.1.0.0)
NaeriKailash
CC BY-SA 4.0
2023-04-23T21:36:21.930Z
> opt --version
Ubuntu LLVM version 14.0.0
  
  Optimized build.
  Default target: aarch64-unknown-linux-gnu
  Host CPU: (unknown)
NaeriKailash
CC BY-SA 4.0
2023-04-24T00:31:14.523Z
If these are non-Haskell packages (ie LLVM) this is an Ubuntu problem.
Erik de Castro Lopo
CC BY-SA 4.0
2023-04-18T00:00:50.907Z
2023-04-18T00:00:50.907Z
Erik de Castro Lopo
<p>I have had this issue with setting up the environment on aarch64 M1 Mac, even within a Ubuntu VM on the same chip. The scrypt component fails due to its current support being limited to x86. More details can be found in this GitHub issue. <a href="https://github.com/informatikr/scrypt/issues/8" rel="nofollow noreferrer">https://github.com/informatikr/scrypt/issues/8</a></p>
<p>The best way around it is either a x86 machine or an x86 VM. I have setup mine as remote server. Life is easier this way</p>
<p>If someone did want to try to build it on a aarch64 I would recommend somehow making the build use this fork <a href="https://github.com/SupercedeTech/scrypt" rel="nofollow noreferrer">https://github.com/SupercedeTech/scrypt</a> which is compatible</p>

CC BY-SA 4.0
2023-10-18T11:19:44.460Z
2023-10-18T11:19:44.460Z
Safi Ullah
<p>I'm trying to run my own little smart contract in the <code>plutus-pioneer-program</code> [fourth iteration] docker container and I'm having some problems. I've just added an extra folder alongside the other weeks. I've built this same code on other environments just fine but I got a new laptop with an M2 chip recently so my setup all broke and I figured running it in this environment would be the fastest way forward. I've narrowed the issue down to the <code>playground-common</code> package that my build depends on. The problem is that when I run <code>cabal build all</code> in my folder I get this error:</p>
<pre><code>Build log (
/root/.cabal/logs/ghc-8.10.7/scrypt-0.5.0-833a2feabba78b918876049577f7c64bc2870cc56e8d7720fba2aa8ea196973a.log
):
Configuring library for scrypt-0.5.0..
cabal-3.6.2.0: Missing dependency on a foreign library:
* Missing (or bad) header file: crypto_scrypt.h
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 scrypt-0.5.0 (which is required by
elysium-contract-0.1.0.0). See the build log above for details.
</code></pre>
<p>I havent changed anything else in the project other than adding an additional folder under <code>code</code>. Has something changed with the <code>playground-common</code> package?</p>
<p>I also tried adding this configuration to a <code>cabal.project.local</code> file, but no luck:</p>
<pre><code>flags: -scrypt
tests: False
benchmarks: False
optimization: 2
</code></pre>
<p>Using cabal version <code>3.4</code>, base <code>^&gt;=4.14.1.3.0</code>
Other config:</p>
<pre><code>                     , base ^&gt;=4.14.1.3.0
                     , bytestring
                     , cardano-api
                     , containers
                     , data-default
                     , playground-common
                     , plutus-ledger-api
                     , plutus-tx-plugin
                     , plutus-tx
                     , serialise
                     , text
  default-language:    Haskell2010
  ghc-options:         -Wall -fobject-code -fno-ignore-interface-pragmas
                       -fno-omit-interface-pragmas -fno-strictness 
                       -fno-spec-constr -fno-specialise -fexpose-all-unfoldings
                       -fplugin-opt PlutusTx.Plugin:defer-errors
</code></pre>

<plutus><plutus-pioneer-program><smart-contract><cabal>
playground-common package giving 'Failed to build scrypt-0.5.0' error
# playground-common package giving 'Failed to build scrypt-0.5.0' error

(Asked by: username_0 on 2023-04-17)

I'm trying to run my own little smart contract in the plutus-pioneer-program [fourth iteration] docker container and I'm having some problems. I've just added an extra folder alongside the other weeks. I've built this same code on other environments just fine but I got a new laptop with an M2 chip recently so my setup all broke and I figured running it in this environment would be the fastest way forward. I've narrowed the issue down to the playground-common package that my build depends on. The problem is that when I run cabal build all in my folder I get this error:
Build log (
/root/.cabal/logs/ghc-8.10.7/scrypt-0.5.0-833a2feabba78b918876049577f7c64bc2870cc56e8d7720fba2aa8ea196973a.log
):
Configuring library for scrypt-0.5.0..
cabal-3.6.2.0: Missing dependency on a foreign library:
* Missing (or bad) header file: crypto_scrypt.h
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 scrypt-0.5.0 (which is required by
elysium-contract-0.1.0.0). See the build log above for details.

I havent changed anything else in the project other than adding an additional folder under code. Has something changed with the playground-common package?
I also tried adding this configuration to a cabal.project.local file, but no luck:
flags: -scrypt
tests: False
benchmarks: False
optimization: 2

Using cabal version 3.4, base ^>=4.14.1.3.0
Other config:
                     , base ^>=4.14.1.3.0
                     , bytestring
                     , cardano-api
                     , containers
                     , data-default
                     , playground-common
                     , plutus-ledger-api
                     , plutus-tx-plugin
                     , plutus-tx
                     , serialise
                     , text
  default-language:    Haskell2010
  ghc-options:         -Wall -fobject-code -fno-ignore-interface-pragmas
                       -fno-omit-interface-pragmas -fno-strictness 
                       -fno-spec-constr -fno-specialise -fexpose-all-unfoldings
                       -fplugin-opt PlutusTx.Plugin:defer-errors

**Tags:** plutus, plutus-pioneer-program, smart-contract, cabal

---

## 2 answers

### Answer by username_1 on 2023-04-18. Score: 0

You are missing a C header file. Specifically, the part of the error message:
* Missing (or bad) header file: crypto_scrypt.h
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.

On Debian based Linux systems (eg Debian, Ubuntu, Mint and probably others),
you can used apt-file to find which packages provides the file:
> apt-file search crypto_scrypt.h
libnode-dev: /usr/include/nodejs/src/crypto/crypto_scrypt.h

so that installing the libnode-dev package (part of nodejs):
sudo apt install libnode-dev

will sort your problems out.

> **Comments:**
> **username_0**: Hey thanks for your reply! When i run `apt-file search crypto_scrypt.h` nothing comes back, and installing `libnode-dev` didnt change the error message unfortunately :(  
> **username_1**: Are you on Debian or a Debian derived system? If so, which one?  
> **username_0**: My machine is a mac with m2 chip, but cabal is running in docker and this is the info about the image: `cat /etc/os-release` ```NAME="Ubuntu" VERSION="20.04.5 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.5 LTS" VERSION_ID="20.04" ```  
> **username_1**: If you are running in docker supposedly its supposed to act just like Ubuntu on `x86-64` . Maybe you need to add the `universe` and `multiverse` repos for Ubuntu.  
> **username_0**: Just checked, they're both already enabled :/  
> **username_1**: The Ubuntu version you are using is from 2020 (`VERSION="20.04.5 LTS (Focal Fossa)"`), Maybe try the most recent LTS version which should be `22.???`.  
> **username_0**: hey I upgraded to 22.04 and now a whole bunch of other packages are broken/cant be found too and the scrypt error remains the same.. im wondering if i should try running cabal a different way >.< this is crazy complicated  
> **username_1**: Which packages? Haskell packages or others?  
> **username_0**: Here are the new errors:  <no location info>: error:     Warning: Couldn't figure out LLVM version!              Make sure you have installed LLVM between [9 and 13) ghc: could not execute: opt-10 cabal: Failed to build scrypt-0.5.0 (which is required by elysium-contract-0.1.0.0) Failed to build streaming-commons-0.2.2.1 (which is required by elysium-contract-0.1.0.0) Failed to build x509-store-1.6.7 (which is required by elysium-contract-0.1.0.0) Failed to build zlib-bindings-0.1.1.5 (which is required by elysium-contract-0.1.0.0)  
> **username_0**: > opt --version Ubuntu LLVM version 14.0.0      Optimized build.   Default target: aarch64-unknown-linux-gnu   Host CPU: (unknown)  
> **username_1**: If these are non-Haskell packages (ie LLVM) this is an Ubuntu problem.  

---

### Answer by username_2 on 2023-10-18. Score: 0

I have had this issue with setting up the environment on aarch64 M1 Mac, even within a Ubuntu VM on the same chip. The scrypt component fails due to its current support being limited to x86. More details can be found in this GitHub issue. <https://github.com/informatikr/scrypt/issues/8>

The best way around it is either a x86 machine or an x86 VM. I have setup mine as remote server. Life is easier this way

If someone did want to try to build it on a aarch64 I would recommend somehow making the build use this fork <https://github.com/SupercedeTech/scrypt> which is compatible


---

