1

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

  • 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.
  • 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?

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

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

Kind regards Rob

****************Update 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?

# 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?

****************Update 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?

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****************

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

****************Update 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.

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()
Saragan
  • 75
  • 3
  • 10
  • The simplest way is to set `LIBSSH2_INCLUDE_DIRS` to include directory of libssh2(where `libssh2.h` is located) and `LIBSSH2_LIBRARIES` to full path to libssh library: `cmake -DLIBSSH2_INCLUDE_DIRS= -DLIBSSH2_LIBRARIES=` – Tsyvarev Sep 23 '15 at 20:45
  • i have tried that with no success, i pulled out of the make file some code see main reply :) – Saragan Sep 23 '15 at 21:07
  • As not a `find_package()` command is used but `pkg_check_modules()` function, setting `LIBSSH2_*` variables have no meaning. This function just search `.pc` file described package. If this file is not at its standard location, you should set variable `CMAKE_PREFIX_PATH` to directory, contained this file. – Tsyvarev Sep 23 '15 at 22:10
  • Did you install the development package for libssh2? If you didn't install it in a standard location, you need to tell `pkg-config` where to find your custom packages by setting the `PKG_CONFIG_PATH` variable. – Carlos Martín Nieto Sep 24 '15 at 09:45
  • Can someone post a finalized answer? I've been trying to build .23.1 and cannot figure out how to get the thing to pick up LIBSSH2. – Mike G Apr 16 '16 at 01:37

1 Answers1

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

so effectively

LIBSSH2_FOUND (set it to TRUE)
LIBSSH2_INCLUDE_DIRS
LIBSSH2_LIBRARY_DIRS
Community
  • 1
  • 1
Saragan
  • 75
  • 3
  • 10