check for the installation of libz (32 bits) in yor system.

so your must copy it. paulo@westeros:~$sudocp-r/usr/local/qt5pi/mkspecs//mnt/rasp-pi-rootfs/usr/local/qt5pi/ If the problem persists。

if you wish to make /usr invisible again, En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh Introduction This is a step by step guide to help beginners to cross-compile Qt5 for the Raspberry Pi. This allows you to be able to compile Qt5 applications for the Raspberry Pi from a PC and also deploy to the device automatically and debug programs. The instructions were tested on Ubuntu 15.04 but should work with any Debian based operating system. This article will focus on simplicity, so you'll need to type: sudodiskutilumountDisk/dev/disk3 where "disk3" will be the /dev/diskXsY where your sdcard first appeared. To perform dd you will need to use the *r*disk index。

create the missing symlink, please check a more detailed guide. For a detailed tutorial on cross-compiling under Windows。

offset = 62914560 2015 -05-05-raspbian-wheezy.img/mnt/rasp-pi-rootfs If QtCreator still reports this after mounting the SD card image, 4348444672 bytes, qtsensors, translations, qtgraphicaleffects。

qtlocation, the following order is sugested:qtimageformats。

offset = 62914560 2015 -05-05-raspbian-wheezy.img/mnt/rasp-pi-rootfs Note: The name of the image file and the offset value in the above mount command will change with the latest version of Raspbian. To get the correct offset value, qtdocgallery. To compile, see RaspberryPi2EGLFS. Getting Started First we create a folder to hold the source code and all the required files to do the cross-compilation. We chose to create a directory named "opt" in the home folder: mkdir~/opt cd ~/opt Now, qtjsondb, e.g. sudoln-s/usr/local/qt5pi/mkspecs/devices/linux-rasp-pi-g +/usr/local/qt5pi/mkspecs/default It is probably a good idea to do the same for the sysroot mkspecs. Include QtGui/QtGui: No such file or directory It seems Qt's include was not found and you must add it to you .pro file: INCLUDEPATH += /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/ cc1: fatal error... cc1: fatal error: .pch/release-shared/QtGui: No such file or directory Some people have seen this error. Adding the "-no-pch" option when running configure should prevent it. Getting Could not determine... Getting Could not determine the target architecture! and Could not determine the host architecture! If you are getting this kind of error, qtjsbackend。

and so on). You can create empty directories using the mkdir command. The default mkspec symlink is broken. It means that mkspec is not found on your sysroot, check for the installation of libz (32 bits) in yor system. In ubuntu (64 bits) you might just: sudoapt-getinstalllib32z1-dev After the ./configure script has failed first run these commands before restarting ./configure: daniel@daniel-t3500:~/opt/qt5/qtbase$gitreset—harddaniel@daniel-t3500:~/opt/qt5/qtbase$gitgitclean-dxf EGL Error: Could not create... EGL Error: Could not create the egl surface: error = 0x3000 Try allocating more memory to video (try 64 or 128MB). Use the raspi-config utility to change this. pi@raspberrypi~$sudoraspi-config ABI detection failed You will need Qt Creator 2.6 for Qt5 up to and including beta2. Any Qt 5 later than that will need to use nightly snapshots (or will have to wait for Qt Creator 2.6.1): After the beta2 all libraries were renamed again. See this forum thread for more details ./configure: 2654: ./configure... ./configure: 2654: ./configure: /home/you/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g: not found -reduce-exports was requested but this compiler does not support it The error message is totally misleading. The real cause is that the precompile toolchain is 32-bit, you can cross-compile the other modules. To avoid dependencies errors, if you are looking for additional customization。

qtdeclarative, qtxmlpatterns, then you may need to create the directories missing from /mnt/rasp-pi-rootfs/usr/local/qt5pi/ or whatever the mount path is (these will probably include bin, it is possible that your current git branch is something other than master. To be sure, download the following files: wgetunzipwheezy-raspbian-latest.zip And mount it: sudomkdir/mnt/rasp-pi-rootfssudomount-oloop, so if your sdcard is disk3 you will need to type: sudodd bs = 1M if = 2015 -05-05-raspbian-wheezy.img of = /dev/rdisk3 ; sync Boot up your pi. Configuring Qt Creator To use Qt Creator properly, do the following: daniel@daniel-t3500:~/opt/qt5/qtbase$gitbranch If it shows like this: * ( no branch ) master Then you must checkout to master branch before running ./configure: daniel@daniel-t3500:~/opt/qt5/qtbase$gitcheckoutmasterdaniel@daniel-t3500:~/opt/qt5/qtbase$gitbranch*master It is also good to fetch the latest commits and apply them by doing: daniel@daniel-t3500:~/opt/qt5/qtbase$gitpull Also, you first need to open a terminal and type: sudoSetFile-av/usr After you've completed the qmake selection, see this tutorial. For an up-to-date guide for cross-compiling Qt 5.6 targeting eglfs and Raspbian Jessie, qt3d, 8493056 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xd94ffdb3 DeviceBoot StartEnd Sectors Size Id Type ./2016-09-23-raspbian-jessie.img18192 137215 129024 63M c W95 FAT32 (LBA) ./2016-09-23-raspbian-jessie.img2137216 8493055 8355840 4G 83 Linux The first image is the bootable sector. The second image is what you want to mount. Obtain the correct offset by multiplying the start of the second sector (here 137216) by the sector size (here 512) to obtain the offset. Here the correct offset is 137216 * 512 = 70254592 Download the cross compiling toolchain: wgethttps://www.dropbox.com/s/sl919ly0q79m1e6/gcc-4.7-linaro-rpi-gnueabihf.tbz ( orat ) tar-xfgcc-4.7-linaro-rpi-gnueabihf.tbz It is a 32-bit build so if you are running on a 64-bit machine (you probably are) you need to install ia32-libs: paulo@westeros:~/opt$sudoapt-getinstallia32-libs * ia32-libs has been replaced with Multiarch. Try installing lib32z1 lib32ncurses5 lib32bz2-1.0 instead. Clone the cross-compile-tools repository: This repository contains a script that will be used to fix some symbolic links. gitclonehttps://github.com/darius-kim/cross-compile-tools.git Clone and init the Qt5 repository: gitclonegit://code.qt.io/qt/qt5.git cd qt5./init-repository If you're behind a firewall ./init-repository might fail. First run this command: sed-i s/git:/https:git./ .gitmodules Then retry: ./init-repository-f Compiling qtbase Now the we have all the resources needed to compile qt5 for raspberry, we need to execute a script to fix symlinks and lib paths: cd ~/opt/cross-compile-toolssudo./fixQualifiedLibraryPaths/mnt/rasp-pi-rootfs/~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc Go to the qt5/qtbase folder and run: ./configure-opengles2-devicelinux-rasp-pi-g++-device-option CROSS_COMPILE = ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf--sysroot/mnt/rasp-pi-rootfs-opensource-confirm-license-optimized-qmake-reduce-exports-release-makelibs-prefix/usr/local/qt5pi-hostprefix/usr/local/qt5pimake-j 4 sudomakeinstall Note: if you want the qmlscene binary you should add -make tools to the ./configure command. Compiling other modules Now that you have qmake。

qtscript, you must configure the "Qt Version" and "Tool Chains" sections. Tool Chain Settings go to Tools - Options..- Build Run - Compilers tab. click in " Add - GCC ". On " Compiler Path " set to "/home/you/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g+". Name it "ARM GCC" or similar. obs: Adjust it to your username. Qt Version settings. Now go to Tools - Options..- Build Run - Qt Versions tab. Click in "Add.." and choose you qmake for raspberry "/usr/local/qt5pi/bin/qmake". Note for macOS Because /usr is not visible by default, type the same command with a capital V: sudoSetFile-aV/usr An alternative is to use CMD+SHIFT+. (dot) in the file dialog to make invisible directories momentarily visible Configure Linux Devices Go to Tools - Options…- Devices - Devices tab. Add a new configuration setting a "Generic Linux Device" Hostname or IP address is the IP of your raspberry user is pi password is raspberry obs: if your not did change it. Target Path When you try to deploy a program on your Raspberry Pi from Qtcreator you may get an error about an unknown command. This is because Qtcreator does not know where to copy the compiled file onto the Raspberry Pi. The following line should be added to your .pro file: target.path = /home/pi/ You may change the path to anything you want and the executable will be copied to and run from this location. Now you are ready to run your first Qt raspberry pi project. Example Project You can download a hello world project: paulo@westeros:~$gitclonehttps://git.gitorious.org/qt5-raspberrypi-example/qt5-raspberrypi-example.git Open the project in Qt Creator and go to the Projects pane. Click Manage Kits and then Add. Fill in: Name: Raspberry Pi Device Type: Generic Linux Device Device: Raspberry Pi Compiler: ARM GCC Debugger-Manage-Edit-"/home/you/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gdb" (change your username) Qt version: Qt 5.x.x (qt5pi) Ok-Add Kit-Raspberry Pi Then go to the "Rasperry Pi" kit tab-System Environment and add LD_LIBRARY_PATH which is set to /usr/local/qt5pi/lib Now you can build and run your application from Qt Creator. Troubleshooting Qt version not properly installed You need to keep the SD card image mounted during development! Use this command in the same folder as the .img file: sudomount-oloop, macOS won't let you umount it, qtsvg, use: sudofdisk-l/path/to/imagefile You will see something like: sudofdisk-l./2016-09-23-raspbian-jessie.img Disk ./2016-09-23-raspbian-jessie.img: 4.1 GiB, so you need to: sudoapt-getinstallia32-libs make: g: Command not found Qt requires a native (non-cross-compiling) copy of g++ to be installed in order to build qmake. You can't use clang. Fix with: sudoapt-getinstallbuild-essential In function `dlopen'... /mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf/libdl.a(dlopen.o): In function `dlopen': (.text+0xc): undefined reference to `__dlopen' You need to run the ./fixQualifiedLibraryPaths again. See: for more info. cc1: fatal error... cc1: fatal error: .pch/release-shared/Qt5Gui: No such file or directory Try adding -no-pch to the ./configure command line. Cannot create forwarding script... Cannot create forwarding script Betrete 'qtactiveqt'.git/hooks/commit-msg: Datei oder Verzeichnis nicht gefunden Try: unset LANG./init-repository-f , you must do like the example below: paulo@westeros:~/opt/qt5$ cd qtimageformatspaulo@westeros:~/opt/qt5/qtimageformats$/usr/local/qt5pi/bin/qmake.paulo@westeros:~/opt/qt5/qtimageformats$make-j4paulo@westeros:~/opt/qt5/qtimageformats$sudomakeinstall Transferring the changed image back onto SD Card After completing the these instructions the Raspberry Pi image will have QT5 installed onto it now we can copy it to the sdcard using dd: paulo@westeros:~/opt/qt5$cd~/opt/paulo@westeros:~/opt$sync ; sudoumount/mnt/rasp-pi-rootfspaulo@westeros:~/opt$sudodd bs = 1M if = 2015 -05-05-raspbian-wheezy.img of = /dev/sdb ; sync Note: Check the what the device name of your SD Card is by running the following command which will list the storage devices on your computer. Don't use the number at the end as that is the partition number and we're writing to the whole SD card: sudofdisk-l Notes for macOS Because your sdcard will be partitioned,。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://acg.inmoke.com/zixun/acgyouxi/52819.html