NixOS / nixpkgs

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

libftdi1 incorrect pkg-config file #336369

Open bryceberger opened 2 months ago

bryceberger commented 2 months ago

Describe the bug

The generated libfti1.pc has the wrong libdir, causing it to not link correctly.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix build github:nixos/nixpkgs/c79da508#libftdi1
  2. cat result/lib/pkgconfig/libftdi1.pc
  3. notice that line 3 is libdir=/nix/store/{hash}//nix/store/{hash}/lib

Expected behavior

Should just be set to /nix/store/{hash}/lib

Additional context

This might be relevant to notify upstream? I believe the offending line is here: set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}). Nix sets CMAKE_INSTALL_LIBDIR to an absolute path (allowed, according to the cmake docs, but not recommended), but libftdi assumes that it's relative.

Have not yet bisected to find the point of failure, occurred when updating:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/fc69edccf533e2731ab8850c59482907e0d4fc28?narHash=sha256-xHxbvpjepaDEc3DxJNMCWOFyBqW7yIANbUU%2ByWSL9%2Bc%3D' (2024-04-15)
  → 'github:NixOS/nixpkgs/9307b49d29b43e37f9b4094a074e79804cfd0707?narHash=sha256-JWgVYGXP0a4XTT8x%2BpJwfxq6JhZxUE1Dws4V0cwG8uY%3D' (2024-08-02)

Notify maintainers

@bjornfor (maintainer), @mweinelt (last touched)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.0-117-generic, Ubuntu, 20.04.6 LTS (Focal Fossa), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.22.1`
 - nixpkgs: `/home/bryce.berger.local/.nix-defexpr/channels/nixpkgs`

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

bjornfor commented 2 months ago

This might be relevant to notify upstream? I believe the offending line is here: set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}). Nix sets CMAKE_INSTALL_LIBDIR to an absolute path (allowed, according to the cmake docs, but not recommended), but libftdi assumes that it's relative.

Yes please. Replacing ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} with ${CMAKE_INSTALL_FULL_LIBDIR} upstream should fix the issue.