Statically linked cardano-node binary

Hi all,

I am looking into join the community as a stake pool operator, and I am having trouble how to compile cardano-node into a static executable.

From the official github README.md, they provide linux executables, and this leads me to believe that it is 100% possible to compile cardano-node into a single portable executable.

The official Docker image seems to be a dynamically linked binary, and the official installation guide using “cabal build all” also compiles down to a dynamically linked binary.

When I attempt to build using “cabal build all --enable-executable-static”, a following error message is thrown:

cabal: Failed to build exe:named-pipe-demo from Win32-network-0.1.0.0.

Could anyone guide me to how IOHK even builds the linux executables please?

Thanks everyone for reading.

Assuming that you installed Cabal and its dependencies correctly, you can run the following code to build:

cabal build cardano-cli cardano-node

It may take a while for the process to be done depending on your machine.

How about this

$ docker run --detach \
    --name=relay \
    -p 3001:3001 \
    -e CARDANO_UPDATE_TOPOLOGY=true \
    -v node-data:/opt/cardano/data \
    nessusio/cardano-node run    

Thanks for the response.
The default “cabal build” will compile a dynamically linked binary unfortunately.
From researching, IOHK utilizes musl instead of glibc for compiling haskell code to complile a single portable statically linked executable.

Hi @tomdx ,

The above project seems to be the closest static build approach I found.
Thanks for the suggestion.

1 Like