在树莓派上安装了官方的raspbian系统。为了在能在上面开发程序,在系统上安装了qt4 。参考链接http://qt-project.org/wiki/apt-get_Qt4_on_the_Raspberry_Pi

apt-get

Firstly I got the development tools needed by Qt Creator in the hope it would be less heavy for the Pi to download separately.

sudo apt-get install qt4-dev-tools

Then I went for Qt Creator

sudo apt-get install Qtcreator

I also installed

sudo apt-get install gcc

sudo apt-get install xterm

sudo apt-get install git-core

sudo apt-get install subversion

this gives as a result Qt Creator 2.5 with Qt 4.8.1 32 bit

Problem : no toolchain.

We can only compile for remote embedded devices and this is not the case here, because we are on the Pi and not remotely accessing it.

I added a gcc toolchain

Options > build & run > tab tool chain > button add

Choose GCC

Then set compiler path : /usr/bin/arm-linux-gnueabihf-gcc-4.6

Debugger : /usr/bin/gdb

Mkspec : default

Qt Creator seems to detect that we are going to deploy on a remote target.

To fix this :

Go to menu help > about plugins

Uncheck device support > remote linux

Restart Qt Creator

Go to tools > options TAB > build & run > Qt versions > add “/usr/bin/qmake-qt4”

It will then show up as a desktop project in the project wizard instead of embedded.

下载的raspbian系统比较新,里头已经内置了GCC,跟着网站的步骤走,很容易就能完成QT4的安装。注意sudo apt-get install Qtcreator中Qtcreator首字母要小写,要不然树莓派的服务器会找不到安装程序提示错误。

以前在做linux QT开发中 喜欢直接在window上用UE进行编辑,然后ftp到虚拟机中。同样可以用这种方式对树莓派进行qt的开发。在我下的raspbian中没有安装ftp。

第一步 通过云安装,sudo apt-get install vsftpd。

第二步 对ftp进行配置,sudo vim /etc/vsftpd.conf。anonymous_enable=NO,local_enable=YES,write_enable=YES,local_umask=022。

第三步 重启ftp服务 sudo service vsftpd restart

这样就能在UE上编写qt程序了。不过程序在树莓派上直接编译还是比较慢的,建议还是使用交叉编译的方式。

PS:安装qt需要比较大的空间,建议使用4G以上的SD卡,并且在raspi-config中Expand Filesystem使系统使用整张SD卡的大小,要不然只会分配2G多供系统使用。

Logo

openvela 操作系统专为 AIoT 领域量身定制,以轻量化、标准兼容、安全性和高度可扩展性为核心特点。openvela 以其卓越的技术优势,已成为众多物联网设备和 AI 硬件的技术首选,涵盖了智能手表、运动手环、智能音箱、耳机、智能家居设备以及机器人等多个领域。

更多推荐