Deploying to Remote Linux
You can specify settings for deploying applications to generic remote Linux devices in the project configuration file and in the Projects mode, in Run Settings.
The files to be installed are listed in the Deployment step, the Files to deploy field. The Source File Path field displays the location of the file on the development PC. The Target Directory field displays the directory where the file is installed on the device. Text in red color indicates that the information is missing.
If the build system did not automatically detect the source and target directories, select Override deployment data from build system, and then select Add to enter them manually. To remove the selected paths from Files to deploy, select Remove.
Adding Missing Files
The process to add files to deploy depends on the build system you use. For more information, see Specifying Project Contents.
CMake Builds
When using CMake as the build system, use the install command in the CMakeLists.txt file to add the missing files.
For example, add the following lines to the CMakeLists.txt file to install the binary of your project to the /opt
directory on the remote device:
set(INSTALL_DESTDIR "/opt") install(TARGETS <target> RUNTIME DESTINATION "${INSTALL_DESTDIR}" BUNDLE DESTINATION "${INSTALL_DESTDIR}" LIBRARY DESTINATION "${INSTALL_DESTDIR}" )
qmake Builds
When using qmake, edit the INSTALLS variable in the project .pro
file.
When you run the application, Qt Creator copies the necessary files to the device and starts the application on it.
For example, add the following lines to the .pro
file to copy the binary of your project to the /opt
directory on the remote device:
target.path = /opt INSTALLS += target
To deploy additional files, add them to further targets that you also add to INSTALLS
.
Deploy Steps
When you run the application on the device, Qt Creator first uploads the necessary files to it, as specified by the deploy steps.
Uploading Files
By default, Qt Creator copies the application files to the device by using the SSH file transfer protocol (SFTP), as specified by the Upload files via SFTP step.
Note: If the SFTP upload fails, make sure that the remote device has SFTP enabled in its SSH daemon. Some versions of Dropbear that come without SFTP support will crash when an SFTP upload is being attempted. This is not a bug in Qt Creator.
If you have a lot of data to copy, select Details in the Upload Files via SFTP step, and then select the Incremental deployment check box. Qt Creator takes note of the deployment time and only copies files that have changed since the last deployment. However, when you make major changes on the device, such as removing files from the device manually or flashing a new disk image, or when you use another device with the same IP address, deselect the check box once, to have Qt Creator deploy all files again.
Creating a Tarball
To only create a tarball and not copy the files to the device, select Add Deploy Step > Create tarball. Then remove all other deploy steps.
The Deploy tarball via SFTP upload step specifies that Qt Creator uploads the tarball to the device and extracts it.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.