user7431005
user7431005

Reputation: 4557

qt linux deployment - Network OpenSSL problem?

I want to send an application I wrote to some colleagues. So far, I simply copied the binaries together with all libraries in a .zip file and sent it to them. This worked fine.

My latest changes involve that I'm using the Qt Network library. Therefore, I have included three new library files in my .zip file:

The application starts and runs but at some point, it is expected to download multiple files from the web. Unfortunately, some of the downloads fail. It is possible to download files from FTP servers but not from https.

I'm assuming that it could have to do with OpenSSL is missing but I'm not sure. When I started using the Qt Network library, I remember that I had problems getting it to download from https and the problems were related to OpenSSL.

Instead of downloading the files, I get the following error message:

qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
We got a connection error when networkLayerState is Unknown
qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
...

The error message clearly refers to the SSL library.

Mind that I do not believe that my code has some problem since it is working on my computer. Therefore, I'm not posting code here. I think it has to do with the way I deploy the code and that some libraries are missing? What can I do?

I tried to run ldd on the executable and on libQt5Network.so.5 but it does not list anything related to OpenSSL.

Please mind that I'm not a computer expert, I'm just a scientist who wants to distribute his software as easy as possible to some colleagues.

Upvotes: 0

Views: 665

Answers (1)

Danil Karpov
Danil Karpov

Reputation: 101

You're right about problem here - QNetwork needs OpenSSL to work

So, you need to figure out a few things to provide OpenSSL libs

  1. By default, Linux links to libs, that installed in system. So, target system needs to have QT libs and OpenSSL with exactly same versions, as you have. Most of the time it is awful solution, because you can't guarantee that libs won't update

  2. You can help Linux find libs with LD_LIBRARY_PATH environment variable. With this method, you can send needed libs with executable file and point to them with LD_LIBRARY_PATH. You'll need shell script to run app comfortably. More about this method and examples you can find in QT docs

  3. Package you app with libs. You can use distribution native package manager's formats. DEB and RPM packages creation information can be found on QT wiki. Or you can use universal AppImage format. With linuxdeployqt it becomes pretty easy, and it work on every distribution, making it my favourite choice

Everything specified earlier is for apps, that use dynamic linking to libs, which is default way for building an app. For static built app, you won't need it, because your executable already have all statically linked libraries in it(QT docs)

Upvotes: 1

Related Questions