libgit2 / libgit2/libgit2

broken libgit2 package in nixpkgs - Imported target "libgit2::libgit2package" includes non-existent path in its INTERFACE_INCLUDE_DIRECTORIES

Aberta
#7,293 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
C
Estrelas
10.6k
Forks
2.7k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece com o package.nix do nixpkgs vinculado e compare suas saídas com libgit2Targets.cmake no caminho dev store indicado. Reproduza o exemplo de CMakeLists.txt da issue e, em seguida, verifique se o target libgit2::libgit2package gerado referencia a saída que contém os headers e é configurado com sucesso.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
c, cmake
Domínio
build-system
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.