NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.15k stars 14.17k forks source link

`lilv`: `lilvmm.hpp` not including `lilv.h` #356061

Open JuxGD opened 2 hours ago

JuxGD commented 2 hours ago

Describe the bug

The lilv package seems not to be working for development properly. lilvmm.hpp isn't including lilv.h. VS Code says 'cannot open source file "lilv/lilv.h"'

This happens under a shell.nix and flake.nix (with nix develop), and lilv, gcc under buildInputs in pkgs.mkShell. If I change it to #include <lilv-0/lilv/lilv.h> instead, then VS Code tells me the problem's fixed, but I can't save it since it's read-only.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install lilv (and gcc) to a shell environment
  2. In a project, include lilvmm.hpp: #include <lilv-0/lilv/lilvmm.hpp>
  3. Try to compile with g++
  4. nope

Expected behavior

It includes it :p

Screenshots

Screenshot_20241114_222438 The error in VS Code Screenshot_20241114_230645

Additional context

flake.nix:

{
  description = "i like snowflakes";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
  let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
  in
  {
    devShells.${system}.default =
      pkgs.mkShell
        {
          buildInputs = [
            pkgs.gcc
            pkgs.lilv
          ];
        };
  };
}

Metadata

- system: `"x86_64-linux"`
- host os: `Linux 6.6.60, NixOS, 24.11 (Vicuna), 24.11.20241109.76612b1`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.24.10`
- channels(root): `"nixos"`
- nixpkgs: `/nix/store/0sxsfzswhjck7f4sbsvznz285s4i7y64-source`

Notify maintainers

If in doubt, check git blame for whoever last touched something.

@emilazy


Note for maintainers: Please tag this issue in your PR.


Add a :+1: reaction to issues you find important.

emilazy commented 1 hour ago

I’m afraid I have no knowledge of this package whatsoever. Maybe look at the history before it was moved, although that seems to show the classic story of a package being added, abandoned, and then kept going indefinitely by treewide contributors who have probably never used it.

Does it come with a .pc file that specifies the appropriate include directory flags to use?

JuxGD commented 1 hour ago

Oh yeah sorry I forgot how this worked. Thanks for taking the time tho!

I did find a .pc file: /nix/store/x21b1fmbwqpi94rb2l2p7lvqdh0smxzc-lilv-0.24.24-dev/lib/pkgconfig/lilv-0.pc:

prefix=/nix/store/d071awgh0fhr0rz45kl7ngj2hcr1fh2f-lilv-0.24.24
includedir=/nix/store/x21b1fmbwqpi94rb2l2p7lvqdh0smxzc-lilv-0.24.24-dev/include
libdir=${prefix}/lib

Name: Lilv
Description: Library for hosting LV2 plugins
Version: 0.24.24
Requires: lv2 >=  1.18.2
Requires.private: serd-0 >=  0.30.10, sord-0 >=  0.16.15, sratom-0 >=  0.6.10, zix-0 >=  0.4.0
Libs: -L${libdir} -llilv-0
Libs.private: -ldl -lm
Cflags: -I${includedir}/lilv-0

Unlike the pkgconfig directory for other packages, this one's not getting symlinked to /run/current-system/sw/lib/pkgconfig for some reason (I think I'm getting this correctly). But it looks like doing an export PKG_CONFIG_PATH=<the directory> doesn't really do anything either (but i'm new to this so idrk)

emilazy commented 55 minutes ago

Usually you really don’t want to install libraries in your global environment, so I wouldn’t rely on that linking in the first place. Glad to hear you got it working though!

JuxGD commented 34 minutes ago

Usually you really don't want to install libraries in your global environment

Right, I forgot that too

I didn't get it working tho, I tried adding pkg-config to both buildInputs and nativeBuildInputs and it didn't work :(

emilazy commented 27 minutes ago

You’ll want nativeBuildInputs = [ pkg-config ];, buildInputs = [ lilv ];, and to ensure that your build system/IDE is using pkg-config to get the relevant compiler flags.