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

configure: Use the system PKG_CONFIG_PATH #6967

Merged

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Dec 31, 2023

I noticed this while working on a nix devShell to work on CLN. We are
blanked overriding the pkg-config search path, which can cause some
trouble. Specifically nix uses content addressable locations, and
macOS arm64 and x84_64 use separate pkg-config search paths, and by
overwriting it we can cause a mix of different architectures failing
the compilation

Changelog-Fixed: configure: We now respect the PKG_CONFIG_PATH environment variable

I noticed this while working on a nix devShell to work on CLN. We are
blanked overriding the `pkg-config` search path, which can cause some
trouble. Specifically `nix` uses content addressable locations, and
macOS arm64 and x84_64 use separate `pkg-config` search paths, and by
overwriting it we can cause a mix of different architectures failing
the compilation

Changelog-Fixed: configure: We now respect the `PKG_CONFIG_PATH` environment variable
@cdecker cdecker merged commit a59dbbd into ElementsProject:master Jan 3, 2024
38 checks passed
@cdecker cdecker deleted the 20231231-configure-pkgconfig branch January 3, 2024 11:54
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-review ACK 758c78e

Nice catch, I was wondering are you working on a nix dev shell and make a PR or it is just your things?

Asking this because if you are playing with it maybe I will not spend some time on this #6739 😸

@cdecker
Copy link
Member Author

cdecker commented Jan 5, 2024

Indeed, my current flake.nix is the following:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-23.11";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };
  outputs = { self, nixpkgs, flake-utils, rust-overlay }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        overlays = [ (import rust-overlay) ];
        pkgs = import nixpkgs { inherit system overlays; };

        nativeBuildInputs = with pkgs; [ pkg-config sqlite ];
        buildInputs = with pkgs; [ sqlite rust-bin.stable.latest.default];
      in {
        devShells.default = pkgs.mkShell {
          packages = with pkgs; [
            autoconf
            automake
            bitcoind
            clang
            libtool
            git
            openssl
            pkg-config
            python310
            sqlite
            which
            zlib
          ];
          inherit nativeBuildInputs buildInputs;
          shellHook =
            ''
            export PATH=.venv/bin:$PATH
            if test -d .venv; then
              echo "Updating existing virtualenv in .venv"
              poetry update --with=dev
            else
              echo "Creating new virtualenv in .venv"
              python3 -m venv .venv || true
              python3 -m pip install -U wheel pip poetry
              poetry install --with=dev --no-root
            fi
            '';
          LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ];
        };
      });
}

It's somehow missing the cryptography python package for some tests (could just be the test using an absolute path), otherwise it can compile and run tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants