Overview
This part will guide you through the steps to create a working cross compile platform for the Beaglebone. I will try to keep it generic enough that you could use any toolchain and target distro, but this is my target:
- BeagleBone Black Rev A6
- Saucy Ubuntu 13.10 with Kernel 3.8.13-bone32 (12/13/2013) installed to eMMC
- CircuitCo LCD7 Rev A3
See Part 2 for configuring and building Qt.
Downloads
Download these files while you read the instructions below...- Virtual Box 4.3.6: Windows Host, Others
- Ubuntu x64 12.04 LTS: Direct Link, Others
- Linaro Toochain GCC 4.8 (04/17/2013): Direct Link, Others
- Qt 5.2.0 Source: Direct Link, Others
- TI Graphics SDK (for OpenGL ES2.0 support): to be covered later
Setup Generic Virtual Machine
Follow these instructions to create and setup a vanilla Ubuntu VM. If you already have a VM or are going to use your host Ubuntu install, proceed to the "Install Compiler Prerequisites" section.
- Install Virtual Box
- Create a new Virtual Machine
- Enter a name, such as "Ubuntu Qt Builder"
- Change Type to "Linux", if it hasn't automatically done so.
- Change Version to "Ubuntu (64 bit)"
- Specify memory size, at least 1.5 Gb for better compiling performance.
- Create a new virtual hard drive (ignore size recommendation for now)
- Select VDI
- Select Dynamically allocated
- Set size to at least 40 Gb (it's dynamic, so why limit yourself)
- Once the virtual machine is created, change the advanced settings
- Click the Settings button and then select "System" from the list on the left
- Click the "Processor" tab and change the Processors to something greater than 1
- Select "Display" from the list on the left
- Max out the video memory
- Select "Storage" from the list on the left
- Click on the empty CD drive under the Storage Tree
- Under the attributes section, click the CD symbol and select "Choose a Virtual CD/DVD disk file"
- Point it to your Ubuntu ISO.
- Adjust other virtual machine settings as desired.
- Start the virtual machine and perform the Ubuntu Install
- After the install completes, reboot the virtual machine. Don't forget to hit enter to "eject" the boot CD when it prompts.
- Let it install the 200+ updates
- After another reboot, install Guest Additions by clicking on the Devices menu of the running VM, and then selecting "Install Guest Additions..." (You may have to do this again after Ubuntu installs future updates)
Install Compiler Prerequisites
Since we are running a 64 bit host OS, we need to install the 32 bit libraries to run some of the build tools. We also need the Linaro headers. Follow these instructions to install both of these required packages
- Open a new Terminal or xterm window
- Type the following to install the Linaro headers and 32 bit compatibility libraries
> sudo apt-get install ia32-libs
Extract Qt Source
Perform this step to expand the source tarball into your home directory. It will reside under the tarball directory of "qt-everywhere-opensource-src-5.2.0". This can be done in a new terminal window, while the prerequisites are being installed.> cd
> tar -zxf qt-everywhere-opensource-src-5.2.0.tar.gz
Now we create a couple of folders for our shadow builds. This helps keep the main source folder clean of configuration files and binaries.
> mkdir qt-5.2-host
> mkdir qt-5.2-target
Extract Linaro Toolchain
I chose to use the Linaro toolchain because it came highly recommended and the Ubuntu cross compile chain does not include a g++ binary, which will be required to compile Qt.Issue these commands to extract the Linaro toolchain, change the directory name, and move it to a global location:
> tar -Jxf gcc-linaro-arm-linux-gnueabihf-4.8-2013.04-20130417_li nux.tar.xz
> mv gcc-linaro-arm-linux-gnueabihf-4.8-2013.04-20130417_linux \
linaro
> sudo mv linaro /usr/local
Conclusion
You should now have a working Ubuntu virtual machine that is:- Up-to-date
- Has necessary host utilities installed
- Contains a folder, in the home directory, with the Qt source
- Has the Linaro toolchain installed under /usr/local/linaro
Continue on to Part 2 for the configuration and building of Qt.
Have you managed to get it working using SGX? For me Qt is a bit useless without QtQuick2. I also compiled it on my machine seems like fb works fine (but qtquick needs openGL)
ReplyDeleteI haven't been working on this.....too many other things. But I hope to get to it soon. It looks like it is getting closer:
Deletehttps://groups.google.com/forum/#!topic/beagleboard/qQTC7C8g0I8
Hi,
ReplyDeleteIm using "qt-everywhere-opensource-src-4.8.6", cross compiler "angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3".
I cross compiled Qt source successfully.
Even the Qt libraries are transferred into Beaglebone black.
But when I execute my binary in the board it showing an error stating "bash: ./Test:No such files or directory"
I tried to set the library path. Still it is not executing.
Can i know the reason for this?
Thank you.
At first, try write a console applications with Qt Creator.
Delete1 - Only empty main() , without any Qt classes.
2 - With using basic classes, like QString.
Also, command ldd -v exetubable_file shows required libraries.
When I type "sudo apt-get install ia32-libs" I get the following: "Package ia32-libs is not available, but is referred to by another package.
ReplyDeleteThis may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
Any idea what the issue is?
Sorry for the delayed response, but I did not see this error until I switched to Ubuntu 14.04 LTS today.
DeleteI ran ldd on /usr/local/linaro/bin/arm-linux-gnueabihf-cpp and found that libstdc++.so.6 was missing. I installed it by running:
sudo apt-get install libstdc++6:i386
I haven't tried to compile yet, but Qt Creator seemed happy with the Compiler link.
See http://askubuntu.com/questions/107230/what-happened-to-the-ia32-libs-package for insight.
You will also need libncurses5:i386 for gdb....
DeleteHi Louis
ReplyDeleteThank you for your detailed guide.
I'm very new to all of this.
I have to run an Angstrom distribution on the BBB since I'm using a Waveshare LCD Cape. With another distribution, the touchscreen is not working at all. So i tried to do your guide with this distribution installed on my BBB.
At the end, when I want to run any test file, I get this error:
-sh: ./xyz: No such file or directory
Could you please help me?
Hello Unknown :)
ReplyDeleteYou can try running 'ldd xyz' to see if the program is a valid executable for the platform you are running on. If not, you may have compiled for the wrong target or the cross compile did not work.
Thanks for your fast reply!
DeleteThe angstrom distribution doesn't know the ldd command. If I do ldd on the Ubuntu host it says that it's not an executable, of course because I compiled it for ARM, right?
I try to use Ubuntu also for the BBB now. Is there an easy way to export the properties of the LCD Cape, etc from Angstrom and import them on a Ubuntu distribution?
No problem!
DeleteYes, you are correct about the binary being an ARM executable. One more thing to try on Angstrom is to ensure that the Qt libraries are installed in the exact same path that you passed to the configuration script. LDD makes this much easier, otherwise you are just shooting in the dark. Most likely you are missing an OS dependency somewhere.
If you want to switch to embedded Ubuntu, you should be able to find the appropriate LCD cape driver file (device tree overlay) in the Angstrom filesystem. It probably won't work directly on Ubuntu because the kernels have to be very close, if not exactly the same. In this case you would have to find the source *.dts file and compile it for your embedded Ubuntu kernel.
I realized that you can install the ldd command for Angstrom. The error stays the same when I check the file with ldd:
Delete..No such file or directory..
What do you mean by "Qt libraries are installed in the exact path.."? Do I have to install Qt on the BBB? Isn't it just enough if I copy the binaries from the Qt build on the host to the BBB?
I also cant find any .dts files on the Angstrom distribution. And even when I look at the slots of the cape manager (bone_capemgr), there is no "special" slot loaded. Its just two default ones.