简体   繁体   中英

How to deploy a Qt app with all dll files in other linux platform?

I have created a web browser using Qt Creator in linux os. I have to run this browser on the other system which also has the linux os. And I dont want to install Qt Creator in the other system. I want my browser should run independently. Using build I created the browser but when I am running the .exe file it is showing .dll file not found. So, I want to know how to bind my app with libraries. Thanks.

To create a .deb package, you can adapt my method for your needs.

/!\\ You have to build your program with a kit compatible with qt5-default

Create a tree such as:

package_folder
|-DEBIAN
  |-control (a file)
  |-postinst (bash script)
|-opt
  |-your_binary (your app binary)
|-usr
  |-bin
  |-share
    |-application
      |-package_folder.desktop (to create a shortcut)

control file:

Package: regexp-testor
Version: 1.0
Section: devel
Priority: optional
Architecture: amd64
Depends: qt5-default
Maintainer: thibsc <mail@mail.com>
Homepage: https://github.com/thibsc
Description: RegExp testor
 RegExp testor is a regular expression testor like the rubular.com website.

postinst script:

#!/bin/bash
echo "Create a symbolic link towards the binary"
sudo ln -s /opt/regexp_testor/regexp_testor /usr/bin
echo "Enjoy ;)"

package_folder.desktop file:

[Desktop Entry]
Version=1.0
Type=Application
Name=RegExp testor
GenericName=RegExp testor
Comment=A regular expression testor like the rubular.com website
Exec=/opt/regexp_testor/regexp_testor
Terminal=false
MimeType=text/plain;
Icon=regexp_testor_icon
Categories=Development;
StartupNotify=true

Then place you at the level of your package_folder and run sudo dpkg-deb --build package_folder , you should have a .deb package ready to use.

Edit:
You can also use debpac to generate your packet.

What you are looking for is exactly what you title says, it's called "deploying" and Qt wiki can help you out .

The reason there is an issue in the first place is that as you are building an application on your system it dynamically links to Qt .so files that are on your system in a specific path, those are obviously missing on another computer and so the dynamic linker throws errors. One approach that does not use a tool for this would be to actually distribute the necessary .so files with the binary and provide the linker with a path to them, either by specifying it in the executable with RPATH or environment variables. The tool in the link I provided should do that for you creating a bundle with both the executable and libraries that the linker can combine when it needs to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM