Segmentation Fault with QT 4.7

David D
Hi Every body,


Is anyone have tested the brand new QT 4.7 with mini2440. After
cross-compile from source, I faced segmentation fault ( OK with QT 4.6.3 )

Thanks,

David D.
Anybody have tried QT 4.7 ?


Sincerely

Michael S.
Hi!

Yes, I've got the same problem with Qt 4.7.0 on an Atmel AT91SAM945-EKES
Evalboard:
Whenever I start an example with the '-qws'-argument, the mousepointer is
drawn on the display, and then the app terminates with segfault.
It makes no difference whether I am using LinuxFb or VNC as QWS_DISPLAY.

Also tried building Qt 4.7 from Git-branch 4.7 today  --> same error. 

When I use Qt 4.6.3 built with the exact same toolchain (arm-linux-gcc
4.1.2) and configuration (excluding declarative-component of course)
everything works just fine.

I have no idea where the problem could be. Did you have any luck yet?

Regards

Jean-Pierre Poulin
I have *exactly* the same problem and have tried the same things, including
VNC.

Qt samples that don't require QtGUI seem to work fine (like
/threads/semaphores), but any sample requring QtGui segfaults.

I can cross-debug and place a breakpoint in main, but as soon as execution
enters QApplication(), it's segfault time!

I've spent 2 days on this with various toolchains, building various options
and even in debug mode.

I'll follow your recommendation and revert to 4.6.3.

  Jean-Pierre

Daniel
In my case, the reason of getting segmentation faults was a wrong ftp
transfer mode. Try "binary" instead of "ascii" in your ftp-programm, that
worked for me ;)

David D.
I do not think that it is due to transfert. It works for other QT realease
( 4.6.3 ).

Jean-Pierre Poulin
For Qt's benefits... (hopefully they read this)

More info on my build: Angstrom toolchain for Chumby, i.MX23 ARM9
processor, latest Qt 4.7

Problem is "Segmentation Fault" when entering QApplication() running sample
/widgets/calculator/calculator -qws

Configure & make statement below:

date && ./configure -xplatform qws/linux-arm-gnueabi-g++-MX23 -embedded arm
-prefix /usr/local/SIM/Qt -I /usr/local/SIM/include -L /usr/local/SIM/lib
-qt-gfx-vnc -qt-mouse-tslib -qt-zlib -no-qt3support -no-webkit
-no-javascript-jit -no-script -nomake demos -nomake examples -nomake docs
-opensource -release && make && make install && date

I rebuilt everything for 4.6.3 using the exact same config & setup and
finally I have a working system... so there really is something with Qt 4.7
running on ARM.

  JP

David D.
Are you using UcLib ou GLibC ?

chris
I have the same problem on my mini2440.

Now, 
if I configure with option -no-freetype, it works. (but limited fonts)

If I configure with option -system-freetype (using the latest freetype2
lib), it almost works, ie: no segfault. But if I ran the fontsampler
application, I can see the name of all fonts, but when I select a ttf, I
see only "rectangles" no character.
Anyone has clue why I don't the fonts correctly?

David D.
I confirm. No Using of freetype fixe the issue. Thanks !

Michael S.
Hey Chris!

Many thanks for the tip with the '-no-freetype'-option: it works for me
now!!
Finally, I can try out some QML-UIs on the target (which run surprisingly
smooth, btw).

Cheers

Henry
Thanks guys, have been pulling my hair out over this issue. 
Will revert back to 4.6

Nan Chen
Dude, from the Chinese page, it's stated that this latest cross compiler
which is of EABI standard, "could completely solve the Segmentation Fault
issue".  

http://arm9download.cncncn.com/mini2440/linux/arm-linux-gcc-4.4.3-201007...

Would you like to try?

Nan Chen
Unfortunately, My build with arm-linux-gcc-4.4.3 didn't work. (segmentation
fault). 

I am trying to build the qt4.7.0 provided by Friendly ARM for mini6410.

If this still doesn't work, I will try "-no-freetype"  :), thanks for the
tip.

Nan Chen
Hi Michael S, 

how did you manage to run qml? was there qmlviewer?  or you invoke qml
within C++?

Nan Chen
Successfully built / run QT 4.7 on mini2440 with qt4.7.0 provided by
FriendlyARM for mini6410

davef
Nan Chen,

Good work.  Now finish the job by writing up a HowTo, as I am sure you will
get many requests for how you managed to do it!

Which version of mini2440? Might stop someone like me trying to put it on a
64M machine.

Regards,
Dave

Sven Anderson
Same problem here. Is it fixed in 4.7.1?

Cheetah
same problem with me("-no-freetype" is OK)
and I cross-compile the freetype2 lib,then re-configured with the option
"-system-freetype" and re-compiled Qt-4.7,download to the board,
 test failed.remain the segment fault!!!

anybody tried the Qt-4.7.1??

Marcio Lima
Guys

I´m suffering during the whole week to put Qtopia 4.7 working. I´m stucked
on the compiling because somehow someof the files are compiled with the
i386 header although the rest of it compile with the ARM headers.
Can anybody help me ?

Cheetah
same problem with me("-no-freetype" is OK)
and I cross-compile the freetype2 lib,then re-configured with the option
"-system-freetype" and re-compiled Qt-4.7,download to the board,
 test failed.remain the segment fault!!!

anybody tried the Qt-4.7.1??

addition:
i tried these compilers: 4.4.3 ,4.4.1, 4.3.2

contact  to me with gtalk:   memccpy at gmail dot com

Marco
Cheetah, 
Have you switch off the GCC optimization ( -o2 --> -o0 ) in qmake.conf
configuration file ? If not, that is probably the issue your are facing

Marcio Lima
Guys

I get this compiling error. I don't know how the i386 header is being
included. the configure line is:

./configure -verbose -embedded arm -xplatform qws/linux-arm-g++ -prefix
/media/b1cc59e2-c2f4-4a5e-acee-fc4dada4edbe/opt/Boardcon/4.3.3
-qt-mouse-tslib -opensource -confirm-license  -nomake examples -nomake
demos  -little-endian  -no-webkit -no-cups -no-largefile -optimized-qmake
-no-openssl -nomake tools   -no-openssl -no-freetype


the qmake.conf file is:
#
# qmake configuration for building with arm-linux-g++
#

include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
QMAKE_CFLAGS_RELEASE     =   -O0 -pipe -msoft-float -mthumb-interwork
-mcpu=arm920t -march=armv4t
QMAKE_CXXFLAGS_RELEASE     = $$QMAKE_CFLAGS_RELEASE
# modifications to g++.conf
QMAKE_CC                =
/media/b1cc59e2-c2f4-4a5e-acee-fc4dada4edbe/opt/Boardcon/4.3.3/bin/arm-linux-gcc

QMAKE_CXX               =
/media/b1cc59e2-c2f4-4a5e-acee-fc4dada4edbe/opt/Boardcon/4.3.3/bin/arm-linux-g++




QMAKE_LINK              =
/media/b1cc59e2-c2f4-4a5e-acee-fc4dada4edbe/opt/Boardcon/4.3.3/bin/arm-linux-g++




QMAKE_LINK_SHLIB        =
/media/b1cc59e2-c2f4-4a5e-acee-fc4dada4edbe/opt/Boardcon/4.3.3/bin/arm-linux-g++






/media/b1cc59e2-c2f4-4a5e-acee-fc4dada4edbe/opt/Boardcon/4.3.3/bin/arm-linux-g++




-c -include .pch/release-shared-emb-arm/QtCore -pipe -fno-exceptions -O0
-pipe -msoft-float -mthumb-interwork -mcpu=arm920t -march=armv4t
-fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC
-DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE
-DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT
-DQT_MOC_COMPAT -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION
-DELF_INTERPRETER=\"/lib/ld-linux.so.2\" -DHB_EXPORT=Q_CORE_EXPORT
-DQT_NO_DEBUG -I../../mkspecs/qws/linux-arm-g++ -I. -I../../include
-I../../include/QtCore -I.rcc/release-shared-emb-arm -Iglobal
-I../3rdparty/zlib -I../3rdparty/harfbuzz/src -I../3rdparty/md5
-I../3rdparty/md4 -I.moc/release-shared-emb-arm -I../../include -o
.obj/release-shared-emb-arm/qvariantanimation.o
animation/qvariantanimation.cpp
In file included from animation/qvariantanimation.cpp:694:
../../include/QtCore/qatomic_i386.h: In member function 'bool
QBasicAtomicInt::testAndSetOrdered(int, int)':
../../include/QtCore/qatomic_i386.h:144: error: impossible constraint in
'asm'
{standard input}: Assembler messages:
{standard input}:359: Error: bad instruction `lock'
{standard input}:360: Error: bad instruction `incl [r2,#0]'
{standard input}:361: Error: bad instruction `setne [fp,#-5]'
{standard input}:400: Error: bad instruction `lock'
{standard input}:401: Error: bad instruction `decl [r2,#0]'
{standard input}:402: Error: bad instruction `setne [fp,#-5]'
make[1]: *** [.obj/release-shared-emb-arm/qvariantanimation.o] Error 1
make[1]: Leaving directory `/opt/qtsdk-2010.05/qt/src/corelib'
make: *** [sub-corelib-make_default-ordered] Error 2


Can anybody help me

Cheetah
Macro:
          thanks for your reply.
  I had tried the "-O1 and -O0",that doesnt help.
  the last 2 days, I tried cross-compile libfreetype and change the Qt
configure parameter as "-system-freetype",and result the same fault.

finally  I found the cause for this fault.
that is  font-related。。
here is  three way to avoid this:
a):
delete all ttf fonts in $QTDIR/lib/font (rm -f $QTDIR/lib/font/*.ttf)
or
b):
add a parameter “-fn somefont”to your excuteble program.
like this: $./your_program -qws -fn somfont

or
c):modify your source file.
add a line like this“app.setfont("somefont",15)” after your QApplication
object created.

in these 3 ways.just take one choice can avoid the fault.

the cause maybe in where Qt take the default fonts failed and fallback to a
ttf format font,that problem maybe happens。



when the above program runs Ok,but once you  the close the
program,a segfault still will happens 。

can't find out why 。。。。


i found this bug and add a comment on 
http://bugreports.qt.nokia.com/browse/QTBUG-13441

Cheetah
congratulations!!!!

I have fixed it over。。。

this problem's root cause is the about memory align.

modify this source file and recompile:
vim $QT_SRC_DIR/src/3rdparty/harfbuzz/src/harfbuzz-global.h

.....................
42 #if defined(__GNUC__) || defined(_MSC_VER)
43 #define HB_USE_PACKED_STRUCTS
44 #endif
..........................
just comment the 44th line.

#if defined(__GNUC__) || defined(_MSC_VER)
/*
#define HB_USE_PACKED_STRUCTS
*/
#endif


Never segfault while  the program starting up(only with -qws) or closing
down.
http://bugreports.qt.nokia.com/browse/QTBUG-13395

Marcio Lima
Cheetah 

Can you share your configuration files ?
I still get the erros I reported above
Thanks

Michael S.
Hi guys!

Just tried with Qt 4.7.1 - segfault also occurs here.
But when you, as Cheetah discovered, explicitly specify a font for your
application along the lines of

QFont appFont("Bitstream Vera Serif");
app.setFont(appFont);

it works like charm.

@Cheetah: Thanks for sharing this solution.

Michael S.
Nan Chen,
if you're still interested on how i got QML to run on my ARM-Board, here's
the code for my QML-Viewer: http://pastebin.com/ey3rhzJt

Cheetah
@Michael S.

 Happy to heard that you worked it out too.

 Let's keep in touch for further studies...
 
 I'm a Chinese guy.
 My Email:memccpy@gmail.com
 or QQ:147957232

Marcio
Guys
THese are the steps I took to solve the compilation problem. Thanks to Mr.
lars.thornqvist@pdahl.se.


make -no-iconv
sudo make install -no-iconv

Don't know what Im missing and if it's somethig important, but the
compilation went through ok.

Does anyone have any idea  why ?

Tom Banks
Trying to build Qtopia 4.7 for mini 2440.
Can anybody help me in this error ?

/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp
../3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp: In
function 'void* TrySbrk(size_t, size_t*, size_t)':
../3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp:127: error:
'sbrk' was not declared in this scope
make[1]: *** [obj/release/TCSystemAlloc.o] Error 1
make[1]: Leaving directory
`/opt/qt-everywhere-opensource-src-4.7.1/src/script'
make: *** [sub-script-make_default-ordered] Error 2

qmake.conf is:

#
# qmake configuration for building with arm-linux-g++
#

include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
#QMAKE_CFLAGS_RELEASE     = -O0 -mfloat-abi=softfp -mcpu=arm920t
-march=armv4t -Winvalid-pch
#QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
QMAKE_CXXFLAGS_RELEASE     = $$QMAKE_CFLAGS_RELEASE
# modifications to g++.conf
QMAKE_CC                = /opt/Boardcon/4.3.3/bin/arm-linux-gcc
QMAKE_CXX               = /opt/Boardcon/4.3.3/bin/arm-linux-g++
QMAKE_LINK              = /opt/Boardcon/4.3.3/bin/arm-linux-g++
QMAKE_LINK_SHLIB        = /opt/Boardcon/4.3.3/bin/arm-linux-g++

# modifications to linux.conf
QMAKE_AR                = /opt/Boardcon/4.3.3/bin/arm-linux-ar cqs
QMAKE_OBJCOPY           = /opt/Boardcon/4.3.3/arm-linux-objcopy
QMAKE_STRIP             = /opt/Boardcon/4.3.3/bin/arm-linux-strip
QMAKE_INCDIR  += /usr/local/tslib/include
QMAKE_LIBDIR  += /usr/local/tslib/lib

configure is :
./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix
=/usr/local/QT -qt-mouse-tslib -little-endian -no-webkit -no-qt3support
-no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -nomake
demo

lamp
Hi

Fix In QT 4.7.2

Compiling and use

Vladimir Malyk
buildrooted Qt 4.7.2 works fine

bao
Any body has problem with the segmentation fault when Qt application
exiting?

I tried Qt 4.6.3, Qt 4.7.1, Qt 4.7.2 and have the same result :(

I am using buildroot, so I think the problem came from uClib but don't know
how to fix it.

Any help, please.

smith
qt-sdk-linux-x86-opensource-2009.05.bin
where is available on yhe internet

davef
possibly in the archive at nokia.com

sushant
Hello,
I am install a qt qt-everywhere-opensource-src-4.6.3 in my system i am
create Hello application and it cross compile and inserted on board and run
hello -qws but error is missing lib of qt.How to cross compile the all qt-4
lib for mini2440 board...

davef
If I had a dollar for everything I posted this link!

http://mini2440vietnam.blogspot.co.nz/2011/04/upgrade-qt462-in-mini2440....

davef
everytime!