0

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

2 Answers 2

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.

11
  • 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 :( Apr 18, 2023 at 2:02
  • Are you on Debian or a Debian derived system? If so, which one? Apr 18, 2023 at 3:55
  • 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" Apr 19, 2023 at 8:27
  • 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. Apr 19, 2023 at 12:09
  • Just checked, they're both already enabled :/ Apr 19, 2023 at 20:58
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

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.