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

mpv: Undefined reference when linking simple libmpv example #222543

Closed
BKSalman opened this issue Mar 22, 2023 · 1 comment
Closed

mpv: Undefined reference when linking simple libmpv example #222543

BKSalman opened this issue Mar 22, 2023 · 1 comment

Comments

@BKSalman
Copy link
Contributor

Describe the bug

I'm trying to use the mpv from the unstable channel (because it has a patch related to this issue),

but I can't compile this example and gives me this error:

└─> gcc -o simple simple.c `pkg-config --libs --cflags mpv`

/nix/store/lz1bwpdvlywij5ir0fmncgqa83dlpwhn-binutils-2.39/bin/ld: /nix/store/qr4br1dgaiwxjr75xk8hh6p1avi5xyq8-openal-soft-1.22.2/lib/libopenal.so.1: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
collect2: error: ld returned 1 exit status

when I add mpv from the unstable channel in my shell.nix file:

let
  system = "x64_86-linux";
  unstable = import <nixos-unstable> { allowUnfree = true; };
in
{ pkgs ? import <nixpkgs> { allowUnfree = true; } }:
   pkgs.mkShell rec {
    buildInputs = with pkgs; [
      unstable.mpv
      unstable.pkg-config
    ];
  }

I also tried using mpv-unwrapped.dev, but didn't work.

I can provide more context if needed

Steps To Reproduce

Steps to reproduce the behavior:

  1. create shell.nix with unstable channel mpv, and pkg-config
  2. clone libmpv simple example
  3. compile with gcc -o simple simple.c `pkg-config --libs --cflags mpv (as specified in the example C file)

Expected behavior

Should be able to compile the mpv example mentioned in the bug description

Notify maintainers

@AndersonTorres @fpletz @globin @Ma27 @tadeokondrak

(sorry if mentions were unnecessary)

Metadata

└─> nix-shell -p nix-info --run "nix-info -m"

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.103, NixOS, 22.11 (Raccoon), 22.11.20230318.08ef7dc`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(salman): `"home-manager-22.11.tar.gz, nixos-unstable"`
 - channels(root): `"home-manager-22.11.tar.gz, nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@BKSalman
Copy link
Contributor Author

Turns out that I was mixing 2 different channels (unstable, and 22.11 channel) which caused libmpv (or one of its dependencies) to be compiled with a different libstdc++ version than the one used when compiling the libmpv example

thanks to @TommyLuco for guiding me :)

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

No branches or pull requests

1 participant