IntersectMBO / cardano-node

The core component that is used to participate in a Cardano decentralised blockchain.
https://cardano.org
Apache License 2.0
3.06k stars 724 forks source link

[BUG] - Not able to build cardano-node 1.35.4 on raspberry pi4 #4846

Closed gaganyaan2 closed 1 year ago

gaganyaan2 commented 1 year ago

External

Area cardano node build

Summary Not able to build Cardano-node on raspberry pi4 with the following error during cabal build all --disable-tests

Step 42/61 : RUN PATH="$PATH:/root/.ghcup/bin/" cabal build all --disable-tests
 ---> Running in 5afb35ba049a
Cloning into '/root/src/cardano-node/dist-newstyle/src/threepenn_-a39f3242b2cf0a10'...
HEAD is now at 4ec92de Run https only
Cloning into '/root/src/cardano-node/dist-newstyle/src/moo-4414dd0dfed8975'...
HEAD is now at 8c48771 Merge pull request #1 from input-output-hk/erikd/remove-cabal-dupe
Cloning into '/root/src/cardano-node/dist-newstyle/src/ekg-json-ecbacf43151947f5'...
HEAD is now at 00ebe72 Added support for aeson-2.0, text-2.0, and GHC 9.2
Warning: Caught exception during _mirrors lookup:user error (res_query(3)
failed)
Warning: No mirrors found for
https://input-output-hk.github.io/cardano-haskell-packages
Warning: The package list for 'cardano-haskell-packages' does not exist. Run
'cabal update' to download it.
Warning: Requested index-state 2022-10-25T20:00:00Z is newer than
'cardano-haskell-packages'! Falling back to older state ().
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: cardano-api-1.35.4 (user goal)
[__1] unknown package: plutus-core (dependency of cardano-api)
[__1] fail (backjumping, conflict set: cardano-api, plutus-core)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-api, plutus-core

Docker build build command

docker build --build-arg git_commit_id='tags/1.35.4' -t cardano-node:1.35.4 -f Dockerfile .

Dockerfile

FROM ubuntu:20.04 AS base
ARG DEBIAN_FRONTEND=noninteractive
ENV BOOTSTRAP_HASKELL_GHC_VERSION=8.10.7
ENV BOOTSTRAP_HASKELL_CABAL_VERSION=3.6.2.0
RUN apt update -y && apt install libnuma-dev automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 libtool autoconf liblmdb-dev curl -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=${BOOTSTRAP_HASKELL_GHC_VERSION} BOOTSTRAP_HASKELL_CABAL_VERSION=${BOOTSTRAP_HASKELL_CABAL_VERSION} sh && \
    rm -rf /root/.ghcup/tmp/
RUN ~/.ghcup/bin/ghcup install ghc ${BOOTSTRAP_HASKELL_GHC_VERSION}
RUN ~/.ghcup/bin/ghcup set ghc ${BOOTSTRAP_HASKELL_GHC_VERSION}
RUN ~/.ghcup/bin/ghcup install cabal ${BOOTSTRAP_HASKELL_CABAL_VERSION}
RUN ~/.ghcup/bin/ghcup set cabal ${BOOTSTRAP_HASKELL_CABAL_VERSION}

FROM base AS libsodium
WORKDIR /root/src
RUN git clone https://github.com/input-output-hk/libsodium
WORKDIR /root/src/libsodium
RUN git checkout 66f017f1
RUN ./autogen.sh && ./configure
RUN make && make install && make clean
RUN echo 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' >> ~/.bashrc
RUN echo 'export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc
RUN echo 'PATH="$PATH:/root/.ghcup/bin/"' >> ~/.bashrc
RUN apt install libsodium-dev -y
RUN ln -s /usr/local/lib/libsodium.so.23.3.0 /usr/lib/libsodium.so.23

FROM libsodium AS secp256k1
WORKDIR /root/src
RUN git clone https://github.com/bitcoin-core/secp256k1
WORKDIR /root/src/secp256k1
RUN git checkout ac83be33
RUN ./autogen.sh && ./configure --enable-module-schnorrsig --enable-experimental
RUN make && make install && make clean
RUN ldconfig

FROM secp256k1 AS cardano-node
ARG git_commit_id='tags/1.35.4'
WORKDIR /root/src
RUN git clone https://github.com/input-output-hk/cardano-node.git
WORKDIR /root/src/cardano-node
RUN git fetch --all --recurse-submodules --tags
RUN git checkout ${git_commit_id}
RUN echo 'package cardano-crypto-praos' >> cabal.project.local
RUN echo ' flags: -external-libsodium-vrf' >> cabal.project.local
RUN echo "with-compiler: ghc-${BOOTSTRAP_HASKELL_GHC_VERSION}" >> cabal.project.local
RUN apt install llvm -y
RUN PATH="$PATH:/root/.ghcup/bin/" cabal build all --disable-tests
RUN mkdir -p ~/.local/bin
RUN cp -p "$(./scripts/bin-path.sh cardano-node)" ~/.local/bin/
RUN cp -p "$(./scripts/bin-path.sh cardano-cli)" ~/.local/bin/

FROM ubuntu:20.04 AS cardano-node-slim
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update -y 
RUN apt install build-essential libssl-dev libsodium-dev libnuma-dev -y && \
    apt clean -y && \
    rm -rf /var/lib/apt/lists/*
RUN echo 'export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"' >> ~/.bashrc
RUN echo 'export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc
RUN ln -s /usr/local/lib/libsodium.so.23.3.0 /usr/lib/libsodium.so.23
RUN mkdir -p /opt/cardano/{config,data,ipc,logs}
COPY --from=cardano-node /usr/local/lib/ /usr/local/lib/
COPY --from=cardano-node /usr/local/lib/pkgconfig/ /usr/local/lib/pkgconfig/
RUN ldconfig
COPY --from=cardano-node /root/.local/bin/cardano-node /usr/local/bin/cardano-node
COPY --from=cardano-node /root/.local/bin/cardano-cli /usr/local/bin/cardano-cli
ADD cardano-entrypoint /usr/local/bin
COPY run-network-config /run-network-config
ENTRYPOINT [ "entrypoint" ]

Steps to reproduce

docker build --build-arg git_commit_id='tags/1.35.4' -t cardano-node:1.35.4 -f Dockerfile .

Expected behavior A clear and concise description of what you expected to happen.

System info (please complete the following information):

Additional context

gaganyaan2 commented 1 year ago

After adding cabal update before cabal build. it is resolved. Thank you FRCA.