【问题标题】:libgit2 - what is the correct install prefix?libgit2 - 什么是正确的安装前缀?
【发布时间】:2014-06-28 07:18:24
【问题描述】:

我正在按照 README.md 文件中指定的 libgit2 安装说明进行操作。

指定为“安装前缀”的正确目录是什么?

这是来自 README.md 的相关摘录:

The `libgit2` library is built using [CMake](<http://www.cmake.org>) (version 2.6 or newer) on all platforms.

On most systems you can build the library using the following commands

        $ mkdir build && cd build
        $ cmake ..
        $ cmake --build .

Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace.

To install the library you can specify the install prefix by setting:

        $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix
        $ cmake --build . --target install

【问题讨论】:

  • FTR,没有什么 libgit2 特定的。安装前缀与任何应用程序/库的所有其他构建系统中的相同。
  • @CarlosMartinNieto 很遗憾 libgit2 没有将其设置为合理的默认值,当它本应继续安装到最可能的位置时,我花了很多时间来解决这个问题。
  • CMake 会这样做,如果您不指定任何内容,它会尝试安装到 /usr/local/,这是用户安装的程序和库的正确默认值。跨度>

标签: libgit2


【解决方案1】:

你可以选择你喜欢的任何目录。您只需要确保您对该目录具有写入权限。除此之外,当您想要针对您的 libgit2 构建构建另一个程序时,您必须指示其构建系统在您安装 libgit2 的文件夹中查找头文件和库文件。同样,如果您想使用构建的共享 libgit2-library 运行另一个程序,则必须将 libgit2 安装的相应文件夹添加到操作系统的相应搜索路径(即在 Linux 的情况下,您可以设置环境变量 LD_LIBRARY_PATH )。如果您没有明确指定安装目录,我假设默认值为/usr/usr/local。在这种情况下,您可能不需要额外的配置来使用您的 libgit2 构建或运行其他程序,因为这些路径通常已经包含在相应的设置中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-31
    • 1970-01-01
    • 2015-06-30
    • 1970-01-01
    • 2015-04-01
    • 1970-01-01
    • 2011-05-29
    相关资源
    最近更新 更多