Unable to import git2go when building git-backup
I wanted to use the latest version of git-backup, so I ran:
golang16/bin/go build -o git-backup *.go
but then, go complained about an import requiring a git repo to be cloned and built: github.com/libgit2/git2go. After some research, I did the following steps:
mkdir gopath
export GOPATH=$(pwd)/gopath
mkdir $GOPATH/{src,bin,pkg} # git-backup is cloned in src
export PATH="$PATH:$(pwd)/srv/runner/software/f7445a0b1019dad7cbae9b7eaeedb0b0/parts/pkgconfig/bin/" # pkgconfig is required by go get
[...]/go get "github.com/libgit2/git2go"
but this last one seems to be able to clone the repo in gopath/src/ but then fails:
$ ./srv/runner/software/f7445a0b1019dad7cbae9b7eaeedb0b0/parts/golang16/bin/go get "github.com/libgit2/git2go"
# pkg-config --cflags libgit2
Package libgit2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libgit2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libgit2' found
pkg-config: exit status 1
I found on my system a file called libgit2.pc in /srv/slapgrid/slappart18/srv/runner/software/f7445a0b1019dad7cbae9b7eaeedb0b0/parts/gitlab/vendor/bundle/ruby/2.1.0/gems/rugged-0.24.0/vendor/libgit2/build/
so I appended this path to PKG_CONFIG_PATH environment variable.
then, I get:
$ ./srv/runner/software/f7445a0b1019dad7cbae9b7eaeedb0b0/parts/golang16/bin/go get "github.com/libgit2/git2go"
# github.com/libgit2/git2go
gopath/src/github.com/libgit2/git2go/blame.go:4:18: fatal error: git2.h: No such file or directory
compilation terminated.
which is in ./srv/runner/software/f7445a0b1019dad7cbae9b7eaeedb0b0/parts/gitlab/vendor/bundle/ruby/2.1.0/gems/rugged-0.24.0/vendor/libgit2/include/git2.h
I tried to add its parent directory to GOPATH but it didn't help much, so I don't know how I am supposed to do to be able to import git2go and build the new git-backup. Do you have any clue?