Qt 5 cross compiled application not working on Raspberry Pi
-
I used the ./bakeqtpi.bash script to install toolchain for Raspberry Pi by reading this page http://qt-project.org/wiki/RaspberryPi_Beginners_guide
I also configured the Qt Creator as mentioned in the page, added new kit and was able to successfully to cross compile.
Then using these steps :
@sync; sudo umount /mnt/rasp-pi-rootfs
sudo dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/sdb; sync@I prepared the SD card and also copied my application binary in /home/pi/ folder in SD card.
Then I inserted the SD card in Rasp Pi and booted it after connecting to HDMI monitor.
The linux started successfully also 1st time config screen also came. I expanded the root fs and rebooted.
Then on the console I ran:
@cd /home/pi/
./App1
This plugin does not support setParent
This plugin does not support setParent
This plugin does not support setParent
This plugin does not support setParent@I also tried :
@./App1 -qws
This plugin does not support setParent
This plugin does not support setParent
This plugin does not support setParent
This plugin does not support setParent@But the same result.
My application is a simple app which has a textbox and button.
-
[quote author="postmako" date="1375185276"]Could you post your source code for your simple project?[/quote]
Here it is :
widget.ui
@<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Widget</string>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>140</x>
<y>70</y>
<width>113</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>160</x>
<y>120</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
@widget.h
@#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
namespace Ui {
class Widget;
}class Widget : public QWidget
{
Q_OBJECTpublic:
explicit Widget(QWidget *parent = 0);
~Widget();private:
Ui::Widget *ui;
};#endif // WIDGET_H
@widget.cpp
@#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
}Widget::~Widget()
{
delete ui;
}
@main.cpp :
@#include "widget.h"
#include <QApplication>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();return a.exec();
}
@ -
I compiled your code on my Raspberry Pi and had to make a few changes in the widget.ui file and I included the .pro file I used with qmake. Those files are as follows and the source files are the same as yours. I also used this link ("http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi":http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi) to build qmake on the pi. I ran the sample app, and it wasn't pretty, but it worked in both the console and in x-windows. Let me know if any of these help you.
widget.ui
@<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="title">
<string>Widget</string>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>140</x>
<y>70</y>
<width>113</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>160</x>
<y>120</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="title">
<string>PushButton</string>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11" //>
<resources //>
<connections //>
</ui>@simple_widget.pro
@QT += widgetsFORMS = widget.ui
HEADERS = widget.h
SOURCES = main.cpp
widget.cppunix:!mac:!vxworks:!integrity:LIBS += -lm
install
target.path = ./simple_widget
INSTALLS += target@