librelist archives

« back to archive

Could not start program linked to libgit.

Could not start program linked to libgit.

From:
徐迪
Date:
2011-09-26 @ 08:03
---------- 已转发邮件 ----------
发件人: 徐迪 <xudifsd@gmail.com>
日期: 2011年9月26日 下午3:57
主题: Could not start program linked to libgit.
收件人: libgit2邮件列表 <libgit2@librelist.org>


following is what i did:
$ git clone git://github.com/libgit2/libgit2.git
$ cd libgit2
$ mkdir build && cd build
$ cmake ..
$ cmake --build .
$ sudo cmake --build . --target install

all command above works right

and i edit a file to have a try

#include <stdio.h>
#include <git2.h>

int main(int argc, char **argv){
       git_repository *repo;
       git_repository_open(&repo, "/home/xudifsd/dev/git/.git");
}

and then
$ gcc libgit2.c -lgit2
link is ok
but when it comes to run, it's died as soon as it start

$ ./a.out
./a.out: error while loading shared libraries: libgit2.so.0: cannot
open shared object file: No such file or directory

there are libgit2.so in /usr/local/lib .
Am i did something wrong?

Re: [libgit2] Could not start program linked to libgit.

From:
schu
Date:
2011-09-26 @ 08:10
On 09/26/2011 10:03 AM, 徐迪 wrote:
> $ ./a.out
> ./a.out: error while loading shared libraries: libgit2.so.0: cannot
> open shared object file: No such file or directory
> 
> there are libgit2.so in /usr/local/lib .
> Am i did something wrong?

Please see:

http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html