Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to use libssh in a project

How to use libssh in a project

Scheduled Pinned Locked Moved Solved Installation and Deployment
9 Posts 5 Posters 10.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Valveware
    wrote on last edited by
    #1

    Dear Qties,

    I am very new to developing with Qt and C++, however for a school project I am required to make a dashboard application. It should be able to connect to a remote host and send commands over ssh and read the responses.

    Through googling I have found that it would be best to use the libssh library to achieve this. I am too inexperienced to know how to import this library into my project and googling isn't helping me out. I am currently working on a Mac but the application should also be able to run on Ubuntu. Can anyone help me out by listing the steps required to use the library? Or maybe you know of a better way to implement this kind of functionality?

    Thanks in advance,

    Kind Regards Valveware

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and Welcome
      Maybe this helps
      https://forum.qt.io/topic/64367/integration-of-libssh-into-a-qt-project

      THe key is
      LIBS += -L$$PWD/LibSSH/lib -lssh

      which tells it where to look for the DLL.

      On mac or Ubunto it might be a .SO file, not dll but idea is the same.

      [edit: fixed linker option SGaist]

      1 Reply Last reply
      2
      • V Offline
        V Offline
        Valveware
        wrote on last edited by
        #3

        @mrjj
        When I downloaded the libssh files from their website it doesn't include a .dll or an .SO file. Where should I be getting these?

        aha_1980A 1 Reply Last reply
        0
        • V Valveware

          @mrjj
          When I downloaded the libssh files from their website it doesn't include a .dll or an .SO file. Where should I be getting these?

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Valveware said in How to use libssh in a project:

          @mrjj
          When I downloaded the libssh files from their website it doesn't include a .dll or an .SO file. Where should I be getting these?

          I guess you fetched the source code. you will get the binaries by compiling the sources ;)

          Honestly, either compile the sources yourself or use Google to find suitable binaries for your OS and your compiler.

          Qt has to stay free or it will die.

          aha_1980A 1 Reply Last reply
          3
          • aha_1980A aha_1980

            @Valveware said in How to use libssh in a project:

            @mrjj
            When I downloaded the libssh files from their website it doesn't include a .dll or an .SO file. Where should I be getting these?

            I guess you fetched the source code. you will get the binaries by compiling the sources ;)

            Honestly, either compile the sources yourself or use Google to find suitable binaries for your OS and your compiler.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Valveware: I just read about your Ubuntu requirement.

            For this OS the libssh library and header files can be installed by running

            sudo apt-get install libssh-dev

            in a Terminal.

            Qt has to stay free or it will die.

            1 Reply Last reply
            3
            • V Offline
              V Offline
              Valveware
              wrote on last edited by
              #6

              Thanks for the replies however I am still stuck with my problem. I have decided to not try to make libssh work. So i was looking into Qssh (https://github.com/lvklabs/QSsh). I managed to download this and qmake it. But then when making it complains saying fatal error: 'botan/mode_pad.h' file not found. When opening the example in qt and trying to build it says 'library not found for -lbotan2' thus the linker fails. I got the idea that botan should be in the qt library so why can't it find this?

              Another question is, I found an example for ssh usage in the qt-creator library. But how can i make qt understand where to find #include "sshconnection.h" ?( https://github.com/danimo/qt-creator/blob/master/src/libs/ssh/sshconnection.h )

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Valveware
                wrote on last edited by
                #7

                I have managed to solve my initial problem. I have now been able to include the libssh library. Thanks a lot for the help, I know these are dumb questions but hey , I'm learning. If you can I'd still like an answer to my last reply just to know how or why but right now I can continue on my application trying to set up ssh to send commands.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Hi,

                  For botan, no it's a dependency that you have to install. By the way, QSsh is not an official Qt module, what the author did was to take out of Qt Creator the implementation of ssh and sftp connection and make an independent library out of it.

                  As for your last question, the same as you would for any other library however you'll have to also find the corresponding library to link against.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • Uncle_MastaU Offline
                    Uncle_MastaU Offline
                    Uncle_Masta
                    wrote on last edited by
                    #9

                    I think you need to give us the actual problem. Where are you stuck?

                    • install libssh (you've done that)
                    • Include the header file
                    • compile it in (Have you done that? someone explained how to link it, did you add the "INCLUDEPATH += ..."?
                    • Use the API.

                    If this is a programming class, then using the API is all on you.

                    1 Reply Last reply
                    2

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved