libgit2 / libgit2-backends

Standalone ODB backends for the libgit2 library
191 stars 54 forks source link

Build failure #13

Open stinky22 opened 9 years ago

stinky22 commented 9 years ago

I'm on OSX Yosemite and I can't build the memcached backend.

Here are the steps I'm executing:

brew install libmemcached
brew install libgit2
git clone https://github.com/libgit2/libgit2-backends.git
cd libgit2-backends
cmake memcached
cmake --build .

Here is partial output from the build step:

$ cmake --build .
Scanning dependencies of target git2-memcached
[100%] Building C object CMakeFiles/git2-memcached.dir/memcached.c.o
/Users/stinky/Downloads/libgit2-backends/memcached/memcached.c:34:18: error: field has incomplete type 'git_odb_backend' (aka 'struct git_odb_backend')
        git_odb_backend parent;
                        ^
/usr/local/include/git2/types.h:84:16: note: forward declaration of 'struct git_odb_backend'
typedef struct git_odb_backend git_odb_backend;
               ^
/Users/stinky/Downloads/libgit2-backends/memcached/memcached.c:81:10: error: use of undeclared identifier 'GIT_ENOMEM'
                return GIT_ENOMEM;
                       ^
/Users/stinky/Downloads/libgit2-backends/memcached/memcached.c:85:10: error: use of undeclared identifier 'GIT_ENOMEM'
                return GIT_ENOMEM;
                       ^
/Users/stinky/Downloads/libgit2-backends/memcached/memcached.c:105:12: error: use of undeclared identifier 'GIT_SUCCESS'
                status = GIT_SUCCESS;
...

It appears that the compiler can't find libgit2, but cmake seemed to find it just fine in the cmake memcached step.

carlosmn commented 9 years ago

This code isn't maintained, so there won't be an update from the libgit2 team, though fwiw it's finding libgit2 just fine, but the structure and the error codes mentioned in the error message have changed.

stinky22 commented 9 years ago

I see, thanks for the reply. Are there any active libgit2 backends for memcached/mysql/something in the wild? My brief search doesn't turn up anything.

Also, from a libgit2 team standpoint, would you discourage me from creating my own backend? If nobody is using backends my concern is that libgit2 support for backends may be spotty in future releases.

white-gecko commented 7 years ago

I get more or less the same error, when I try to build the memcached backend:

$ git clone --depth 1 --branch v0.26.0 https://github.com/libgit2/libgit2.git
$ cd libgit2
$ mkdir build && cd build
$ cmake ..
$ cmake --build . --target install
$ ldconfig
$ cd ..
$ git clone --depth 1 https://github.com/libgit2/libgit2-backends.git
$ cd libgit2-backends/memcached
$ mkdir build && cd build
$ cmake ../
$ cmake --build .

the last cmake fails with:

-- The C compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found libgit2: /usr/local/lib/libgit2.so  
-- Found LIBMEMCACHED: /usr/lib/x86_64-linux-gnu/libmemcached.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /libgit2/libgit2-backends/memcached/build
Scanning dependencies of target git2-memcached
[100%] Building C object CMakeFiles/git2-memcached.dir/memcached.c.o
/libgit2/libgit2-backends/memcached/memcached.c:34:18: error: field ‘parent’ has incomplete type
  git_odb_backend parent;
                  ^
/libgit2/libgit2-backends/memcached/memcached.c: In function ‘memcached_backend__read_header’:
/libgit2/libgit2-backends/memcached/memcached.c:81:10: error: ‘GIT_ENOMEM’ undeclared (first use in this function)
   return GIT_ENOMEM;
          ^
/libgit2/libgit2-backends/memcached/memcached.c:81:10: note: each undeclared identifier is reported only once for each function it appears in
/libgit2/libgit2-backends/memcached/memcached.c:105:12: error: ‘GIT_SUCCESS’ undeclared (first use in this function)
   status = GIT_SUCCESS;
            ^
/libgit2/libgit2-backends/memcached/memcached.c: In function ‘memcached_backend__read’:
/libgit2/libgit2-backends/memcached/memcached.c:130:10: error: ‘GIT_ENOMEM’ undeclared (first use in this function)
   return GIT_ENOMEM;
          ^
/libgit2/libgit2-backends/memcached/memcached.c:155:12: error: ‘GIT_SUCCESS’ undeclared (first use in this function)
   status = GIT_SUCCESS;
            ^
/libgit2/libgit2-backends/memcached/memcached.c: In function ‘memcached_backend__exists’:
/libgit2/libgit2-backends/memcached/memcached.c:179:10: error: ‘GIT_ENOMEM’ undeclared (first use in this function)
   return GIT_ENOMEM;
          ^
/libgit2/libgit2-backends/memcached/memcached.c: In function ‘memcached_backend__write’:
/libgit2/libgit2-backends/memcached/memcached.c:213:10: error: ‘GIT_ENOMEM’ undeclared (first use in this function)
   return GIT_ENOMEM;
          ^
/libgit2/libgit2-backends/memcached/memcached.c:242:11: error: ‘GIT_SUCCESS’ undeclared (first use in this function)
  status = GIT_SUCCESS;
           ^
/libgit2/libgit2-backends/memcached/memcached.c: In function ‘git_odb_backend_memcached’:
/libgit2/libgit2-backends/memcached/memcached.c:271:10: error: ‘GIT_ENOMEM’ undeclared (first use in this function)
   return GIT_ENOMEM;
          ^
/libgit2/libgit2-backends/memcached/memcached.c:296:9: error: ‘GIT_SUCCESS’ undeclared (first use in this function)
  return GIT_SUCCESS;
         ^
make[2]: *** [CMakeFiles/git2-memcached.dir/memcached.c.o] Error 1
CMakeFiles/git2-memcached.dir/build.make:54: recipe for target 'CMakeFiles/git2-memcached.dir/memcached.c.o' failed
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/git2-memcached.dir/all' failed
make[1]: *** [CMakeFiles/git2-memcached.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

Since pygit2 just received support for custom backends with 0.25.1 I can't imagine, that the custom back-ends are completely unused. Somebody must know something about it ;-)

ethomson commented 7 years ago

These example custom backends don't get a lot of love. I'll put this on my todo list (though updating them would be rather easy for somebody interested in submitting a first-time pull request).

But these are just the examples: the custom backends are heavily used. They're relied upon in production by Visual Studio Team Services, which stores its Git repositories in a Azure Blob Storage, and by Team Foundation Server, which stores its Git repositories in SQL Server blob storage.

Custom backends are going to remain supported, period. 😀