Failed to build 3.0.2 using stack way
cardano-sl-util-3.0.2: configure (lib) cardano-sl-util-3.0.2: build (lib)
-- While building package cardano-sl-util-3.0.2 using: /root/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build lib:cardano-sl-util --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 Logs have been written to: /root/cardano-sl/.stack-work/logs/cardano-sl-util-3.0.2.log
Configuring cardano-sl-util-3.0.2...
Preprocessing library for cardano-sl-util-3.0.2..
Building library for cardano-sl-util-3.0.2..
[ 1 of 37] Compiling Paths_cardano_sl_util ( .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/autogen/Paths_cardano_sl_util.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Paths_cardano_sl_util.o )
[ 2 of 37] Compiling Pos.Util.AssertMode ( src/Pos/Util/AssertMode.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/AssertMode.o )
[ 3 of 37] Compiling Pos.Util.CompileInfoGit ( src/Pos/Util/CompileInfoGit.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/CompileInfoGit.o )
[ 4 of 37] Compiling Pos.Util.CompileInfo ( src/Pos/Util/CompileInfo.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/CompileInfo.o )
[ 5 of 37] Compiling Pos.Util.Concurrent ( src/Pos/Util/Concurrent.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/Concurrent.o )
[ 6 of 37] Compiling Pos.Util.Concurrent.RWLock ( src/Pos/Util/Concurrent/RWLock.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/Concurrent/RWLock.o )
[ 7 of 37] Compiling Pos.Util.Filesystem ( src/Pos/Util/Filesystem.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/Filesystem.o )
[ 8 of 37] Compiling Pos.Util.Future ( src/Pos/Util/Future.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/Future.o )
[ 9 of 37] Compiling Pos.Util.Json.Parse ( src/Pos/Util/Json/Parse.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Pos/Util/Json/Parse.o )
/root/cardano-sl/util/src/Pos/Util/Json/Parse.hs:12:51: error:
In module `Text.JSON.Canonical':
`JSString' is a data constructor of `JSValue'
To import it use
import Text.JSON.Canonical( JSValue( JSString ) )
or
import Text.JSON.Canonical( JSValue(..) )
|
12 | , JSString
| ^^^^^^^^
/root/cardano-sl/util/src/Pos/Util/Json/Parse.hs:13:51: error:
Module `Text.JSON.Canonical' does not export `fromJSString'
|
13 | , fromJSString
| ^^^^^^^^^^^^
ERROR: Service 'wallet-ada-read-01' failed to build: The command '/bin/sh -c cd /root/cardano-sl && ./scripts/build/cardano-sl.sh' returned a non-zero code: 1
Can anybody help me? I can't upgrade from 3.0.1 to 3.0.2. Is there any problem if I still use 3.0.1?
@ciaos What branch or tag are you working from?
@erikd I checkout tag 3.0.2
RUN cd /root
&& apt-get update && apt-get install -y curl autoconf git libssl-dev libcrypto++-dev libcrypto++-doc libcrypto++-utils lzma liblzma-dev libtinfo-dev librocksdb-dev --assume-yes
&& git clone https://github.com/input-output-hk/cardano-sl.git
&& cd cardano-sl
&& git checkout 3.0.2
@erikd Is there any release binary of linux version? I think compile cost too much time and is little complex. Besides, I can't build by nix build mode (due to some permission error)
What are you after, the full daedalus wallet or just the cardano node?
Also, what permission error? Fixing that may be the easiest solution.
@erikd I got trouble when install nix tool. (nit-build nix-env not found), is there any Dockerfile for ada or release binary I can use? I'm not good at compile from source.
My docker file works well on 3.0.1 but not on 3.0.2. I thought the clue is clear, can you check the source code for me?
/root/cardano-sl/util/src/Pos/Util/Json/Parse.hs:12:51: error:
In module Text.JSON.Canonical': JSString' is a data constructor of `JSValue'
To import it use
import Text.JSON.Canonical( JSValue( JSString ) )
or
import Text.JSON.Canonical( JSValue(..) )
|
12 | , JSString
| ^^^^^^^^
/root/cardano-sl/util/src/Pos/Util/Json/Parse.hs:13:51: error:
Module Text.JSON.Canonical' does not export fromJSString'
|
13 | , fromJSString
| ^^^^^^^^^^^^
I do not use Docker or Nix. I just do all my development on a standard Linux machine running Debian Testing.
I just did the following:
git checkout 3.0.2 -b tag-3.0.2
stack build
and everything worked as it should.
I suspect you should check your Dockerfile.
@erikd I found some difference between the two repositories https://github.com/well-typed/canonical-json/blob/master/Text/JSON/Canonical.hs contains one more line to define a module Text.JSON.Canonical " fromJSString"
https://github.com/input-output-hk/canonical-json/blob/master/Text/JSON/Canonical.hs doesn't contain such keywords.
I noticed that input-output-hk/canonical-json is forked from well-typed/canonical-json and not synced. Is that the reason?
You need to use the stack tool to build if. The stack.yaml file specifies the correct version of everything, including canonical-json.
@erikd I used stack 1.9.3 to build it but failed, I think there must be some thing error. I'm from an exchange. Is there any problem if I still use 3.0.1 version? I found there are just some bugfix?
Version 3.0.2 is required for the OBFT protocol switch that is happening in the near future.
If it failed building with stack I need to know exactly what you did and how you failed. Even just the docker command would help.
There's a docker image you can download and run at https://hydra.iohk.io/build/904984/download/1/rgkj26md2nqxhy0y4yj3r9gaxq0r4b5x-docker-image-cardano-sl.tar.gz
@ciaos @disassembler I succeed at last although I don't know why. Tks. I suggest you offer us a binary if possible in the future. I changed the install order of the docker file.
My new Dockerfile looks like this. ————————————————————————————————
ENV VERSION 3.0.2
RUN cd /root
&& apt-get update && apt-get install -y curl autoconf git libssl-dev libcrypto++-dev libcrypto++-doc libcrypto++-utils lzma liblzma-dev libtinfo-dev librocksdb-dev --assume-yes
&& apt-get install -y wget
&& wget https://github.com/input-output-hk/cardano-sl/archive/${VERSION}.tar.gz
&& tar zxvf ${VERSION}.tar.gz
&& mv cardano-sl-${VERSION} cardano-sl
RUN cd /root
&& apt-get install -y wget g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase
&& wget https://github.com/commercialhaskell/stack/releases/download/v1.9.3/stack-1.9.3-linux-x86_64.tar.gz
&& tar zxvf stack-1.9.3-linux-x86_64.tar.gz
&& ln -s /root/stack-1.9.3-linux-x86_64/stack /usr/bin/stack
&& cd cardano-sl
&& stack setup
&& stack install cpphs
RUN cd /root
&& git clone https://github.com/jemalloc/jemalloc.git
&& cd jemalloc
&& ./autogen.sh
&& make dist && make && make install
RUN cd /root/cardano-sl
&& sed '/echo "cardano-sl"/a\ elif [[ "$1" == "wallet" ]]; then\n echo "cardano-$1"' -i scripts/build/cardano-sl.sh
&& ./scripts/build/cardano-sl.sh
&& cp /root/cardano-sl/script-runner/topology-mainnet.yaml /root/cardano-sl/mainnet.yaml
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
...
I know very little about Docker, but I really wonder why jemalloc is there at all.
I know very little about Docker, but I really wonder why
jemallocis there at all. I referred to this page below. There is a jemalloc package required on part "Stack build mode (for developers)" https://github.com/input-output-hk/cardano-sl/blob/develop/docs/how-to/build-cardano-sl-and-daedalus-from-source-code.md
Ah, I am pretty sure jemalloc is needed for daedalus, and is not needed for cardano-sl.