Skip to content

pkg-config issue on cabal.project with no source-repository-package stanzas #1753

Closed
IntersectMBO/plutus
#4993
@zeme-iohk

Description

@zeme-iohk

After integrating CHaP with plutus (i.e. removing all source-repository-packages stanzas from cabal.project) the devshell fails to cabal build all.

I can only reproduce this on my M1 MacBook with rosetta (nixpkgs.stdenv.system == x86_64-darwin)

To reproduce, checkout the commit right after CHaP was introduced and run cabal:

git clone [email protected]:input-output-hk/plutus.git

cd plutus

git checkout 0785993024d11dc7b85ff9c9276adf838753dcb1

nix develop 

cabal build all --minimize-conflict-set

Warning: Requested index-state 2022-10-10T00:00:00Z is newer than
'cardano-haskell-packages'! Falling back to older state
(2022-09-27T00:17:36Z).
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: plutus-core-1.0.0.0 (user goal)
[__1] next goal: inline-r (dependency of plutus-core)
[__1] rejecting: inline-r-0.10.5, inline-r-0.10.4, inline-r-0.10.3,
inline-r-0.10.2, inline-r-0.10.1, inline-r-0.10, inline-r-0.9.2,
inline-r-0.9.1, inline-r-0.9.0.2, inline-r-0.9.0.1, inline-r-0.9.0.0,
inline-r-0.8.0.1, inline-r-0.8.0.0, inline-r-0.7.3.0, inline-r-0.7.2.0,
inline-r-0.7.1.2, inline-r-0.7.1.1, inline-r-0.7.1.0, inline-r-0.7.0.0
(conflict: pkg-config package libR>=3.0, not found in the pkg-config database)
[__1] fail (backjumping, conflict set: inline-r, plutus-core)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: inline-r, plutus-core

The revision right before CHaP was introduced works fine:

git checkout 69ddd0edf30dc19a1926c8d9eab694709468ec46
nix develop 
cabal build all
... works fine

Note that a "fix" has already been found: by adding pkg-config to the devshell, everything works again.
See this plutus PR: IntersectMBO/plutus#4906

However something doesn't add up.

Basically, none of these place a pkg-config in $PATH:

nix develop .#x86_64-darwin.plutus.library.plutus-project.shell
nix develop .#x86_64-darwin.plutus.library.plutus-project.devshell
nix-shell (see https://github.com/input-output-hk/plutus/blob/511611ce9234d3f34f50c322a0888fc2786c17e8/shell.nix#L113)

Also

If I run cabal build all -v | grep pkg-config

  • In nix-shell
    • Before CHaP (finds pkg-config and works ✅)
    /nix/store/3vq6z9rz5ips7jlifna48mxx8wcj83xm-pkg-config-wrapper-0.29.2/bin/pkg-config --version
    /nix/store/3vq6z9rz5ips7jlifna48mxx8wcj83xm-pkg-config-wrapper-0.29.2/bin/pkg-config --variable pc_path pkg-config
    /nix/store/3vq6z9rz5ips7jlifna48mxx8wcj83xm-pkg-config-wrapper-0.29.2/bin/pkg-config --version
    /nix/store/3vq6z9rz5ips7jlifna48mxx8wcj83xm-pkg-config-wrapper-0.29.2/bin/pkg-config --list-all
    /nix/store/3vq6z9rz5ips7jlifna48mxx8wcj83xm-pkg-config-wrapper-0.29.2/bin/pkg-config --modversion formw python3 menu 'ncurses++' menuw panel libsodium python-3.10-embed python ncurses panelw zlib libR python3-embed libsecp256k1 ncursesw bzip2 'ncurses++w' form editorconfig python-3.10
    
    • After CHap (doesn't find pkg-config 🤔 but still works ✅)
      Failed to query pkg-config, Cabal will continue without solving for pkg-config
    constraints: Cannot find pkg-config program
    No pkg-config found
    No pkg-config found
    No pkg-config found
    No pkg-config found
    No pkg-config found
    No pkg-config found
    No pkg-config found
    
  • In nix develop
    • Before CHaP (finds pkg-config and works ✅)
    /nix/store/54af7qasa616lcl8wswyqn1yplfr9zz4-devshell-dir/bin/pkg-config --version
    /nix/store/54af7qasa616lcl8wswyqn1yplfr9zz4-devshell-dir/bin/pkg-config --variable pc_path pkg-config
    /nix/store/54af7qasa616lcl8wswyqn1yplfr9zz4-devshell-dir/bin/pkg-config --version
    /nix/store/54af7qasa616lcl8wswyqn1yplfr9zz4-devshell-dir/bin/pkg-config --list-all
    /nix/store/54af7qasa616lcl8wswyqn1yplfr9zz4-devshell-dir/bin/pkg-config --modversion libsecp256k1 libR libsodium
    
    • After CHaP (doesn't find pkg-config and breaks ❌)
    Failed to query pkg-config, Cabal will continue without solving for pkg-config
    constraints: Cannot find pkg-config program
    CallStack (from HasCallStack):
      withMetadata, called at src/Distribution/Simple/Utils.hs:370:14 in Cabal-3.8.1.0-3n5GDPIVQh93OGMJzC2H2:Distribution.Simple.Utils
    Error: cabal: Could not resolve dependencies:
    [__0] trying: plutus-core-1.0.0.0 (user goal)
    [__1] next goal: inline-r (dependency of plutus-core)
    [__1] rejecting: inline-r-0.10.5, inline-r-0.10.4, inline-r-0.10.3,
    inline-r-0.10.2, inline-r-0.10.1, inline-r-0.10, inline-r-0.9.2,
    inline-r-0.9.1, inline-r-0.9.0.2, inline-r-0.9.0.1, inline-r-0.9.0.0,
    inline-r-0.8.0.1, inline-r-0.8.0.0, inline-r-0.7.3.0, inline-r-0.7.2.0,
    inline-r-0.7.1.2, inline-r-0.7.1.1, inline-r-0.7.1.0, inline-r-0.7.0.0
    (conflict: pkg-config package libR>=3.0, not found in the pkg-config database)
    [__1] fail (backjumping, conflict set: inline-r, plutus-core)
    After searching the rest of the dependency tree exhaustively, these were the
    goals I've had most trouble fulfilling: inline-r, plutus-core
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions