Skip to content

Revert include path regression #7039

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

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Revert include path regression #7039

merged 1 commit into from
Feb 26, 2025

Conversation

ytnuf
Copy link
Contributor

@ytnuf ytnuf commented Feb 13, 2025

Problem

I've upgraded to using libgit2 v1.9, and I've been getting build errors that weren't there previously. This is caused by the custom <stdint.h> header file.

The build errors only occur when using a installed libgit2.
I am using Fedora Linux 41.

Example usage code

CMakeLists.txt

cmake_minimum_required(VERSION 3.30)
project(using_libgit2)
add_executable(my_exe main.cpp)
find_package(libgit2)
target_link_libraries(my_exe PRIVATE libgit2::libgit2package)

main.cpp

#include <cstdint>
int main() {
    return 0;
}

Trying to build this leads to errors like this:

/usr/include/c++/14/cstdint:51:11: error: ‘int8_t’ has not been declared in ‘::’
   51 |   using ::int8_t;

Explanation

When using the installed libgit2 the include paths will now contain include/git2 instead of include. This is problematic because there's a custom <stdint.h> in the git2 folder.
Now any user code that has #include <stdint.h>, will now include the custom <stdint.h> header instead of the standard one. Which causes the build error.

Solution

This PR fixes this regression.

@ethomson ethomson merged commit eb22b60 into libgit2:main Feb 26, 2025
19 checks passed
@ethomson
Copy link
Member

Thanks for the fix!

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

Successfully merging this pull request may close these issues.

2 participants