Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Can't build cardano-node on Fedora - conflict: pkg-config package libsodium-any, not found in the pkg-config database #5561

Closed
ArturWieczorek opened this issue Dec 1, 2023 · 7 comments
Assignees
Labels
type: bug Something is not working type: documentation Improvements or additions to documentation

Comments

@ArturWieczorek
Copy link
Contributor

Internal

Area

Installation instruction:
Installing the node from source
https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/getting-started/install.md

Summary

Can't build cardano-node on Fedora.

We have tests https://github.com/input-output-hk/cardano-node-tests/tree/master/cabal_build_tests that check "Installing the node from source" instruction in dockerized environments on Ubuntu and Fedora.

After updating tests - they are on a branch artur/update-cabal-tests - an attempt to run 8.7.0-pre on Ubuntu worked fine while the same test installation on Fedora failed with:

Downloading the latest package lists from:
- hackage.haskell.org
- cardano-haskell-packages
Package list of cardano-haskell-packages has been updated.
The index-state is set to 2023-11-30T14:34:52Z.
Package list of hackage.haskell.org has been updated.
The index-state is set to 2023-11-30T21:40:36Z.
To revert to previous state run:
    cabal v2-update 'hackage.haskell.org,2023-11-30T20:29:10Z'
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: cardano-git-rev-0.1.3.0 (user goal)
[__1] trying: base-4.18.1.0/installed-4.18.1.0 (dependency of cardano-git-rev)
[__2] trying: cardano-node-8.7.0 (user goal)
[__3] trying: ouroboros-consensus-protocol-0.6.0.0 (dependency of
cardano-node)
[__4] trying: cardano-crypto-tests-2.1.2.0 (dependency of
ouroboros-consensus-protocol)
[__5] next goal: cardano-crypto-praos (dependency of cardano-crypto-tests)
[__5] rejecting: cardano-crypto-praos-2.1.2.0, cardano-crypto-praos-2.1.1.2
(conflict: pkg-config package libsodium-any, not found in the pkg-config
database)
[__5] rejecting: cardano-crypto-praos-2.1.1.1 (conflict:
base==4.18.1.0/installed-4.18.1.0, cardano-crypto-praos => base>=4.14 &&
<4.17)
[__5] skipping: cardano-crypto-praos-2.1.1.0, cardano-crypto-praos-2.1.0.0,
cardano-crypto-praos-2.0.0.1, cardano-crypto-praos-2.0.0.0.1,
cardano-crypto-praos-2.0.0 (has the same characteristics that caused the
previous version to fail: excludes 'base' version 4.18.1.0)
[__5] fail (backjumping, conflict set: base, cardano-crypto-praos,
cardano-crypto-tests)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, cardano-crypto-praos,
cardano-crypto-tests, ouroboros-consensus-protocol, cardano-node,
cardano-git-rev
Try running with --minimize-conflict-set to improve the error message.

Full logs are attached below.

Steps to reproduce
Steps to reproduce the behavior:

  1. Clone cardano-node-tests
    git clone git@github.com:input-output-hk/cardano-node-tests.git

  2. Navigate to cabal_build_tests - there is a README there too:
    cd cardano-node-tests/cabal_build_tests

  3. Checkout branch artur/update-cabal-tests
    git checkout artur/update-cabal-tests

  4. Run tests:
    ./run-fedora.sh -t tag -o "8.7.0-pre" --> Fails
    ./run-ubuntu.sh -t tag -o "8.7.0-pre" --> Passes

Expected behavior
Build is successful.

System info (please complete the following information):
Our Dockerfile uses fedora:latest
Node and CLI version: We are trying to build 8.7.0-pre.

Screenshots and attachments
Fedora (Failing) full logs:
fedora.txt

Ubuntu (Successful) full logs:
ubuntu.txt

I found this posts that suggests that this issue is also present on Arch Linux:
https://forum.cardano.org/t/cardano-crypto-class-2-0-0-conflict-pkg-config-package-libsodium-any-not-found-in-the-pkg-config-database/56203/5

Additional context
N/A

@ArturWieczorek ArturWieczorek added type: bug Something is not working type: documentation Improvements or additions to documentation labels Dec 1, 2023
@carbolymer
Copy link
Contributor

carbolymer commented Dec 1, 2023

(conflict: pkg-config package libsodium-any, not found in the pkg-config
database)

Seems that libsodium gets installed on fedora, but somehow is not visible for pkg-config present in pkg-config --list-all but gets ignored by cabal. Maybe environment variables with paths are not configured correctly. I'll try to repro this and investigate later today.

@carbolymer carbolymer self-assigned this Dec 1, 2023
@stefanobieler
Copy link

stefanobieler commented Dec 3, 2023

also on fedora facing a similar issue. when i try to build not only cardano node but any other project associated with cardano. strange too because i originally compiled my node on this machine. aside from regular system updates not sure what could of changed.

environment variables

LD_LIBRARY_PATH=/usr/local/lib
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

/usr/local/lib

.
├── libblst.a
├── libsecp256k1.a
├── libsecp256k1.la
├── libsecp256k1.so -> libsecp256k1.so.0.0.0
├── libsecp256k1.so.0 -> libsecp256k1.so.0.0.0
├── libsecp256k1.so.0.0.0
├── libsodium.a
├── libsodium.la
├── libsodium.so -> libsodium.so.23.3.0
├── libsodium.so.23 -> libsodium.so.23.3.0
├── libsodium.so.23.3.0
└── pkgconfig
    ├── libblst.pc
    ├── libsecp256k1.pc
    └── libsodium.pc

versions of tooling.

❯ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
❯ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library 

@stefanobieler
Copy link

stefanobieler commented Dec 3, 2023

I changed the name of the .pc file so that it would show up in the pkg-config database as libsodium-any but still ran into the same issue

❯ pkg-config --list-all
...
libsodium-any                  libsodium - A modern and easy-to-use crypto library
...

compiler output

❯ cabal build all --minimize-conflict
Warning: Requested index-state 2023-07-21T13:00:00Z is newer than
'cardano-haskell-packages'! Falling back to older state
(2023-07-21T12:48:43Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: cardano-cli (user goal)
[__0] rejecting: cardano-cli-8.3.2.0, cardano-cli-8.3.1.0,
cardano-cli-8.3.0.0, cardano-cli-8.2.1, cardano-cli-8.2.0 (constraint from
user target requires ==8.1.2)
[__0] trying: cardano-cli-8.1.2
[__1] trying: ouroboros-consensus-protocol-0.5.0.4 (dependency of cardano-cli)
[__2] trying: cardano-crypto-tests-2.1.2.0 (dependency of
ouroboros-consensus-protocol)
[__3] next goal: cardano-crypto-praos (dependency of cardano-crypto-tests)
[__3] rejecting: cardano-crypto-praos-2.1.2.0, cardano-crypto-praos-2.1.1.2,
cardano-crypto-praos-2.1.1.1, cardano-crypto-praos-2.1.1.0,
cardano-crypto-praos-2.1.0.0, cardano-crypto-praos-2.0.0.1,
cardano-crypto-praos-2.0.0.0.1, cardano-crypto-praos-2.0.0 (conflict:
pkg-config package libsodium-any, not found in the pkg-config database)
[__3] fail (backjumping, conflict set: cardano-crypto-praos,
cardano-crypto-tests)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-crypto-praos,
cardano-crypto-tests, ouroboros-consensus-protocol, cardano-cli

@carbolymer
Copy link
Contributor

carbolymer commented Dec 4, 2023

pkg-config 1.9.5 output breaks cabal dependency checking. pkg-config --modversion produces just a single line of output instead of a list of versions:

[root@70676e06e3b5 cardano-node]# /usr/bin/pkg-config --modversion libcrypt libxcrypt gmp gmpxx zlib form formw menu menuw 'ncurses++' 'ncurses++w' ncurses ncursesw panel panelw tic tinfo lmdb libsystemd libudev libcrypto libssl openssl libsodium libsecp256k1 libbls                                                                                                   
4.4.36                                

The solution is to upgrade to pkgconf version 2. You can install newer version in fedora Dockerfile:

RUN yum update -y && \
    yum install git gcc gcc-c++ tmux gmp-devel make tar xz wget zlib-devel libtool autoconf -y && \
    mkdir -p /root/src/ && cd /root/src && \
    curl -O https://distfiles.ariadne.space/pkgconf/pkgconf-2.0.3.tar.xz && \
    tar -xvf pkgconf-2.0.3.tar.xz && \
    cd pkgconf-2.0.3 && \
    ./configure && make && make install && \
    chmod +x /install-node.sh

I don't have write access to this repository, so here's a patch:

commit 6f3d2b14f783b44479ceebd421d286890fa34819
Author: Mateusz Galazyn <mateusz.galazyn@iohk.io>
Date:   Mon Dec 4 11:04:25 2023 +0100

    Upgrade pkgconf to 2.0.3

diff --git a/cabal_build_tests/fedora/Dockerfile b/cabal_build_tests/fedora/Dockerfile
index e3968681..7f2792ba 100644
--- a/cabal_build_tests/fedora/Dockerfile
+++ b/cabal_build_tests/fedora/Dockerfile
@@ -6,6 +6,15 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
 ENV TAGGED_VERSION ''
 COPY install-node.sh /
-RUN chmod +x /install-node.sh
+# pkg-config 1.9.5 breaks cabal dependency checking
+# pkg-config 2 isn't available yet for fedora so we need to build it from source
+RUN yum update -y && \
+    yum install git gcc gcc-c++ tmux gmp-devel make tar xz wget zlib-devel libtool autoconf -y && \
+    mkdir -p /root/src/ && cd /root/src && \
+    curl -O https://distfiles.ariadne.space/pkgconf/pkgconf-2.0.3.tar.xz && \
+    tar -xvf pkgconf-2.0.3.tar.xz && \
+    cd pkgconf-2.0.3 && \
+    ./configure && make && make install && \
+    chmod +x /install-node.sh
 
 CMD ./install-node.sh $TAGGED_VERSION
diff --git a/cabal_build_tests/install-node.sh b/cabal_build_tests/install-node.sh
index 54e2dec2..737315d7 100644
--- a/cabal_build_tests/install-node.sh
+++ b/cabal_build_tests/install-node.sh
@@ -50,7 +50,6 @@ echo "Install dependencies"
 if [[ "$(</etc/os-release)" == *"fedora"* ]]; then
   echo "Running on Fedora"
   yum update -y
-  yum install git gcc gcc-c++ tmux gmp-devel make tar xz wget zlib-devel libtool autoconf -y
   yum install curl systemd-devel ncurses-devel ncurses-compat-libs which jq openssl-devel lmdb-devel -y
 elif [[ "$(</etc/os-release)" == *"ubuntu"* ]]; then
   echo "Running on Ubuntu"

There are also unreleased fixes in cabal: haskell/cabal#9134 & haskell/cabal#9391

@ArturWieczorek
Copy link
Contributor Author

ArturWieczorek commented Dec 4, 2023

Thanks @carbolymer !
I am attaching logs with successful installation on Fedora after including those changes.
fedora-fixed-installation.txt

I updated instruction with information from this ticket:
input-output-hk/cardano-node-wiki#34

CC: @CarlosLopezDeLara

@stefanobieler
Copy link

Went to pkg config repo and check out the 2.0 tag. compiled and installed and now cardano-node compiles successfully. thank you @carbolymer for the tip

@carbolymer
Copy link
Contributor

Closing then. Let me know if you need further assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something is not working type: documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants