libgit2示例没有正确构建

问题描述:

我在我的Ubuntu 16.04机器上创建了libgit2,并且一切都很正常。我在/examples目录跑make,当我尝试运行./log我得到以下几点:libgit2示例没有正确构建

./log: error while loading shared libraries: libgit2.so.26: cannot open shared object file: No such file or directory

但是,在/build文件夹中我确实有两个libgit2.solibgit2.so.26,所以我真的不知道我是什么失踪。如果需要,我可以发布更多信息。我正在使用cmake version 3.5.1

+1

感谢您提出这个问题 - 我们已经清理了我们构建示例更新的方式! –

示例中的Makefile将提供使用指南,当您已将libgit2实际安装到系统库位置时,这应该适用。

要在源目录中构建示例,应该使用cmake构建示例。给定一个新的配置:

$ mkdir build 
$ cd build 
$ cmake .. -DBUILD_EXAMPLES=ON 
$ cmake --build . 

    ...truncated... 

$ examples/log 
commit 8ac8c78c35905f7f9cc37f240c3d633a7cc5a5e3 
Merge: 34ec6f3 4955125 
Author: Edward Thomson <[email protected]> 
Date: Mon Oct 9 15:15:08 2017 +0100 

    Merge pull request #4356 from pks-t/pks/static-clar 

    cmake: use static dependencies when building static libgit2 

    ...truncated...