Problems when adding serialport module in Qt project
-
@aha_1980 Thanks. In Qt Creator I set Qt 5.7.1 in the "Qt Version" for the selected kit for my project. Now I can add the serialport module in my .pro file and build the app, but when I try to run it on my target device, the application does not start and the following error appears:
error while loading shared libraries: libQt5SerialPort.so.5: cannot open shared object file: No such file or directory
Is it related to the serialport module that is not cross compiled or have I to install some dependencies on the target device itself?
Thank you!@douglas said in Problems when adding serialport module in Qt project:
Is it related to the serialport module that is not cross compiled or have I to install some dependencies on the target device itself?
You're already on the right track. You need to cross-compile QtSerialPort for your embedded device, and then you need to deploy (copy over) these libraries to the device, because your final app is also running there.
-
@douglas said in Problems when adding serialport module in Qt project:
Is it related to the serialport module that is not cross compiled or have I to install some dependencies on the target device itself?
You're already on the right track. You need to cross-compile QtSerialPort for your embedded device, and then you need to deploy (copy over) these libraries to the device, because your final app is also running there.
wrote on 18 Jun 2018, 09:35 last edited by@aha_1980 Ok,thanks! I just did the following on my host PC:
$ git clone git://code.qt.io/qt/qtserialport.git $ mkdir qtserialport-build $ cd qtserialport-build $ qmake ../qtserialport/qtserialport.pro
but the last command (qmake) gives the following:
Project MESSAGE: Cannot build current QtSerialPort sources with Qt version 4.8.7. Project ERROR: Use at least Qt 5.0.0 or try to download QtSerialPort for Qt4.
It is clear that I need to use a newer qmake, perhaps the default one is an older version. How can I run that command with a qmake version 5? Where should it be located? Or how can I "change the default one"?
Thanks for your patience. -
@douglas said in Problems when adding serialport module in Qt project:
Is it related to the serialport module that is not cross compiled or have I to install some dependencies on the target device itself?
You're already on the right track. You need to cross-compile QtSerialPort for your embedded device, and then you need to deploy (copy over) these libraries to the device, because your final app is also running there.
wrote on 18 Jun 2018, 09:52 last edited by@aha_1980 Done, I found the qmake for version 5 and run the qmake command.
Now, when I run themake make install
this error appears:
fatal error: qdeadlinetimer.h: File o directory non esistente compilation terminated.
Which can be the solution?
-
@aha_1980 Done, I found the qmake for version 5 and run the qmake command.
Now, when I run themake make install
this error appears:
fatal error: qdeadlinetimer.h: File o directory non esistente compilation terminated.
Which can be the solution?
@douglas you are tryin to compile a new QSerialPort against an older Qt.
Add a
git checkout -b v5.7.1
directly after thegit clone command
and rebuild. -
@douglas you are tryin to compile a new QSerialPort against an older Qt.
Add a
git checkout -b v5.7.1
directly after thegit clone command
and rebuild. -
@aha_1980 I add "git checkout -b v5.7.1" , but the qdeadlinetimer.h error shown above still remains during the make procedure. Any hints?
@douglas Did you try to delete the build folder, create new one and to start from there?
-
@jsulm Yes, I did. I always obtain the
fatal error: qdeadlinetimer.h: File o directory non esistente compilation terminated.
@douglas please send the output of
git status
-
Sul branch v5.7.1 Untracked files: (use "git add <file>..." to include in what will be committed) ./ nothing added to commit but untracked files present (use "git add" to track)
Am I missing something?
@douglas Looks good so far.
But let's move slowly. I re-read you post from 5 hours ago:
@aha_1980 Thanks. In Qt Creator I set Qt 5.7.1 in the "Qt Version" for the selected kit for my project. Now I can add the serialport module in my .pro file and build the app
If you can build the app, then you already have the serialport module!
but when I try to run it on my target device, the application does not start and the following error appears:
But you don't have the libraries on your target device.
-
@douglas Looks good so far.
But let's move slowly. I re-read you post from 5 hours ago:
@aha_1980 Thanks. In Qt Creator I set Qt 5.7.1 in the "Qt Version" for the selected kit for my project. Now I can add the serialport module in my .pro file and build the app
If you can build the app, then you already have the serialport module!
but when I try to run it on my target device, the application does not start and the following error appears:
But you don't have the libraries on your target device.
-
@aha_1980 Thanks, I understand. In order to obtain those libraries on my target device is something that I should copy from my host PC onto the device itself or I should install directly on the device side in any way?
@douglas In the most easy and hacky way, just copy the needed *.so files to the other Qt *.so files on your device.
Depending on your cross toolchain, there may be a more clean way (like building a new image), but that - as said - depends on you toolchain.
-
@aha_1980 Thanks, I understand. In order to obtain those libraries on my target device is something that I should copy from my host PC onto the device itself or I should install directly on the device side in any way?
wrote on 18 Jun 2018, 14:34 last edited by -
wrote on 18 Jun 2018, 14:47 last edited by
@Pablo-J.-Rogina , @aha_1980 thank you. I expected to find the libQt5SerialPort.so.5 (the missing library) inside the qtserialport folder generated after the steps:
$ git clone git://code.qt.io/qt/qtserialport.git $ mkdir qtserialport-build $ cd qtserialport-build $ qmake ../qtserialport/qtserialport.pro
but I couldn't find it. I searched into my host PC for that file, I found few results, but they are located into the Qt installation folder, they are not cross-compiled for my needs, I think.
When exactly that library should be created, or where it should be located?
Thanks! -
@Pablo-J.-Rogina , @aha_1980 thank you. I expected to find the libQt5SerialPort.so.5 (the missing library) inside the qtserialport folder generated after the steps:
$ git clone git://code.qt.io/qt/qtserialport.git $ mkdir qtserialport-build $ cd qtserialport-build $ qmake ../qtserialport/qtserialport.pro
but I couldn't find it. I searched into my host PC for that file, I found few results, but they are located into the Qt installation folder, they are not cross-compiled for my needs, I think.
When exactly that library should be created, or where it should be located?
Thanks!@douglas Are you sure you're cross compiling your app?
If so just doldd YOUR_APP_EXE
it will show you which libs it is linked against, you then will know where the serial port lib is.
-
@douglas Are you sure you're cross compiling your app?
If so just doldd YOUR_APP_EXE
it will show you which libs it is linked against, you then will know where the serial port lib is.
-
wrote on 19 Jun 2018, 13:50 last edited by
Solved. The missing libQt5SerialPort.so.5 error on the target device was because that library effectively was not present. On the host side I added that library in the package list of the image and rebuild the image itself.
51/58