Libgit2和libssh2 CMake包“libssh2”没有找到。

时间:2022-09-27 04:50:06

So trying to CMake libgit on windows, ive build a valid libssh2 but I'm getting this error when compiling libgit

因此,尝试在windows上创建libgit,我构建了一个有效的libssh2,但是在编译libgit时,我得到了这个错误

  • checking for module 'libssh2'
  • 检查模块“libssh2”
  • package 'libssh2' not found
  • 包“libssh2”未找到
  • LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
  • LIBSSH2不见了。设置CMAKE_PREFIX_PATH,如果它安装在默认搜索路径之外。
  • Configuring done
  • 配置完成

now ive tried setting the default prefix path and ive tried setting library paths but I just cant get it to see my libssh2? any ideas?

现在我尝试设置默认的前缀路径,尝试设置库路径,但是我不能让它看到我的libssh2?什么好主意吗?

its getting quite frustrating as I have it right here and it cant find it :D

它变得非常令人沮丧,因为我有它在这里,它找不到:D

maybe someone could tell me the correct path it should be installed?

也许有人能告诉我应该安装正确的路径?

Kind regards Rob

亲切的问候抢劫

****************Update 1****************

* * * * * * * * * * * * * * * *更新1 * * * * * * * * * * * * * * * *

so i pulled out of the make file this....seems to have changed but as far as i can see PKG_CHECK_MODULES(LIBSSH2 libssh2) is the check, maybe it doesnt set LIBSSH2_FOUND?

所以我退出了文件这....似乎已经发生了变化,但在我看来,PKG_CHECK_MODULES(LIBSSH2 LIBSSH2)是检查,也许它没有设置LIBSSH2_FOUND?

# Optional external dependency: libssh2
 IF (USE_SSH)
    PKG_CHECK_MODULES(LIBSSH2 libssh2)
 ENDIF()
 IF (LIBSSH2_FOUND)
    ADD_DEFINITIONS(-DGIT_SSH)
    INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIRS})
    LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS})
    LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
    #SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}")
    SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})

    CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}"   libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}"       HAVE_LIBSSH2_MEMORY_CREDENTIALS)
IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS)
    ADD_DEFINITIONS(-DGIT_SSH_MEMORY_CREDENTIALS)
ENDIF()
ELSE()
    MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
 ENDIF()

ive tried setting LIBSSH2_INCLUDE_DIRS /LIBSSH2_INCLUDE_DIR and LIBSSH2_LIBRARIES to no avail?

我试过设置LIBSSH2_INCLUDE_DIRS /LIBSSH2_INCLUDE_DIR和LIBSSH2_LIBRARIES,但没有效果?

****************Update 2****************

* * * * * * * * * * * * * * * *更新2 * * * * * * * * * * * * * * * *

So as per sugested its searching for the .pc file. well i found it....pointed it directly at it and it still couldnt find it? i even pointed it several directories up from it. the paths in the pc file seem to match the locations i would expect.? is this make file just completly borked?

所以按照建议搜索。pc文件。我发现它....直接指向它,它还是找不到?我甚至把它指向上面的几个目录。pc文件中的路径似乎与我期望的位置相匹配。这个制作文件是完全有孔的吗?

checking for module 'libssh2'
     package 'libssh2' not found
LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.

****************Update 3****************

* * * * * * * * * * * * * * * *更新3 * * * * * * * * * * * * * * * *

So update 3 i installed a binary of openssl on windows, further download libssh2-master and used cmake gui to build a visual studio solution which had no errors, the solution compiled and built. I made an install and package from the solution and installed in the suggested default location, i also took the header files, and library files and put them in my vc folder, and once i tried building the shared lib and put the dll in system32 etc so ive tried quite a lot :) libgit still cant find it Hope thats a bit more info

因此,我在windows上安装了一个openssl的二进制文件,进一步下载了libssh2-master,并使用cmake gui构建了一个没有错误的visual studio解决方案,该解决方案进行了编译和构建。我安装和包装的解决方案和建议安装在默认的位置,我也带着头文件,库文件,把它们放在我的vc文件夹,一旦我试着在system32系统建立共享的*,把dll等所以我试过很多:libgit仍然不能找到它希望更多的信息

****************Update 4****************

* * * * * * * * * * * * * * * *更新4 * * * * * * * * * * * * * * * *

So fixed it in the end... i went back through the git history and blamed the make file. found someone originally wrote it with FIND_PACKAGE but changed it to suit their own needs.

所以最后修好了……我回顾了git历史,并将其归咎于make文件。发现有人最初用FIND_PACKAGE来编写它,但是为了满足自己的需要而修改了它。

so i changed it back and used the below. no longer complains and finds what it needs and compiles and works. so yay thanks for your help

所以我把它改回来用下面的。不再抱怨和发现它需要什么、编译和工作。谢谢你的帮助

IF (USE_SSH)
    FIND_PACKAGE(LIBSSH2)
ENDIF()
IF (LIBSSH2_FOUND)
    ADD_DEFINITIONS(-DGIT_SSH)
    INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIR})
    LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS})
    LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
    SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} libssh2")
    SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
    ADD_DEFINITIONS(-DGIT_SSH_MEMORY_CREDENTIALS)
ENDIF()

1 个解决方案

#1


0  

I actually started a new thread on this, i successfully managed it in the end. Answer is on libgit2 with libssh2 and libopenssl on windows

实际上,我启动了一个新的线程,我最终成功地管理了它。答案在libgit2上,在windows上使用libssh2和libopenssl。

so effectively

所以有效地

LIBSSH2_FOUND (set it to TRUE)
LIBSSH2_INCLUDE_DIRS
LIBSSH2_LIBRARY_DIRS

#1


0  

I actually started a new thread on this, i successfully managed it in the end. Answer is on libgit2 with libssh2 and libopenssl on windows

实际上,我启动了一个新的线程,我最终成功地管理了它。答案在libgit2上,在windows上使用libssh2和libopenssl。

so effectively

所以有效地

LIBSSH2_FOUND (set it to TRUE)
LIBSSH2_INCLUDE_DIRS
LIBSSH2_LIBRARY_DIRS