树莓派上安装qt

嵌入式技术

1332人已加入

描述


在树莓派上安装了官方的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多供系统使用。



    打开APP阅读更多精彩内容
    声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
    • 相关推荐

    全部0条评论

    快来发表一下你的评论吧 !

    ×
    20
    完善资料,
    赚取积分