Saturday 6 February 2016

Qt Application in Beagle Bone Black using Fedora(host) and Angstrom(target)


So, you might be thinking how can we run a GUI application in an embedded platform. Well, most of the GUI applications were made by using Qt. In Qt we can add buttons, edit box, dialog boxes, .. etc. However, if you could learn the basics of qt , you can make application on your linux system. But this tutorial shows how to compile and make an application for Beagle Bone Black Board. I was totally a newbie about the necessary things required for cross compilation like: Linux, Qt and Cross compiler/Toolchain. With 0% knowledge about all the above important stuffs, I started my journey of cross compilation.

Basic Requirements:
Host System: Laptop, core i5, x86.
1. OS : Fedora 22.
2. Qt 5.5.1.
3. ToolChain: angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2.

Target System: Beagle Bone Black, AM335x 1GHz ARM® Cortex-A8
1. OS : Angstrom OS.
2. PC Connectivity cable

Steps :-



  1. Get the toolchain from here
  2. Install qt creator

    sudo dnf install qt-creator
  3. Download toolchain to your fedora and extract it into a folder, then follow this command

    sudo tar -C / -xjf angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2
  4. After installed Qt Creator please don't open, read the following words and then operate.


    Qt Creator cross compiler that is running process: when you click on the "run" button, Qt Creator automatically complete the following operations. First automatically using the qmake command and linux-gnueabi-oe-g++ compiler generated Makefile using the make command, and then automatically generate executable file, and then automatically put the executable file with the SFTP to the BBB, and then automatically run.
    This process uses some tools, thus the first step in using the Qt Creator to create a Qt project, is designated to use "toolbox" of Kit, because of the different platform for compile time, should use different qmake and different g++ settings, the settings together is called a Kit.


    In order to enable the Qt Creator to find the location of these tools, you must set the environment variable. The toolchain has written to set environment variables of the script, we only need to perform the following:
    ./usr/local/angstrom/arm/environment-setup



    If the executive can not add execute permissions
    chomd +x /usr/local/angstrom/arm/environment-setup


    Note, to set environment variables for the environment-setup file is the export. Don't forget to set the environment variable export is only valid for the current open shell. So we installed Qt Creator although can see an application icon, but we will not simply double-click the icon to open it, but should be in the implementation of the above set the environment variable terminal to find and open the qtcreator program. For the sake of convenience, I put environment-setup a copy of the document to the home directory, and then at the end of the QC program location file, the environment-setup file and add a line of (modified according to installation position for you):
    ./user/bin/qtcreator


    After the file is added to execute permissions
    chomd +x environment-setup


    After the implementation of the file./environment-setup can automatically configure the environment variables and open the Qt Creator.


    (if the environment variable not set, compile time error message will appear":-1: error: execvp: ../projectname/mainwindow.ui: Permission denied") unfortunately, I have got this error when i compiled for first time!!!
  5. If you did not understand above step (me too did not get what actually I have to do), To set up environment what I have done is,

    i went to the directory
    /usr/local/angstrom/arm/
    and opened file named
    environment-setup 

    copied the text in it and pasted into terminal!!!
    and pressed enter, now the environment has set up.
  6. Do not close the above opened  terminal, you just set up environment so if you close it , again you have to repeat step 5.

    In that opened terminal go to user/bin/ using cd command,
    then type ./qtcreator
  7. Now qt will be opened in your environment.
  8. Make a qt application using tutorial(search google, you will get sample projects) 
  9. Now you have to set up compiler inside qt application, for that I have followed below youtube video.

    Part 1:



    Part 2 :



  10. There is an error in this video, they have selected GCC compiler, but you have to select compiler Beaglebone-GCC

  11. That's it, You are done your application will be created in beagle bone. now run that application in beagle bone black board.
     
    Sometimes you might come up with an issue that when you run your application you cannot see your Application gui but it runs in background.
    for that you have to disable gdm 
    
    "systemctl disable gdm.service"
    
     
     then run your application, you might mess up with another error :- your mouse pointer disappears!!!!
    for that type 
    
    "export QWS_MOUSE_PROTO=linuxinput:/dev/input/event1"
    
     

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi, I have an issue I have followed the above steps but when I run the program i get This error:
    12:36:28: Starting: "/usr/bin/make"
    ../beagleboard/mainwindow.ui -o ui_mainwindow.h
    make: execvp: ../beagleboard/mainwindow.ui: Permission denied
    Makefile:184: recipe for target 'ui_mainwindow.h' failed
    make: *** [ui_mainwindow.h] Error 127
    12:36:28: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project beagleboard (kit: Beaglebone black)
    When executing step "Make"

    ReplyDelete
    Replies
    1. Hi Unknown ,
      I am really sorry for the late reply.

      i think this issue is because of permission.
      You can do force permission:
      "chmod 777 mainwindow.ui"

      Delete
  3. hello

    Do anyone have a copy of this tool chain angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2

    as the one I downloaded ends with tar: Error is not recoverable :exiting now

    ReplyDelete