Search code examples
c++qtubuntucmakelibssh

libssh's functions couldn't be found on qt and cmake error while building libssh


I want to use libssh library in Qt and my os is ubuntu 18.04 .
so I cloned the library's file and tried to build it with cmake. I followed the tutorial in INSTALL folder but the building process can't be completed.
at first I had this error :

Could NOT find CMocka (missing: CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR)**

i used rm CMakeCache.txt and cmake and after that make. that was ok, but again when I used make install i had this error:

CMake Error at cmake_install.cmake:41 (file):
  file INSTALL cannot copy file
  "/home/heydari.f/libssh-mirror/build/libssh.pc" to
  "/usr/local/lib/pkgconfig/libssh.pc".
Makefile:85: recipe for target 'install' failed
make: *** [install] Error 1

what should I do?
and after building process, is there anything to do with qt? because it could't find libssh's functions obviously!


Solution

  • file INSTALL cannot copy file
    "/home/heydari.f/libssh-mirror/build/libssh.pc" to
    "/usr/local/lib/pkgconfig/libssh.pc"

    This is a permissions issue. Use sudo make install to solve this. sudo gives root privileges to a command. Use it carefully.

    ** error: undefined reference to 'ssh_session_is_known_server'**

    undefined reference usually means you are trying to access something, in this case a function, which is not found. This function belongs to libssh, so it means that either you don't have libssh-dev installed or you are giving the path to the library incorrectly. Since the latter is highly unlikely, i am going to assume libssh is missing. On Ubuntu you can install it using following command:

    sudo apt install openssh-server libssh-dev