How to use libssh in a project
-
wrote on 20 Dec 2017, 14:48 last edited by
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
-
Hi and Welcome
Maybe this helps
https://forum.qt.io/topic/64367/integration-of-libssh-into-a-qt-projectTHe key is
LIBS += -L$$PWD/LibSSH/lib -lsshwhich 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]
-
@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?@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.
-
@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.
@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.
-
wrote on 21 Dec 2017, 08:57 last edited by
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 )
-
wrote on 21 Dec 2017, 10:52 last edited by
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.
-
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.
-
wrote on 22 Dec 2017, 00:04 last edited by
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/9