How to deploy C++ project with all dependencies? - c++

I am working on a C++ project that requires third-party libraries (boost, poco, etc). I use cmake/make to install the package to an install location and deploy it to the production machine. However, when pushing the app to another machine, the shared libraries are not present on the target machine causing ld errors. Is there a standard way to detect dependencies (i.e. shared libs) and deploy them to the install location along the application?

You can try Linux Deploy Qt.I use it for deploying my Qt application written in C++. Apart from Qt, it also puts other non-Qt dependencies(libraries) into a single directory. just run it with the executable as the argument.

Related

Debugging a Qt app by Qt Creator with a Docker development environment

Background
I was using a laptop with openSUSE Leap 15.1 to develop a Qt app. I upgraded to openSUSE Tumbleweed. Now I realize that library versions which my app is dependent upon are not available for Tumbleweed. Now I have these options:
Reinstall openSUSE Leap 15.1 (or maybe 15.2?)
Set up a development environment with some Docker images
Set up a development environment with a virtual machine
Unavailable dependencies: grab their binary packages directly and install them manually on openSUSE Tumbleweed
...?
Question
About 2nd option i.e. Docker.
It's known how to use Docker to deploy the app. You set up the development container with all the dependencies and run some deployment scripts with it.
However, I don't know:
Is it possible to set up Docker containers in a way that Qt Creator debugger can be used for development? If I use Docker, would I be able to step through the code with Qt Creator debugger?
Is this scenario possible:
Pull an openSUSE Leap 15.1 Docker image
Set up a bindmount volume that links the /usr/lib64/ directory from inside the container to the ~/leaplib directory on the host machine. It means ~/leaplib:/usr/lib64/
Do the same for development headers i.e. ~/leapinclude:/usr/include/
Bindmount procedure is explained here
Install all the Qt project dependencies on the openSUSE Leap 15.1 container
Therefore, all dependency libraries and header files would be installed inside the container bindmount volumes
Inside Qt Creator project on the host machine, add ~/leaplib to library path
Inside Qt Creator project on the host machine, add ~/leapinclude to include path
The Qt project source code repository is of course on the host machine
Use Qt Creator to open project repository source code
You should be able to develop and debug the code with Qt Creator debugger, right?
The above plan is not tested yet. Not sure if it would work. Any idea? Am I missing something?
Another scenario:
Make use of docker-compose and Dockerfile suggested by #DavidMaze
Create a docker-compose.yml file defining custom bindmount volumes to be able to share data between container and the host
Create a Dockerfile starting with FROM opensuse/leap:15.1
Install all the dependency packages inside Dockerfile with zypper --root /usr/local/
Needed container data would be inside /usr/local/lib64/, /usr/local/lib/ and /usr/local/include/
Share needed container data with the host by copying data to custom bindmount volumes defined inside docker-compose.yml file
Add bindmount volumes to Qt Creator library path and include path
Use Qt Creator to debug the source code in the host machine
Is something missed?

AWS Lambda - NodeJS based function that requires Linux dependency packages

Trying to create a function which is based on NodeJS that runs a C++ compiled code. The C++ code required me to install certain Linux packages using 'yum' in order to run.
The NodeJS and the C++ parts work great when running on Docker, because in the DockerFile I can install all the needed Linux dependencies that the C++ code requires using 'yum' command before the app execution.
When running under a Lambda I do not know how to tell the running container to install these Linux packages in order the C++ to run and be loaded successfully by the NodeJS.
I am trying to create a NodeJS Runtime based function with all my code and add a Custom Runtime layer before the function loads that can install all the dependencies to the OS (Not NodeJS dependencies - Linux OS dependencies).
I tried creating a custom runtime function but didn't understand how to connect everything and how it should (if possible) connect to the function itself even after configuring the layer version to the function.
Does anyone know how such a thing can be achieved?

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

pion-network library installation

I have downloaded and installed the pion network library.
I am trying to build the sample web services (HelloService etc). However, I cannot find instructions on how to build the examples.
I am developing on windows7
Check This for build instructions on Windows.
You might also want to see here the compatibility of your windows.

vs 2008 deployment project not working

I have a C++ console application that I want to deploy using a vs2008 setup project. When I create the setup project and add the output from my console app, the setup project detects that it needs MSVCP90.dll and MSVCR90.dll. When I build the project, those two dlls are included in the .msi file as expected.
When I download and launch the installer, everything goes as expected and the console app and the dlls are unpacked into the proper directory on the local machine.
When I try and run the app, I get the following error:
Error 1721. There is a problem with
this Windows Installer package. A
program required for this install to
complete could not be run. Contact
your support personnel or package
vendor.
I've tried compiling the app with /MT and /MD neither one works.
When I run a dependency walker against the app, it reports that it needs MSVCP90.dll and MSVCR90.dll as expected.
Finally, if I set the installer to require the Visual C++ runtime libraries, it downloads them and everything works fine.
Obviously, I would like to avoid downloading the CRT libraries.
Thanks for any help,
Jon
Check out this example on how to add the appropriate merge modules and deploy them to your target machine along with your setup.