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

srt pkg-config include path incorrect #70872

Closed
j0sh opened this issue Oct 9, 2019 · 4 comments · Fixed by #71669
Closed

srt pkg-config include path incorrect #70872

j0sh opened this issue Oct 9, 2019 · 4 comments · Fixed by #71669
Labels
0.kind: bug Something is broken

Comments

@j0sh
Copy link

j0sh commented Oct 9, 2019

Describe the bug
After installing the srt module, the include path as shown by pkg-config is incorrect. The path is prefixed twice., eg /path/to/srt//path/to/srt/include

To Reproduce
Steps to reproduce the behavior:

  1. Make this nix-shell derivation:
with import <nixpkgs> {};

stdenv.mkDerivation rec {
  name = "env";
  env = buildEnv { name = "env"; paths = buildInputs;  };
  buildInputs = [
    pkg-config
    srt
  ];
}
  1. Run pkg-config --cflags srt
$ pkg-config --cflags srt
-I/nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2//nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2/include -I/nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2//nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2/include/srt

Note that the prefix is included twice.

Inspecting the .pc file confirms this:

$ cat /nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2/lib/pkgconfig/srt.pc 
prefix=/nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}//nix/store/a2yngvr7i16pik628clnkzhvc77x5mx7-srt-1.3.2/include

Expected behavior

The include path should be correct. In particular, the includedir shouldn't be doubled up.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata
Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

$ nix run nixpkgs.nix-info -c nix-info -m
[2 copied (0.0 MiB), 0.0 MiB DL]
 - system: `"x86_64-darwin"`
 - host os: `Darwin 18.7.0, macOS 10.14.6`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.2.2`
 - channels(josh): `"nixpkgs-19.09pre186574.88d9f776091"`
 - nixpkgs: `/Users/josh/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: srt
@j0sh j0sh added the 0.kind: bug Something is broken label Oct 9, 2019
@j0sh
Copy link
Author

j0sh commented Oct 21, 2019

cc @nh2 (the maintainer?) since this issue probably slipped in under the radar

@nh2
Copy link
Contributor

nh2 commented Oct 22, 2019

Uh, ugly. Thanks for pinging me.

This is not srt specific, but seems like a common cmake problem, see e.g.:

# the cmake package does not handle absolute CMAKE_INSTALL_INCLUDEDIR correctly
# (setting it to an absolute path causes include files to go to $out/$out/include,
# because the absolute path is interpreted with root at $out).
cmakeFlags = "-DCMAKE_INSTALL_INCLUDEDIR=include";

% git grep CMAKE_INSTALL_INCLUDEDIR
pkgs/applications/science/misc/root/5.nix:    "-DCMAKE_INSTALL_INCLUDEDIR=include"
pkgs/applications/science/misc/root/default.nix:    "-DCMAKE_INSTALL_INCLUDEDIR=include"
pkgs/applications/science/robotics/gazebo/default.nix:  "-DCMAKE_INSTALL_INCLUDEDIR=include" ]
pkgs/desktops/lxqt/libqtxdg/default.nix:      "-DCMAKE_INSTALL_INCLUDEDIR=include"
pkgs/development/compilers/hhvm/default.nix:  # the cmake package does not handle absolute CMAKE_INSTALL_INCLUDEDIR correctly
pkgs/development/compilers/hhvm/default.nix:  cmakeFlags = "-DCMAKE_INSTALL_INCLUDEDIR=include";
pkgs/development/compilers/solc/patches/shared-libs-install.patch:+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libdevcore
pkgs/development/compilers/solc/patches/shared-libs-install.patch:+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libevmasm
pkgs/development/compilers/solc/patches/shared-libs-install.patch:+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libsolidity
pkgs/development/compilers/solc/patches/shared-libs-install.patch:+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyul
pkgs/development/compilers/solc/patches/shared-libs-install.patch:+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/liblangutil
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:+    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:+    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:+    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:-    "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/gtest/fix-cmake-config-includedir.patch:+    "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
pkgs/development/libraries/hyperscan/default.nix:      --replace "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
pkgs/development/libraries/ignition-math/default.nix:    cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_INCLUDEDIR=include -DCMAKE_INSTALL_LIBDIR=lib"
pkgs/development/libraries/srt/default.nix:    # the cmake package does not handle absolute CMAKE_INSTALL_INCLUDEDIR correctly
pkgs/development/libraries/srt/default.nix:    "-DCMAKE_INSTALL_INCLUDEDIR=include"
pkgs/development/libraries/yder/fix-pkgconfig.patch:-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
pkgs/development/libraries/yder/fix-pkgconfig.patch:+includedir=@CMAKE_INSTALL_INCLUDEDIR@
pkgs/development/tools/build-managers/cmake/setup-hook.sh:    cmakeFlags="-DCMAKE_INSTALL_INCLUDEDIR=${!outputInclude}/include $cmakeFlags"

On the srt side, it worked fine before upstream change https://github.com/Haivision/srt/pull/421/files because it was hardcoded before.

@nh2
Copy link
Contributor

nh2 commented Oct 22, 2019

PR with fix for master in #71669; should be backported to 19.09 afterwards.

dtzWill pushed a commit to dtzWill/nixpkgs that referenced this issue Oct 30, 2019
dtzWill added a commit to dtzWill/nixpkgs that referenced this issue Oct 30, 2019
@nh2
Copy link
Contributor

nh2 commented Nov 2, 2021

@dtzWill I noticed you picked and then reverted it ^

Is there a better way to do this?

I still get this problem with many other packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants