PDA

View Full Version : [Qt-4.7.0-arm] Segfault on hello->show()



LeFlou
28th September 2010, 14:36
Hello,

Im trying to build an (almost) complete version of Qt 4.7.0 for arm.
I want to: play videos/sounds (phonon), ssl support (openssl) and webkit on my card.
I installed scratchbox in order to get a working cross-compiler (arm-none-linux-gnueabi).
I tried and succeed to compile/run an hello world (without Qt stuff) with this cross-compiler.

This is myconfig.sh to compile Qt-4.7.0 for arm.


scratchboxUser='leflou'

./configure -v -embedded arm -xplatform qws/linux-arm-gnueabi-g++ \
-opensource -little-endian \
-prefix /usr/local/Trolltech/Qt-4.7.0-arm \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/include \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/include/glib-2.0 \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/include/libxml2 \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/include/gstreamer-0.10 \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/include/gstreamer-0.10/gst \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/include/gstreamer-0.10/gst/interfaces \
-I /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/ssl/include \
-L /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/lib \
-L /scratchbox/users/$scratchboxUser/targets/Arm/usr/local/ssl/lib \
-rpath -lssl -lcrypto -lz -lxml2 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lgthread-2.0 -lgstreamer-0.10 \
-nomake demos -nomake example -make tools \
-multimedia -audio-backend -phonon -phonon-backend -glib \
-no-mmx -no-3dnow -no-sse -no-sse2 \
-no-largefile -no-gtkstyle -no-qt3support -no-cups -no-nis


Each library has been downloaded/configured/maked in scratchbox (glib, gstreamer, gst-plugins, openssl, xml2).

When I compile this code:


#include <QDebug>
#include <QPushButton>
#include <QApplication>

int main(int argc, char** argv)
{
qDebug() << "Before everything...";
QApplication* app = new QApplication(argc, argv);
qDebug() << "QApplication created";
QPushButton* hello = new QPushButton("Hello World !");
qDebug() << "QPushButton created";

QObject::connect(hello, SIGNAL(clicked()), app, SLOT(quit()));
qDebug() << "QObject connected !";

hello->move(50, 50);
qDebug() << "QPushButton move";

hello->resize(300, 100);
qDebug() << "QPushButton resize";

hello->show();
qDebug() << "QPushButton shows up !";

qDebug() << "Before app exec";
const int ret = app->exec();
qDebug() << "After app exec";
delete hello;
delete app;
return ret;
}


$ ./QtHelloWorld -qws
Segmentation fault occurs on line 22...

I checked ldd, it seems correct...


root@cm-debian:~# ldd QtHelloWorld
libQtGui.so.4 => /usr/local/Trolltech/Qt-4.7.0-arm/lib/libQtGui.so.4 (0x40001000)
libQtNetwork.so.4 => /usr/local/Trolltech/Qt-4.7.0-arm/lib/libQtNetwork.so.4 (0x40a78000)
libQtCore.so.4 => /usr/local/Trolltech/Qt-4.7.0-arm/lib/libQtCore.so.4 (0x40b97000)
libssl.so.1.0.0 => /usr/local/ssl/lib/libssl.so.1.0.0 (0x40ea4000)
libcrypto.so.1.0.0 => /usr/local/ssl/lib/libcrypto.so.1.0.0 (0x40ef6000)
libz.so.1 => /usr/local/lib/libz.so.1 (0x41091000)
libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x410b6000)
libgmodule-2.0.so.0 => /usr/local/Trolltech/Qt-4.7.0-arm/lib/libgmodule-2.0.so.0 (0x411e8000)
libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x411f3000)
libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x41239000)
libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0 (0x41330000)
libgstreamer-0.10.so.0 => /usr/local/lib/libgstreamer-0.10.so.0 (0x4133d000)
libpthread.so.0 => /lib/libpthread.so.0 (0x41414000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x41434000)
libm.so.6 => /lib/libm.so.6 (0x41518000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x415c0000)
libc.so.6 => /lib/libc.so.6 (0x415d4000)
libdl.so.2 => /lib/libdl.so.2 (0x41704000)
librt.so.1 => /lib/librt.so.1 (0x4170f000)
/lib/ld-linux.so.3 (0x2a000000)


I dont have any clue on my issue, this is really embarassing.

Edit:
- main.cpp compiles & runs without any issue on x86.
- I tried another example "standarddialogs":
crosscompiled successful, running failed.

Regards,

LeFlou
29th September 2010, 16:10
Hello,

70 views and no answers ? :(
Im currently trying to compile Qt-4.7.0 with phonon + phonon-backend inside scratchbox.

cloaked_and_coastin
4th October 2010, 21:18
I'm not sure if NOT setting this variable would cause a seg fault, but did you set the QWS_DISPLAY variable before trying to run your program?

If not (and you haven't already figured the issue out) you may want to try this:

$ export QWS_DISPLAY="LinuxFb:/dev/fb4"
$ ./QtHelloWorld -qws

Hope this helps.

LeFlou
5th October 2010, 11:48
Hello,

It still occurs a segmentation fault... I used the configuration for 4.6.3 and all programs are working.
But there is an important bunch of features in 4.7.0 and I need it.
By the way, it was not fb4 but fb0 on my board, I dont know if that's a relevant fact.

Thanks anyway for the answer :)

cloaked_and_coastin
5th October 2010, 22:21
Hey LeFlou,

"I installed scratchbox in order to get a working cross-compiler (arm-none-linux-gnueabi)."

I'm not familiar with scratchbox, but I was wondering, what is the version of your cross compiler?

http://doc.trolltech.com/4.6/requirements-embedded-linux.html

http://doc.trolltech.com/4.7/requirements-embedded-linux.html

LeFlou
6th October 2010, 16:08
Hello,



[sbox-Arm: ~] > g++ --version
sbox-arm-none-linux-gnueabi-g++ (Sourcery G++ Lite 2009q3-67) 4.4.1


I think this version is enough recent.
The weird part is that everything works with Qt-4.6.3 and segfault occurs on Qt-4.7.0 :s
QtMobility from QtDevNetwork seems pretty attractive but requires 4.7.0.

Regards,

LeFlou
2nd November 2010, 08:44
Hello,

For those who are interested in the solution, there you go:

Add -no-freetype in your configuration and everything works for arm with Qt4.7.0 :)

Regards,