NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.86k stars 13.93k forks source link

pkg-config for libraw asks for libstdc++ on darwin #272906

Open ear7h opened 10 months ago

ear7h commented 10 months ago

Describe the bug

pkg-config --libs libraw asks for libstdc++, but it should be asking for libc++ on darwin.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-shell -p pkg-config libraw --run 'pkg-config --libs libraw'
    -L/nix/store/0hr265hhxjyygmkl2413w54p66j4m2f9-libraw-0.21.1-lib/lib -L/nix/store/4kv96yrdskx
    33fhvxgpndx6bw2vq7c3l-lcms2-2.15/lib -lraw -lstdc++ -llcms2

Expected behavior

pkg-config should ask for libc++ instead, or nothing? Linkers just provides the standard lib automagically right?

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

I'm not a C++ person (I'm trying to use the libraw rust crate), but apparently libstdc++ isn't supported by Apple.

I think the problem lies in libraw explicitly asking for libstdc++ in their build scripts. This was brought up (and pretty much ignored) to libraw maintainers: https://github.com/LibRaw/LibRaw/issues/248

Macports applies this patch to fix the issue: https://github.com/macports/macports-ports/blob/master/graphics/libraw/files/patch-libraw-no-libstdcxx.diff

Homebrew doesn't have such a patch, and I can confirm it's also broken this way: https://github.com/Homebrew/homebrew-core/blob/84fb6d8673d87eb06ee9db7cfb8631b9bd5a03c3/Formula/lib/libraw.rb

Notify maintainers

This package has no maintainers. :(

I'd be happy to add a patch similar to the one from macports (this is easy enough for me to understand). The ideal approach would be to patch the upstream with something portable, but I have no idea what that entails.

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: `"aarch64-darwin"`
 - host os: `Darwin 23.1.0, macOS 14.1.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixpkgs"`
 - channels(julio): `""`
 - nixpkgs: `/etc/nixpkgs/channels/nixpkgs`

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

ear7h commented 10 months ago

My workaround for this is to add gcc.cc.lib in buildInputs or nix-shell command:

nix-shell -p pkg-config libraw gcc.cc.lib