Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I missing git2.h and how do I get it back?

I am experiencing an odd problem every time I try the set-up of pygit2. Below is what I run and the error generated.

$ python3 setup.py install
running install
running build
running build_py
running build_ext
building '_pygit2' extension
/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/usr/local/include -Iinclude -I/usr/local/Cellar/python3/3.2.3/include/python3.2m -c src/pygit2.c -o build/temp.macosx-10.7-x86_64-3.2/src/pygit2.o
In file included from src/pygit2.c:32:
include/pygit2/error.h:6:10: fatal error: 'git2.h' file not found
#include <git2.h>
         ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

I think I have successfully installed libgit2 (the build and make finished fine). Maybe it is a path issue? I have set LIBGIT2 environment variable to the src directory in the libgit2 folder. Is that the right place?

like image 798
nzaccardi Avatar asked Jun 26 '12 22:06

nzaccardi


2 Answers

I never installed libgit2, but the following might help:

If your distro's repository contains libgit2, I'll advice to remove what you have compiled before and install libgit2 (binaries) and libgit2-dev (headers etc.) packages from the repo. This will place binaries and sources to the right directories.

Otherwise, try symlinking git2.h to /usr/local/include

like image 71
dmytro Avatar answered Oct 16 '22 08:10

dmytro


It doesn't look like the LIBGIT2 variable took (could you show how you set the variable?) as the extra include directive uses /usr/local/include (which is the default).

The LIBGIT2 env var needs to be set to the prefix where the library was installed, typically /usr or /usr/local. It doesn't look like the library was installed to /usr/local as the compiler can't find it, so maybe you need export LIBGIT2=/usr before running setup.py.

like image 2
Carlos Martín Nieto Avatar answered Oct 16 '22 08:10

Carlos Martín Nieto