Skip to content

Missing boost from pkg-config pc file setup #13782

@fzakaria

Description

@fzakaria

Describe the bug

Using any Nix library fails to compile due to missing Boost libraries.

/nix/store/dxar61b2ig87cfdvsylfcnyz6ajls91v-nix-2.28.3-dev/include/nix/util/fmt.hh:4:10: fatal error: boost/format.hpp: No such file or directory
    4 | #include <boost/format.hpp>
      |          ^~~~~~~~~~~~~~~~~~

Steps To Reproduce

If you try to depend on Nix as a library, it will fail to compile due to missing <boost> libraries.

{
  description = "Example of how to use Nix as a library.";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/25.05";
    devshell.url = "github:numtide/devshell";
  };

  outputs = { self, nixpkgs, devshell }:
    let
      lib = nixpkgs.lib;
      systems = [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];
    in {
      devShells = lib.genAttrs systems (system:
        let
          pkgs = import nixpkgs {
            inherit system;
          };
        in {
          default = pkgs.mkShell {
            packages = with pkgs; [
              nix
              meson
              ninja
              pkg-config
            ];
          };
        });
    };
}
#include <iostream>

#include <nix/main/shared.hh>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}
project('nix-library', 'cpp',
  version : '0.1',
  default_options : ['warning_level=3', 'cpp_std=c++14'])

nix_main = dependency('nix-main')

executable('nix-library',
           'main.cc',
           dependencies: [nix_main],
           install : true)

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuild-problemNix fails to compile or test; also improvements to build process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions