Talk:RaspberryPi2EGLFS: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Added the solution to the two problems)
(posted regarding a 'broken link' to a library.)
 
(26 intermediate revisions by 17 users not shown)
Line 1: Line 1:
'''I got this error in make step'''
== Asking Questions ==


Please post questions about building Qt for Raspberry Pi in the [https://forum.qt.io/ Qt forums].  This talk page can be used to talk about improving the article.


qeglfsbrcmintegration.cpp:35:22: fatal error: bcm_host.h: No such file or directory
== small fix to the relativelink fixing script ==


#include <bcm_host.h>
The script relinks also systemd files pointing to /dev/null. Although this does not break anything currently, here is a fix
Copy the following and paste to shell in the directory where the sysroot-relativelinks.py is


                     
patch <<'EOF'
compilation terminated.
*** sysroot-relativelinks.py~ Fri Apr 28 09:50:57 2017
--- sysroot-relativelinks.py Fri Apr 28 10:56:27 2017
***************
*** 18,23 ****
--- 18,25 ----
          return
      if link.startswith(topdir):
          return
+    if link.startswith("/dev/"):
+        return
      #print("Replacing %s with %s for %s" % (link, topdir+link, filep))
      print("Replacing %s with %s for %s" % (link, os.path.relpath(topdir+link, subdir), filep))
      os.unlink(filep)
EOF


make[6]: *** [.obj/qeglfsbrcmintegration.o] Error 1
== Ansible Roles/Playbooks Based on this Article ==


make[6]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm'
I used the instructions here to make Ansible playbooks that perform most of the same steps.  The playbooks can set up a Pi, set up a development computer, and then deploy Qt to the Pi.  Repo is https://bitbucket.org/johnwoltman/build_qt_for_pi_with_ansible


make[5]: *** [sub-eglfs_brcm-make_first] Error 2
== Minor improvement to step 8 ==


make[5]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms/eglfs/deviceintegration'
You can combine all 5 commands into one like this:


make[4]: *** [sub-deviceintegration-make_first-ordered] Error 2
rsync -avzR pi@raspberrypi.local:/lib :/usr/include :/usr/lib :/opt/vc sysroot


make[4]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms/eglfs'
Note that <tt>-R</tt> preserves the path names and that rsync creates the <tt>./sysroot</tt> directory for us.


make[3]: *** [sub-eglfs-make_first] Error 2
Hi
I have Ubuntu 16.04 x64 and Qt Creator 5.10.1 x64 witch version of qt base should I choose?
for compile on raspberry pi 3 with Raspbian stretch x32 OS?


make[3]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms'
== Recommended changes to Step #15 ==


make[2]: *** [sub-platforms-make_first] Error 2
Just including the line:


make[2]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins'
  ./qopenglwidget


make[1]: *** [sub-plugins-make_first] Error 2
So that way beginners (like me) know what to do to get it running.


make[1]: Leaving directory `/home/hamed/raspi/qtbase/src'
== Suggestion of changes to step 14 ==


make: *** [sub-src-make_first] Error 2
Make sure you're in "/home/pi" aka "~" when you run these commands:


hamed@hamed-PC ~/raspi/qtbase $
(This would have saved me an hour...)


== I edited this topic to add the solution to this error (fatal error: bcm_host.h: No such file or directory) ==
to solve this problem just add these lines


INCLUDEPATH  += $[QT_SYSROOT]/opt/vc/include
== Cross compilation on 64bit machines TIP ==


INCLUDEPATH  += $[QT_SYSROOT]/opt/vc/include/interface/vcos
Hi.
When You try to build QT on 64 bit PC without i386 libraries, use:
  ~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-


INCLUDEPATH  += $[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads


INCLUDEPATH  += $[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
== Recommended changes to Step #4 ==


to these two files:
Honestly, `sudo rpi-update` should only be used by Raspbian developers to the firmware or operating system itself; it pulls from the `next` branch which is usually unstable. At times, it will brick your Raspi.
"qtbase/mkspecs/devices/linux-rasp-pi-g++/qmake.conf"


and:
Please change this to read `sudo apt-get update && sudo apt-get -y upgrade`. This will upgrade the operating system and yes, the firmware as well. It will pull from the stable `master` branch as expected.


"qtbase/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf"
==  error: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8' ==


after save the files repeat these two steps "configure" and "make"
When try to build QT Creator app got an error:
raspi/sysroot/usr/lib/arm-linux-gnueabihf/libicui18n.so.57:-1: error: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'


the refrence is this [http://forum.qt.io/topic/62264/failed-to-cross-compile-qt-5-6-on-rpi-2-fatal-error-bcm_host-h-no-such-file-or-directory/3 thread]
after some exploration add following line to .pro file:
QMAKE_LFLAGS += -fuse-ld=gold


Now its ok.


== Add section about changed library names ==


See [https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/ this] (part 6). I cite:
"In new Raspbian stretch versions, EGL libraries have different names than those assumed in Qt configuration files, so edit the ./qtbase/mkspecs/devices/linux-rasp-pi*-g++/qmake.conf file and substitute all references to -lEGL and -LGLESv2 for -lbrcmEGL and -lbrcmGLESv2, respectively." (linux-rasp-pi*-g++ refers to the board you're using).


'''Different error in the make step'''
== Broken 'link' in Step 5 (part 2) ==
http://stackoverflow.com/questions/34685488/qt-5-6-cross-compile-for-raspberry-pi-with-eglfs
The qt4-x11 library has depreciated and is no longer available.
 
== QT Serial Port install in cross-compile environment ==
 
I am attempting to adapt the instructions linked here: [[Qt Serial Port]] to this cross-compile environment.  The Qt Serial Port page suggests that Qt Serial Port is included in Qt5, however I cannot seem to find it. Has it been removed? I am running QT 5.4.2. on my host system.
 
If I have to install Qt Serial Port, then I am not sure how to successfully install it in this cross-compile environment. Can anyone help with this? Thank you!
 
== This is the solution of Qserial port ==
You do not need to cross-compile the Qserial port because in fact the Qserial port library it's a libserial so, just download the source code of the libserial from [http://libserial.sourceforge.net/x19.html here] and build it on your Raspberry pi after that copy the system image of the pi from the SD card and replace system image on your host computer with the copy to perform the cross-compiling

Latest revision as of 03:06, 9 August 2020

Asking Questions

Please post questions about building Qt for Raspberry Pi in the Qt forums. This talk page can be used to talk about improving the article.

small fix to the relativelink fixing script

The script relinks also systemd files pointing to /dev/null. Although this does not break anything currently, here is a fix Copy the following and paste to shell in the directory where the sysroot-relativelinks.py is

patch <<'EOF'
*** sysroot-relativelinks.py~	Fri Apr 28 09:50:57 2017
--- sysroot-relativelinks.py	Fri Apr 28 10:56:27 2017
***************
*** 18,23 ****
--- 18,25 ----
          return
      if link.startswith(topdir):
          return
+     if link.startswith("/dev/"):
+         return
      #print("Replacing %s with %s for %s" % (link, topdir+link, filep))
      print("Replacing %s with %s for %s" % (link, os.path.relpath(topdir+link, subdir), filep))
      os.unlink(filep)
EOF

Ansible Roles/Playbooks Based on this Article

I used the instructions here to make Ansible playbooks that perform most of the same steps. The playbooks can set up a Pi, set up a development computer, and then deploy Qt to the Pi. Repo is https://bitbucket.org/johnwoltman/build_qt_for_pi_with_ansible

Minor improvement to step 8

You can combine all 5 commands into one like this:

rsync -avzR pi@raspberrypi.local:/lib :/usr/include :/usr/lib :/opt/vc sysroot

Note that -R preserves the path names and that rsync creates the ./sysroot directory for us.

Hi I have Ubuntu 16.04 x64 and Qt Creator 5.10.1 x64 witch version of qt base should I choose? for compile on raspberry pi 3 with Raspbian stretch x32 OS?

Recommended changes to Step #15

Just including the line:

  ./qopenglwidget

So that way beginners (like me) know what to do to get it running.

Suggestion of changes to step 14

Make sure you're in "/home/pi" aka "~" when you run these commands:

(This would have saved me an hour...)


Cross compilation on 64bit machines TIP

Hi. When You try to build QT on 64 bit PC without i386 libraries, use:

  ~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-


Recommended changes to Step #4

Honestly, `sudo rpi-update` should only be used by Raspbian developers to the firmware or operating system itself; it pulls from the `next` branch which is usually unstable. At times, it will brick your Raspi.

Please change this to read `sudo apt-get update && sudo apt-get -y upgrade`. This will upgrade the operating system and yes, the firmware as well. It will pull from the stable `master` branch as expected.

error: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'

When try to build QT Creator app got an error: raspi/sysroot/usr/lib/arm-linux-gnueabihf/libicui18n.so.57:-1: error: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'

after some exploration add following line to .pro file: QMAKE_LFLAGS += -fuse-ld=gold

Now its ok.

Add section about changed library names

See this (part 6). I cite: "In new Raspbian stretch versions, EGL libraries have different names than those assumed in Qt configuration files, so edit the ./qtbase/mkspecs/devices/linux-rasp-pi*-g++/qmake.conf file and substitute all references to -lEGL and -LGLESv2 for -lbrcmEGL and -lbrcmGLESv2, respectively." (linux-rasp-pi*-g++ refers to the board you're using).

Broken 'link' in Step 5 (part 2)

The qt4-x11 library has depreciated and is no longer available.