broken libgit2 package in nixpkgs - Imported target "libgit2::libgit2package" includes non-existent path in its INTERFACE_INCLUDE_DIRECTORIES
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 10.6k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
i guess this is a downstream bug in nixpkgs
but maybe someone here cares to fix it
i can use libgit2 via pkg-config
CMakeLists.txt - using libgit2 via pkg-config
cmake_minimum_required(VERSION 3.20)
project(git-file-times-project LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBGIT2 REQUIRED libgit2)
add_executable(git-file-times
src/main.cpp
)
target_include_directories(git-file-times PRIVATE
${LIBGIT2_INCLUDE_DIRS}
)
target_link_directories(git-file-times PRIVATE
${LIBGIT2_LIBRARY_DIRS}
)
target_link_libraries(git-file-times PRIVATE
${LIBGIT2_LIBRARIES}
)
target_compile_options(git-file-times PRIVATE
${LIBGIT2_CFLAGS_OTHER}
)
but i cannot use libgit2 via cmake targets
CMakeLists.txt - using libgit2 via cmake targets
cmake_minimum_required(VERSION 3.20)
project(git-file-times-project LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(libgit2 REQUIRED)
add_executable(git-file-times
src/main.cpp
)
target_link_libraries(git-file-times PRIVATE
libgit2::libgit2package
)
when i try to use libgit2 via cmake targets
cmake throws
CMake Error in CMakeLists.txt:
Imported target "libgit2::libgit2package" includes non-existent path
"/nix/store/ic7b9ni4f81807835k9cw3jb0ak31cpg-libgit2-1.9.2/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
/nix/store/n4912v5kzbc9bicq3pi865kdmhzdngxa-libgit2-1.9.2-dev/lib/cmake/libgit2/libgit2Targets.cmake
# The installation prefix configured by this project.
set(_IMPORT_PREFIX "/nix/store/ic7b9ni4f81807835k9cw3jb0ak31cpg-libgit2-1.9.2")
# Create imported target libgit2::libgit2package
add_library(libgit2::libgit2package SHARED IMPORTED)
set_target_properties(libgit2::libgit2package PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "/nix/store/wbyqkb1vpm41s4jb8pv0i9h4jv08xdrv-openssl-3.6.1/lib/libssl.so;/nix/store/wbyqkb1vpm41s4jb8pv0i9h4jv08xdrv-openssl-3.6.1/lib/libcrypto.so;/nix/store/rqm937a4rpsa6qdb86slfjkvm7h4wjd5-llhttp-9.3.1/lib/libllhttp.so;/nix/store/khhzkpj9169ydnyg7jjrjx7s5ygdkcas-pcre2-10.46/lib/libpcre2-8.so;/nix/store/9lzm6krq5ikzbqbmazbh5jmzwph99rz3-libssh2-1.11.1/lib/libssh2.so;/nix/store/ixhlv41i2wpl84xgjcks061dz4yssbg3-zlib-1.3.2/lib/libz.so;rt"
)
_IMPORT_PREFIX should be the dev output of libgit2
/nix/store/n4912v5kzbc9bicq3pi865kdmhzdngxa-libgit2-1.9.2-dev
the dev output of libgit2 contains the header files
$ ls /nix/store/n4912v5kzbc9bicq3pi865kdmhzdngxa-libgit2-1.9.2-dev/include/
git2 git2.h
the main output of libgit2 contains only the git2 executable
$ find /nix/store/ic7b9ni4f81807835k9cw3jb0ak31cpg-libgit2-1.9.2 -type f
/nix/store/ic7b9ni4f81807835k9cw3jb0ak31cpg-libgit2-1.9.2/bin/git2
shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell {
buildInputs = [
cmake
pkg-config
libgit2
# for libgit2
openssl
pcre2
zlib
];
}
this is different from #7062
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked nixpkgs package.nix and compare its outputs with libgit2Targets.cmake in the reported dev store path. Reproduce the CMakeLists.txt example from the issue, then verify that the generated libgit2::libgit2package target references the output containing the headers and configures successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100