[SOLVED] Failure of cardano-node build (dependency issue)

While building cardano-node from source, using :

$ cabal -v build cardano-node

There is a systematic failure apparently pertaining to a dependency issue. However, I installed every required dependency mentioned in the documentation, I also tried upgrading ghc to 8.10.4. It appears that the root cause is indeed /tmp file system being mounted with flags `noexec’ (common security measure).

Compilation logs (hic sunt dracones)
Using ld found on system at: /usr/bin/ld.gold
Using pkg-config version 0.29.2 found on system at: /usr/bin/pkg-config
Using runghc version 8.10.4 found on system at: /usr/local/bin/runghc-8.10.4
Using strip version 2.35 found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
Component build order: library
/usr/local/bin/ghc-pkg-8.10.4 init dist/package.conf.inplace
creating dist/build
creating dist/build/autogen
creating dist/build/autogen
Preprocessing library for th-orphans-0.13.11..
Building library for th-orphans-0.13.11..
creating dist/build
/usr/local/bin/ghc-8.10.4 --make -fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -idist/build/global-autogen -Idist/build/autogen -Idist/build/global-autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -this-unit-id th-orphans-0.13.11-bc6d1defe77cbdee4ce1b13900dfcf7bfa6a03e0c1b75296ae151bc8951da94f -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/xxxxxxx/.cabal/store/ghc-8.10.4/package.db -package-db dist/package.conf.inplace -package-id base- -package-id mtl-2.2.2 -package-id template-haskell- -package-id th-compat-0.1.2-d27ac856dec8c28ef3a10ee6e1b5096cccb90c3b120cf83a7ec953297d678a7f -package-id th-lift-0.8.2-3df3c85ae4b51b59aa779ddfd371e1ef04a08fea56c6bc0d3f4eb3244e5f00f5 -package-id th-lift-instances-0.1.18-c922ba81f113bb068dd922d8caecc87c25b143d38851baca3fbac63b2544806d -package-id th-reify-many-0.1.9-409fd9217fb040a8a61c2933f9703291ff548974de219f262c8b5188db52835b -XHaskell2010 Language.Haskell.TH.Instances Language.Haskell.TH.Instances.Internal -Wall -Wno-star-is-type -hide-all-packages
[1 of 2] Compiling Language.Haskell.TH.Instances.Internal ( src/Language/Haskell/TH/Instances/Internal.hs, dist/build/Language/Haskell/TH/Instances/Internal.o, dist/build/Language/Haskell/TH/Instances/Internal.dyn_o )
[2 of 2] Compiling Language.Haskell.TH.Instances ( src/Language/Haskell/TH/Instances.hs, dist/build/Language/Haskell/TH/Instances.o, dist/build/Language/Haskell/TH/Instances.dyn_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.10.4:
  Loading temp shared object failed: /tmp/ghc54158_0/libghc_10.so: failed to map segment from shared object

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

cabal: Failed to build byron-spec-chain- because it depends on
byron-spec-chain- which itself failed to build.
Failed to build byron-spec-ledger- because it depends on
byron-spec-ledger- which itself failed to build.
Failed to build cardano-api-1.27.0 because it depends on cardano-api-1.27.0
which itself failed to build.
Failed to build cardano-ledger-byron-test-1.3.0 because it depends on
cardano-ledger-byron-test-1.3.0 which itself failed to build.
Failed to build goblins- because it depends on goblins- which
itself failed to build.
Failed to build shelley-spec-ledger-test- because it depends on
shelley-spec-ledger-test- which itself failed to build.
Failed to build small-steps-test- because it depends on
small-steps-test- which itself failed to build.
Failed to build
Failed to build th-utilities- because it depends on
th-utilities- which itself failed to build.

ghc is not supposed to panic because of the failure of one compilation step, in this case it needed to execute code on another file system. This bug has been reported to GHC team¹. In the meantime and since the dependency error and the panic message are not quite self-explanatory, I let this post in case it might be useful to anyone else. So, up until a fix is published, it is sufficient to remount /tmp with `exec’ flag like so :

$ sudo mount -o remount,exec /tmp

and put `noexec’ back on after compilation success.

¹: GHC version 8.10.4 panic! (the ‘impossible’ happened, indeed)

1 Like