Qt cross-compilation for Raspberry pi error: (gdbserver: not found)
-
I am using the QT Creator for my laptop (Linux LMDE 3 Cindy OS) And for Raspberry Cross-compiling.
I have installed the QT based of [this instruction][2] and by this setting:
mkdir ~/raspi cd ~/raspi git clone https://github.com/raspberrypi/tools mkdir sysroot sysroot/usr sysroot/opt rsync -avz pi@raspberrypi_ip:/lib sysroot rsync -avz pi@raspberrypi_ip:/usr/include sysroot/usr rsync -avz pi@raspberrypi_ip:/usr/lib sysroot/usr rsync -avz pi@raspberrypi_ip:/opt/vc sysroot/opt wget http://download.qt.io/official_releases/qt/5.12/5.12.3/single/ qt-everywhere-src-5.12.3.tar.xz tar xvf qt-everywhere-src-5.12.3.tar.xz cd qt-everywhere-src-5.12.3
./configure -release -opengl es2 -device linux-rasp-pi-g++
-device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
-sysroot ~/raspi/sysroot -opensource -confirm-license -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbmmake make install
but when i go to my QT Creator and i have built a sample Qt Widget Application.
Mydesktop2.pro
file is this kind:#------------------------------------------------- # # Project created by QtCreator 2019-06-09T18:56:52 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = new_sd TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /home/pi/Desktop/$${TARGET}/bin #else: unix:!android: target.path = /home/so/Desktop/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
SO when i want to use my **Raspberry Pi ** and want to debug it , i get this Error:
11:56:57: Checking available ports... 11:56:58: Found 101 free ports. 11:56:58: Starting gdbserver --multi :10000... 11:56:58: Debugging starts bash: line 0: exec: gdbserver: not found 11:56:58: Application finished with exit code 127. 11:56:58: Debugging has finished
And when i run the project via cross compilation into raspberry zero i get this error:
12:09:22: Starting /home/pi/Desktop/new_sd/bin/new_sd ... QXcbConnection: Could not connect to display 12:09:23: Remote process crashed.
so the qt setting is shown blown:
[![ qt setting][1]][1]
So what can i do to solve this problem?Thanks.
[1]: https://i.stack.imgur.com/yQWP4.jpg
[2]: https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/ -
@SoheilSabz said in Qt cross-compilation for Raspberry pi error: (gdbserver: not found):
QXcbConnection: Could not connect to display
Do you have X11 server running on your RaspberryPi?
-
QXcbConnection: Could not connect to display
in addition to jsulm question of having X11 running in the RPi device, if you connected via ssh did you enabled X Forwarding for the session? i.e. ssh -X user@RPI.device
Regarding this issue bash: line 0: exec: gdbserver: not found
it looks like the path for GDB could not be the right one from the image you posted. Check this guide for instance, about the Qt Creator setup section -> Debuggers -
@jsulm base of this link:
https://stackoverflow.com/questions/637005/how-to-check-if-x-server-is-running
I get this output:
pi@raspberrypi:~ $ ps -e PID TTY TIME CMD 1 ? 00:00:04 systemd 2 ? 00:00:00 kthreadd 3 ? 00:00:00 kworker/0:0-cgr 6 ? 00:00:00 mm_percpu_wq 7 ? 00:00:01 ksoftirqd/0 8 ? 00:00:00 kdevtmpfs 9 ? 00:00:00 netns 11 ? 00:00:00 khungtaskd 12 ? 00:00:00 oom_reaper 13 ? 00:00:00 writeback 14 ? 00:00:00 kcompactd0 15 ? 00:00:00 crypto 16 ? 00:00:00 kblockd 17 ? 00:00:00 watchdogd 18 ? 00:00:00 rpciod 19 ? 00:00:00 kworker/u3:0 20 ? 00:00:00 xprtiod 21 ? 00:00:00 kworker/u2:1-ev 23 ? 00:00:00 kswapd0 24 ? 00:00:00 nfsiod 35 ? 00:00:00 kthrotld 36 ? 00:00:00 iscsi_eh 37 ? 00:00:00 DWC Notificatio 38 ? 00:00:00 vchiq-slot/0 39 ? 00:00:00 vchiq-recy/0 40 ? 00:00:00 vchiq-sync/0 41 ? 00:00:00 vchiq-keep/0 42 ? 00:00:00 SMIO 44 ? 00:00:00 mmc_complete 45 ? 00:00:00 kworker/0:1H-mm 47 ? 00:00:00 jbd2/mmcblk0p2- 48 ? 00:00:00 ext4-rsv-conver 49 ? 00:00:00 ipv6_addrconf 71 ? 00:00:01 systemd-journal 94 ? 00:00:00 systemd-udevd 116 ? 00:00:00 kworker/u2:2-ev 140 ? 00:00:00 SMIO 141 ? 00:00:00 spi0 150 ? 00:00:00 mmal-vchiq 152 ? 00:00:00 mmal-vchiq 153 ? 00:00:00 mmal-vchiq 195 ? 00:00:02 systemd-timesyn 222 ? 00:00:00 thd 225 ? 00:00:00 rsyslogd 226 ? 00:00:00 dbus-daemon 245 ? 00:00:00 wpa_supplicant 251 ? 00:00:00 cron 262 ? 00:00:01 avahi-daemon 267 ? 00:00:00 systemd-logind 278 ? 00:00:00 rngd 279 ? 00:00:00 avahi-daemon 360 ? 00:00:00 irq/160-ads7846 380 ? 00:00:00 sshd 383 tty1 00:00:00 agetty 384 ? 00:00:00 agetty 522 ? 00:00:00 systemd 525 ? 00:00:00 (sd-pam) 553 ? 00:00:00 sshd 563 ? 00:00:00 sshd 1715 ? 00:00:00 sshd 1725 ? 00:00:00 sshd 1728 pts/0 00:00:00 bash 1755 ? 00:00:00 kworker/0:0H 1764 ? 00:00:00 sshd 1774 ? 00:00:00 sshd 2079 ? 00:00:00 kworker/0:1-eve 2744 ? 00:00:00 kworker/0:2-eve 2745 ? 00:00:00 sshd 2755 ? 00:00:00 sshd 2758 pts/1 00:00:00 bash 2776 ? 00:00:00 kworker/0:2H 2779 pts/1 00:00:00 ps pi@raspberrypi:~ $ netstat -lp|grep -i x (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active UNIX domain sockets (only servers) unix 2 [ ACC ] STREAM LISTENING 6657 - /run/systemd/journal/stdout unix 2 [ ACC ] STREAM LISTENING 13895 522/systemd /run/user/1000/systemd/private unix 2 [ ACC ] STREAM LISTENING 13900 522/systemd /run/user/1000/gnupg/S.gpg-agent.extra unix 2 [ ACC ] STREAM LISTENING 13903 522/systemd /run/user/1000/gnupg/S.gpg-agent unix 2 [ ACC ] STREAM LISTENING 13905 522/systemd /run/user/1000/gnupg/S.gpg-agent.ssh unix 2 [ ACC ] STREAM LISTENING 13907 522/systemd /run/user/1000/gnupg/S.gpg-agent.browser unix 2 [ ACC ] STREAM LISTENING 6503 - /run/systemd/private unix 2 [ ACC ] SEQPACKET LISTENING 6519 - /run/udev/control unix 2 [ ACC ] STREAM LISTENING 9088 - /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 9091 - /run/thd.socket unix 2 [ ACC ] STREAM LISTENING 9093 - /var/run/avahi-daemon/socket unix 2 [ ACC ] STREAM LISTENING 6605 - /run/systemd/fsck.progress pi@raspberrypi:~ $ nmap localhost|grep -i x -bash: nmap: command not found
SO No X11 server running on my RaspberryPi, Why
x 11
is important now? -
Hi,
Because if you are using the XCB plugin, it's mandatory.
-
Since you are using the xcb backend of Qt, then yes, a X11 server like Xorg is mandatory.