Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Serialport: Error while loading shared libraries: libQtSerialPort.so.1:
I want to install 'serialport' library on QT 4.8.4 (GCC 4.6.1, 32 bit). I'm cross-compiling the applications on laptop for deployment on Beaglebone Black.
I followed the steps mentioned here:
@Recommended steps to build the QtSerialPort library for Qt4/Qt5 from QtCreator:
download and unpack the QtSerialPort sources run QtCreator and open the “qtserialport.pro” project file get to “Projects->(Your Kit)->Build->Build Steps” add a new make “Build Step” and write to the “Make arguments” the install target from the menus, select “Rebuild Project qtserialport”@
Since I had admin privilege issues, I ran the steps by logging into Linux as root and it got 'rebuilt' successfully. I thought it got installed properly.
I created a new project 'QSerial2' and added
CONFIG += serialport and the install target in the .pro file:
@QT += core gui
CONFIG += serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QSerial2
target.files = QSerial2
target.path = /home/root
INSTALLS += target
TEMPLATE = app
SOURCES += main.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui@
Then I opened main.cpp and pasted the same simple example code given here: https://qt-project.org/wiki/QtSerialPort#d065aef6724572158f14e550906f5913
But it gives the error
"/home/root/QSerial2: error while loading shared libraries: libQtSerialPort.so.1: cannot open shared object file: No such file or directory
Remote application finished with exit code 127."@
kuzulis last edited by
Are you sure that library is installed? Check all *.so, *.prf and header files in your Qt place.
Is libQtSerialPort stored somewhere unusual ?
I searched for libQtSerialPort.so in Linux directories and found the following in /opt/qt/lib:
I wish to point out that I couldn't find any files named libQtSerialPortInfo.
I set the path /opt/qt/lib permanently by running the following in terminal
Then opened QTCreator, created a new project and did the same things as given in first post. In addition, in Projects > Build & Run > Build > Build Environment > Path, I added /opt/qt/lib. So now it looks @/opt/qt/bin:/usr/local/angstrom/arm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/qt/lib @
I copy pasted the same code mentioned in first post and the error is the same.
Am I doing something wrong?
kuzulis last edited by
bq. Am I doing something wrong?
- You should build the QtSerialPort from user account
- You should just do: "sudo make install" from shadow directory to install of QtSerialPort
- You should to check for all *.so, *.prf, *.h files in your system
- You should not setup the env.
Please, just re-read WIKI again and try to do search solution in this forum (because this question arise again and again, and I was tired to response again and again to same questions).
PS: I don't understand, what is unclear in WIKI?
Wouldn't you be mixing your x86 Qt with your cross-compiled Qt by any chances ?
Hi kuzulis and SGaist,
Thank you for the reply.
I ran the steps again, this time by installing 'git' and ran
@git clone git://gitorious.org/qt/qtserialport.git@
Repeated the steps mentioned in the first post of this thread and the error went away.
This is the output I see on QT console:
@Name : "ttyGS0"
Description : ""
User requested stop. Shutting down...
sh: line 1: 378 Terminated DISPLAY=:0.0 /home/root/QTSerial5
Remote application finished with exit code 143.@
I shutdown Beaglebone Black (BBB) and ran the project and as expected, QT said: @Connecting to device...
SSH connection failed: Timeout waiting for reply from server.@
- Have I installed serialport properly?
- It showed serialport number as 'ttyGS0'. But on BBB, port names are ttyO0, ttyO1, ttyO2 etc. ttyO0 is enabed by default and I manually enabled ttyO4 and ran the QT code, but QT mentions only ttyGS0. Why is it so?
For your information, this is what I see in Projects > Run > Files to deploy field:
@/root/build-qtserialport-BBB-Debug/QTSerial5/QTSerial5 - /home/root
[quote author="SGaist" date="1405543230"]Wouldn't you be mixing your x86 Qt with your cross-compiled Qt by any chances ?[/quote]
I think so. But as a newbie to these things, I can't say anything with confidence. Please guide me.
The name of the serial port can change between two devices, two computers etc.
How does your target Qt installation look like ?
Sorry for the late reply.
On host laptop I did the "following":http://www.cloud-rocket.com/2013/07/building-qt-for-beaglebone/:
- Installed Angstrom cross-compile toolchain (i686)
- Installed qt-everywhere-opensource-src-4.8.5.tar.gz
- Configured, built and installed 'QT Embedded'
On target Beaglebone Black (running Angstrom Linux):
- Installed QT SDK by copying '/opt/qt/lib' on host to '/opt/qt/'
Then installed QT Creator 2.8.0 (x86)on host, configured QT version, kit etc and developed & deployed the remote application.
After doing all this, the touchscreen on the target board was not working. So I installed 'qt4-embedded' on target and now it works. Please tell if you need more information.
manolia last edited by
[quote author="Ramon" date="1407179520"]Please let me know if you can get the serial port (UART) working.
After installation I ran the sample code given on QTSerialPort wiki, but it detected only the USB port. Any idea why the serialport (ttyO0) doesn't get detected? http://qt-project.org/forums/viewthread/44916/#185469
Yeah. I work with rfid reader through usb, but i can only see COM ports. Maybe CreateFile for a com port, read from ttyO0 and write on the new file? if QSerialPort is essential. If not you can stick to reading from the UART file.
I might be wrong. I just started to use C++ and Qt.