Build a shared library that uses OpenSSL installed on respective Linux machine - c++

Is it possible to build a shared library or Linux application that uses OpenSSL installed on respective Linux machines?
For example, when we compile and link, we use "-lssl -lcrypto" similar to this is there any option or solution to use the OpenSSL library installed on the machine on which the application will be running. We can't use "dlopen".
So my application should be built in such a way that when installed on CentOS 7 it should use the default OpenSSL 1.0.2 of CentOS 7 and when installed on Ubuntu 20.04 it should use OpenSSL 1.1.1
How can I achieve it, please?

You have five options in my view.
Static link OpenSSL
Deploy your application with Anaconda packages
Deploy your application with Docker container
Build separate packages for each OS
Force your users to install OpenSSL from source

Related

Qt missing OpenSSL 3.x support on Ubuntu 22.04

I tried to build my application which uses QNetworkManager to communicate to a server. I did not have any problems on older Linux versions but with the newest Ubuntu 22.04 the network reply fails and QtCreator shows this output:
Incompatible version of OpenSSL (built with OpenSSL 1.x, runtime version is >= 3.x)
The backend "cert-only" does not support QSslKey
Active TLS backend does not support key creation
The backend "cert-only" does not support QSslKey
Active TLS backend does not support key creation
The backend "cert-only" does not support QSslKey
Active TLS backend does not support key creation
The backend "cert-only" does not support QSslKey
Active TLS backend does not support key creation
The backend "cert-only" does not support QSslKey
Active TLS backend does not support key creation
The backend "cert-only" does not support QSslKey
Active TLS backend does not support key creation
The backend "cert-only" does not support QSslSocket
The backend named "cert-only" does not support TLS
QSslSocket::connectToHostEncrypted: TLS initialization failed
QSslSocket::connectToHostEncrypted: TLS initialization failed
When I build my application on older Ubuntu (20.04) and deploy it as AppImage, and then run it on Ubuntu 22.04, the network communication fails too with the same error.
How can this be solved? I need to be able to create AppImage on older Ubuntu and then run it "everywhere"...
UPDATE: I managed to build and deploy deploy AppImage of my application on Ubuntu 20.04 with correct OpenSSL library and now it runs also on Ubuntu 22.04. The trick is to manually copy libssl.so.1.1 to the AppImage lib folder before calling linuxdeployqt on it.
But I still have not found how to build and run my application with QtCreator on Ubuntu 22.04. Fortunately this is not of high importance to me because I build it for deployment on Ubuntu 20.04.
I was able to solve this issue on Ubuntu 22.04 and Qt 6.3.0 following this workaround:
https://linuxpip.org/install-openssl-linux/
You have to build OpenSSL 1.1 from source code and tell the system to use the newly installed OpenSSL.
Other answers work, but rather than manually installing or copying file around, I would suggest to use a .deb.
libssl1.1 package can be downloaded from https://packages.ubuntu.com/focal-updates/libssl1.1
Then you can simply install it with sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb.
In this way, it will appear in your installed package list and you will be able to cleanly remove it when you do not need it anymore.

supervisor-win How to use for windows server

I downloaded it using pip install supervisor-win, but I didn't know how to configure my Django project file.ini and give Supervisor to manage it. I know how to operate on Linux, not how to write configuration files and use them on Windows.
this is supervisor-win https://pypi.org/project/supervisor-win/

KDE Frameworks deployment on Windows

I am going to deploy a Qt Application on github and I want to link with some KF5 modules
I call the cmake command
find_package(KF5Crash)
and on linux the things are quite simple the user can
apt-get install libkf5crash-dev
I can mention on documentation the instruction on how to install kcrash or other kf5 modules, the problem is on windows, how can I instruct the windows developers/contributors to install any of the kf5 module?
KDE developers use the Craft utility to deploy source and binaries of KF5 (and many other dependencies) to Windows.
See https://community.kde.org/Craft

Deploying a C++ application developed on Mac OS in a Ubuntu environment

I have developed a small web server based on Crow, link.
I'm pretty new to developing in C++ so all advices are greatly appreciated.
I'm developing the application on my Mac and intend to deploy it to a Ubuntu server.
I use Make to build the application so that I can run it on the Mac. The application is depending on two libraries, pqxx and png++. None of those are installed on the server.
I'd like to know how to run this application on the Ubuntu server. Mainly I guess the issue is, can I make a specific build on the Mac that is targeted for running on the Ubuntu server? Or do I have to build the application on the server?
Easiest way is to install Ubuntu on a VM on your Mac and deploy there your application.
Less easy solution: move source files on server, deploy the application, delete the sources from server.
Theoretically, both system are linux, so as long as you are using standard c++ libraries the code should run anyway.
In any case, the dependencies on Linux and Mac for Crown are different, so (most probabily) you have to install some libraries on your server.

Custom build environment/target libraries

I want to build an application that will be compatible with, say, Debian Lenny (libc, postgres, oracle and other libs) on a different Debian/Ubuntu release.
Is this possible? If so, where can I read how to do it?
You can use the open build service for this. Create the Debian package description files for it (you can add also rpm spec files), select the target distributions and you will get it built on each platform and also get a specific download repository for each platform. Your package will be rebuilt automatically when needed as well. You can install your own instance of the service if you need to host proprietary code.
If you want a multiplatform binary, you may want to build it against a LSB chroot:
http://ftp.linux-foundation.org/pub/lsb/impl
And bundle any library that is not part of it. The LSB has tools to then check your app for compliance. Their website is down right now, but it should be here: http://ldn.linuxfoundation.org/lsb/check-your-app