cardano-shell icon indicating copy to clipboard operation
cardano-shell copied to clipboard

nix-build, cabal new-build and stack build fails

Open chrissound opened this issue 5 years ago • 4 comments
trafficstars

Trying to build the project, am I missing something?

nix-build
 these derivations will be built:
  /nix/store/sxcvc319gj4zj2d5f5shnx8vsgzxbj6x-run-coveralls.drv
these paths will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/hxfbpz5lxmnmya58fqhiikk3vfqgysjy-ghc-shell-for-cardano-shell
copying path '/nix/store/hxfbpz5lxmnmya58fqhiikk3vfqgysjy-ghc-shell-for-cardano-shell' from 'https://hydra.iohk.io'...
building '/nix/store/sxcvc319gj4zj2d5f5shnx8vsgzxbj6x-run-coveralls.drv'...
unpacking sources
variable $src or $srcs should point to the source
builder for '/nix/store/sxcvc319gj4zj2d5f5shnx8vsgzxbj6x-run-coveralls.drv' failed with exit code 1
error: build of '/nix/store/sxcvc319gj4zj2d5f5shnx8vsgzxbj6x-run-coveralls.drv' failed
[nix-shell:~/NewProjects/Cardano/cardano-shell]$ ./cabal new-build cardano-shell
Warning: No remote package servers have been specified. Usually you would have
one specified in the config file.
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: cardano-launcher-0.1.0.0 (user goal)
[__1] unknown package: silently (dependency of cardano-launcher)
[__1] fail (backjumping, conflict set: cardano-launcher, silently)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-launcher, silently
stack build
You cannot have packages and a shell-file filled at the same time in your nix-shell configuration.

chrissound avatar Jan 05 '20 13:01 chrissound

@chrissound, regarding the second problem:

  1. it's cabal, not ./cabal
  2. inside the shell, you'll need to unset CABAL_CONFIG, as a first thing -- before running cabal new-build.

deepfire avatar Jan 17 '20 11:01 deepfire

@chrissound, regarding the first problem -- you're not supposed to use nix-build like that -- as you can see, the top-level default.nix provides several attributes:

~/cardano-shell$ nix repl
Welcome to Nix version 2.3.2. Type :? for help.

nix-repl> f = import ./. {}

nix-repl> f.   # press <TAB> here
f._lib          f.runCoveralls
f.nix-tools     f.shell

But I guess, the chief question is -- why do you want to build cardano-shell`? After all it's just a library, not an end-user executable.

deepfire avatar Jan 17 '20 11:01 deepfire

@chrissound, regarding the second problem:

  1. it's cabal, not ./cabal
  2. inside the shell, you'll need to unset CABAL_CONFIG, as a first thing -- before running cabal new-build.

Many thanks for your help!

Regarding 1 I was using that as the readme mentioned:

Cabal + Nix

There is an option of using just Cabal + Nix as well - use a small utility script (watch out, it's a dot before the cabal!) and work as you would usually if you develop with cabal:

./cabal new-build

cabal new-build still seems to fail but I think it's due to the issue here (https://github.com/NixOS/nixpkgs/issues/55995):

cabal new-build cardano-shell
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - assoc-1 (lib) (requires build)
 - base16-bytestring-0.1.1.6 (lib:base16-bytestring) (requires build)
 - canonical-json-0.6.0.0 (lib) (first run)
 - clock-0.8 (lib) (requires build)
 - exceptions-0.10.2 (lib) (requires build)
 - half-0.3 (lib) (requires build)
 - hashable-1.2.7.0 (lib) (requires build)
 - primitive-0.6.4.0 (lib) (requires build)
 - semigroups-0.19 (lib) (requires build)
 - transformers-base-0.4.5.2 (lib) (requires build)
 - safe-exceptions-0.1.7.0 (lib) (requires build)
 - uuid-types-1.0.3 (lib) (requires build)
 - unordered-containers-0.2.10.0 (lib) (requires build)
 - async-2.2.2 (lib) (requires build)
 - vector-0.12.0.3 (lib) (requires build)
 - scientific-0.3.6.2 (lib) (requires build)
 - cborg-0.2.2.0 (lib) (requires build)
 - atomic-primops-0.8.3 (lib) (requires build)
 - monad-control-1.0.2.3 (lib:monad-control) (requires build)
 - semigroupoids-5.3.2 (lib:semigroupoids) (requires download & build)
 - protolude-0.2.3 (lib) (requires build)
 - formatting-6.3.7 (lib) (requires build)
 - attoparsec-0.13.2.2 (lib) (requires build)
 - concurrency-1.7.0.0 (lib) (requires build)
 - aeson-1.4.4.0 (lib) (requires build)
 - these-1.0.1 (lib) (requires build)
 - nonempty-containers-0.3.1.0 (lib) (requires build)
 - cardano-prelude-0.1.0.0 (lib) (first run)
 - cardano-shell-0.1.0.0 (lib) (first run)
 - cardano-shell-0.1.0.0 (exe:node-ipc) (first run)
Downloading  semigroupoids-5.3.2
Starting     assoc-1 (lib)
Starting     base16-bytestring-0.1.1.6 (all, legacy fallback)
Starting     clock-0.8 (lib)
Starting     exceptions-0.10.2 (lib)
Starting     half-0.3 (lib)
Starting     semigroups-0.19 (lib)
Preprocessing library for canonical-json-0.6.0.0..
Starting     primitive-0.6.4.0 (lib)
Building library for canonical-json-0.6.0.0..
Starting     transformers-base-0.4.5.2 (lib)
Starting     hashable-1.2.7.0 (lib)
cabal: The program 'ar' is required but it could not be found.

Building     clock-0.8 (lib)
Building     half-0.3 (lib)
Building     assoc-1 (lib)
Building     exceptions-0.10.2 (lib)
Building     transformers-base-0.4.5.2 (lib)
Building     primitive-0.6.4.0 (lib)
Building     base16-bytestring-0.1.1.6 (all, legacy fallback)
Building     semigroups-0.19 (lib)
Building     hashable-1.2.7.0 (lib)
Downloaded   semigroupoids-5.3.2

Failed to build assoc-1.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/assoc-1-556dfec5a25591a43568723b20f961309015e2df3f9febeed147116da66e6e29.log
):
Configuring library for assoc-1..
Preprocessing library for assoc-1..
Building library for assoc-1..
[1 of 2] Compiling Data.Bifunctor.Assoc ( src/Data/Bifunctor/Assoc.hs, dist/build/Data/Bifunctor/Assoc.o )
[2 of 2] Compiling Data.Bifunctor.Swap ( src/Data/Bifunctor/Swap.hs, dist/build/Data/Bifunctor/Swap.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build base16-bytestring-0.1.1.6.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/base16-bytestring-0.1.1.6-b3d3c351ff0de2c6f1e9d3c5c2fee4ca1be10aa16321b809da25c47046120286.log
):
Warning: base16-bytestring.cabal:9:1: The field "copyright" is specified more
than once at positions 9:1, 12:1
Configuring base16-bytestring-0.1.1.6...
Preprocessing library for base16-bytestring-0.1.1.6..
Building library for base16-bytestring-0.1.1.6..
[1 of 2] Compiling Data.ByteString.Base16 ( Data/ByteString/Base16.hs, dist/build/Data/ByteString/Base16.o )
[2 of 2] Compiling Data.ByteString.Base16.Lazy ( Data/ByteString/Base16/Lazy.hs, dist/build/Data/ByteString/Base16/Lazy.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build clock-0.8.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/clock-0.8-33c24ad2d72e956136f174de91b8f3803dd2f05c9c6a447215a4532a50858f5a.log
):
Configuring library for clock-0.8..
Preprocessing library for clock-0.8..
Building library for clock-0.8..
[1 of 1] Compiling System.Clock     ( dist/build/System/Clock.hs, dist/build/System/Clock.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build exceptions-0.10.2.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/exceptions-0.10.2-dc5c1e67e720f075b74a57e975788689cab6fe30cde32ddf6e8eca70cb1621a8.log
):
Configuring library for exceptions-0.10.2..
Preprocessing library for exceptions-0.10.2..
Building library for exceptions-0.10.2..
[1 of 2] Compiling Control.Monad.Catch ( src/Control/Monad/Catch.hs, dist/build/Control/Monad/Catch.o )
[2 of 2] Compiling Control.Monad.Catch.Pure ( src/Control/Monad/Catch/Pure.hs, dist/build/Control/Monad/Catch/Pure.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build half-0.3.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/half-0.3-4be21043c9d06e7b88328b96e39ae2081daa2a98d5e9fb6ca77720a2c0427f6f.log
):
Configuring library for half-0.3..
Preprocessing library for half-0.3..
Building library for half-0.3..
[1 of 1] Compiling Numeric.Half     ( src/Numeric/Half.hs, dist/build/Numeric/Half.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build hashable-1.2.7.0.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/hashable-1.2.7.0-f74a681525ae9487f2b2449d7d5af39e32d7ba8274aaa824a48c41af61e064a2.log
):
Configuring library for hashable-1.2.7.0..
Preprocessing library for hashable-1.2.7.0..
Building library for hashable-1.2.7.0..
[1 of 4] Compiling Data.Hashable.Class ( Data/Hashable/Class.hs, dist/build/Data/Hashable/Class.o )
[2 of 4] Compiling Data.Hashable.Generic ( Data/Hashable/Generic.hs, dist/build/Data/Hashable/Generic.o )
[3 of 4] Compiling Data.Hashable    ( Data/Hashable.hs, dist/build/Data/Hashable.o )
[4 of 4] Compiling Data.Hashable.Lifted ( Data/Hashable/Lifted.hs, dist/build/Data/Hashable/Lifted.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build primitive-0.6.4.0.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/primitive-0.6.4.0-40db89a8704ff4cbea96e899154d444bba365eb58145d721e8b7b7b179e6c39a.log
):
Configuring library for primitive-0.6.4.0..
Preprocessing library for primitive-0.6.4.0..
Building library for primitive-0.6.4.0..
[ 1 of 15] Compiling Control.Monad.Primitive ( Control/Monad/Primitive.hs, dist/build/Control/Monad/Primitive.o )
[ 2 of 15] Compiling Data.Primitive.Internal.Compat ( Data/Primitive/Internal/Compat.hs, dist/build/Data/Primitive/Internal/Compat.o )
[ 3 of 15] Compiling Data.Primitive.Array ( Data/Primitive/Array.hs, dist/build/Data/Primitive/Array.o )
[ 4 of 15] Compiling Data.Primitive.MVar ( Data/Primitive/MVar.hs, dist/build/Data/Primitive/MVar.o )
[ 5 of 15] Compiling Data.Primitive.MachDeps ( Data/Primitive/MachDeps.hs, dist/build/Data/Primitive/MachDeps.o )
[ 6 of 15] Compiling Data.Primitive.Internal.Operations ( Data/Primitive/Internal/Operations.hs, dist/build/Data/Primitive/Internal/Operations.o )
[ 7 of 15] Compiling Data.Primitive.MutVar ( Data/Primitive/MutVar.hs, dist/build/Data/Primitive/MutVar.o )
[ 8 of 15] Compiling Data.Primitive.SmallArray ( Data/Primitive/SmallArray.hs, dist/build/Data/Primitive/SmallArray.o )
[ 9 of 15] Compiling Data.Primitive.Types ( Data/Primitive/Types.hs, dist/build/Data/Primitive/Types.o )
[10 of 15] Compiling Data.Primitive.ByteArray ( Data/Primitive/ByteArray.hs, dist/build/Data/Primitive/ByteArray.o )
[11 of 15] Compiling Data.Primitive.PrimArray ( Data/Primitive/PrimArray.hs, dist/build/Data/Primitive/PrimArray.o )
[12 of 15] Compiling Data.Primitive.Ptr ( Data/Primitive/Ptr.hs, dist/build/Data/Primitive/Ptr.o )
[13 of 15] Compiling Data.Primitive.Addr ( Data/Primitive/Addr.hs, dist/build/Data/Primitive/Addr.o )
[14 of 15] Compiling Data.Primitive.UnliftedArray ( Data/Primitive/UnliftedArray.hs, dist/build/Data/Primitive/UnliftedArray.o )
[15 of 15] Compiling Data.Primitive   ( Data/Primitive.hs, dist/build/Data/Primitive.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build semigroups-0.19.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/semigroups-0.19-57d5ad9e382061e4f958488126e689e21caa075fa26c70bafe3acf625caf6b7f.log
):
Configuring library for semigroups-0.19..
Preprocessing library for semigroups-0.19..
Building library for semigroups-0.19..
[1 of 1] Compiling Data.Semigroup.Generic ( src/Data/Semigroup/Generic.hs, dist/build/Data/Semigroup/Generic.o )
cabal: The program 'ar' is required but it could not be found.


Failed to build transformers-base-0.4.5.2.
Build log (
/home/chris/.cabal/logs/ghc-8.6.5/transformers-base-0.4.5.2-e2248a14f2a67c9868063a25ce54de2ce9abf8f1a377ab37523b44a1faefb5d2.log
):
Configuring library for transformers-base-0.4.5.2..
Preprocessing library for transformers-base-0.4.5.2..
Building library for transformers-base-0.4.5.2..
[1 of 1] Compiling Control.Monad.Base ( src/Control/Monad/Base.hs, dist/build/Control/Monad/Base.o )
cabal: The program 'ar' is required but it could not be found.

cabal: Failed to build assoc-1 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build base16-bytestring-0.1.1.6 (which is required by exe:node-ipc
from cardano-shell-0.1.0.0). See the build log above for details.
Failed to build canonical-json-0.6.0.0 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0).
Failed to build clock-0.8 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build exceptions-0.10.2 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build half-0.3 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build hashable-1.2.7.0 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build primitive-0.6.4.0 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build semigroups-0.19 (which is required by exe:node-ipc from
cardano-shell-0.1.0.0). See the build log above for details.
Failed to build transformers-base-0.4.5.2 (which is required by exe:node-ipc
from cardano-shell-0.1.0.0). See the build log above for details.

chrissound avatar Jan 18 '20 14:01 chrissound

But I guess, the chief question is -- why do you want to build cardano-shell`? After all it's just a library, not an end-user executable.

I was trying to setup a ghci repl / ghcid for a "cardano node" for development to learn more about the project. I assumed cardono-shell was needed as I had issues setting it up otherwise: https://github.com/input-output-hk/cardano-node/issues/441

I'll see if I can finally have this setup with all your pointers, thanks!

chrissound avatar Jan 18 '20 14:01 chrissound