Author Topic: Native -- C++ / Qt  (Read 7985 times)

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Native -- C++ / Qt
« on: March 28, 2005, 09:44:27 am »
Hi --

I have successfully used the SDK to compile programs on an x86 for the zaurus...
but I would like to compile programs natively on the zaurus.

Has anyone managed to do this with programs that use Qt?

ie: Is there anyone out there with a working native SDK?

Scott

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #1 on: March 28, 2005, 01:46:30 pm »
Hi Scott
I've been trying hard to native compile on a Z sl-5500 the last days. Finally, I managed to have ZGCC working. It compiles fine with a test "hello world" script. But trying to compile a quite more complex program, I get strange errors at "make" time like :
 undefined reference to '__ctype_b'
 undefined reference to '__ctype_tolower'
I am far from a C-guru. I found a trick to get ride of this error, but finally, my program doesn't run ok. What I have understood is that these errors happen because of missing or bad versions of the compiler libraries (libc ? other ?) (seems that zgcc compiler is version 2.95.2).
Before, I had tryed also the dev_img-1.5 tool but could not mount the cramfs. But now, with my zgcc experience, I am going to go back to it, see if I get better results than with zgcc.
good luck !

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #2 on: March 28, 2005, 02:59:30 pm »
I use the zgcc-3.3.2.img  from here:http://mirror1.pdaxrom.org/rc9.1/developer/

To compile qt you will need to install the qt-headers package.
This package is declared as dependent to the packages gcc binutils etc, so if you choose to use the image, I suggest that you install this package by hand with -force-depends (not to have a second gcc that fills your disk space, like me.....)

I tried to compile the HelloWorld from the tutorial.
you will need to export QMAKESPEC=/usr/lib/qt/mkspecs/default/
the qmake.conf is wrong, I attached a modified qmake.conf.

then qmake -projects; qmake; make -> works

* edit the problem I had was in fact that qmake doesn't  like project in a directory named "qt"
« Last Edit: April 05, 2005, 06:48:21 am by pgas »
SLC-860 cacko / senao wifi

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #3 on: April 05, 2005, 06:51:46 am »
Here:

http://zaurus.spy.org/feeds/cacko/pdaXrom/misc/pgas/gcc-qt/

You will find a squashfs image (cramfs may follow soon) containing the native sdk and a full qt install (with documentation assistant designer moc, ui etc...)

You will probably have to use a swap file if you start to compile c++ project with designer assistant and firefox open
« Last Edit: April 05, 2005, 06:52:26 am by pgas »
SLC-860 cacko / senao wifi

silvio

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • http://www.iaccarino.de/silvio
Native -- C++ / Qt
« Reply #4 on: April 05, 2005, 07:14:53 am »
Quote
I get strange errors at "make" time like :
 undefined reference to '__ctype_b'
 undefined reference to '__ctype_tolower'

If you run on this error, you should have a c-File with these lines in your project:
Code: [Select]
#ifndef QT_QWS_SL5XXX
#include

__const unsigned short int *__ctype_b;
__const __int32_t *__ctype_tolower;
__const __int32_t *__ctype_toupper;

void ctSetup()
{
    __ctype_b = *(__ctype_b_loc());
    __ctype_toupper = *(__ctype_toupper_loc());
    __ctype_tolower = *(__ctype_tolower_loc());
}
#endif
and this in your main():
Code: [Select]
#ifndef QT_QWS_SL5XXX
        extern "c" void ctSetup();
        ctSetup();
#endif

regards,
Silvio
« Last Edit: April 05, 2005, 07:17:32 am by silvio »
SL-C860, Cacko 1.22 lite and many toys.
My Zaurus stuff

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #5 on: April 05, 2005, 07:17:23 am »
@Silvio what are you compiling on which rom?

This native sdk is gcc 3.3.2 + qt-free-x11-3.3.4? for pdaxrom

edit: oh you are responding to blaise, whose post is not relevant in this thread...
« Last Edit: April 05, 2005, 07:19:59 am by pgas »
SLC-860 cacko / senao wifi

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Native -- C++ / Qt
« Reply #6 on: April 05, 2005, 03:34:17 pm »
cramfs mirrored to same URL:  http://zaurus.spy.org/feeds/cacko/pdaXrom/misc/pgas/gcc-qt/

I put a sample/test Qt program in there (that I wrote)... instructions for compiling are in the
source code.

The program basically makes a GUI popup window and prompts you with a question that requires a Yes or No answer.


Scott

ps:  pgas says it compiles and runs.... the shortcut keys (without ALT) seem to work when compiled natively -- although they DO NOT work when cross compiled!

pps:  THANKS AGAIN, PGAS!

projekt

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Native -- C++ / Qt
« Reply #7 on: April 10, 2005, 04:01:08 pm »
how does one mount the zgcc-3.3.2.img from here:http://mirror1.pdaxrom.org/rc9.1/developer/ ?... I tried ZGCC but I kept getting errors and symlink fuckups with busybox.  I am not really interested in compiling Qt apps.  Just would like to learn in the console at first.  I tried the Gcc install in the stable feed but the headers didn't install correctly. AGH.  If anyone can help me get setup with a workin Gcc I would truly be grateful.

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #8 on: April 11, 2005, 01:57:37 am »
like this:
 mount -o loop /path/to/zgcc-3.3.2.img /opt/native/arm/3.3.2-xscale-softvfp

Or put the image in /home/root and reboot if you have enough space.
SLC-860 cacko / senao wifi

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Native -- C++ / Qt
« Reply #9 on: April 11, 2005, 09:55:50 pm »
hmmm. can't seem to run egrep on my pda... it's been up for 24 days :->

doesn't it also check /mnt/card  etc?
if not, could you use a symlink from /home/root?

I'll have to test these.

Scott

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Native -- C++ / Qt
« Reply #10 on: April 11, 2005, 11:15:05 pm »
op, pgas... trying this out.

I eraed /home/root/zgcc-3.3.2.img
did a wget of yours...
mount -o loop

set PATH and QTDIR... mkdir gync, got gync.cpp while in that dir...
qmake -project
qmake
make

and I get this:

g++ -c -pipe -Wall -W -O2  -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/local/qt/mkspecs/default -I. -I. -I/usr/local/qt/include -o gync.o gync.cpp
/opt/arm/3.3.2-vfp/bin/../lib/gcc-lib/armv5tel-cacko-linux/3.3.2/../../../../armv5tel-cacko-linux/bin/as: error while loading shared libraries: libopcodes-2.15.so: cannot open shared object file: No such file or directory

also, in the readme, I don't have an /opt/native ...
and if I do ln -s /opt/arm/3.3.2-vfp -- I have to link to 3.3.2-vfp/qt -- not just -vfp or things like
qmake wont find make.spec and /usr/local/qt/bin etc... won't work.

# find . -name libopcode\*
./arm/3.3.2-vfp/lib/libopcodes-2.15.so
./arm/3.3.2-vfp/lib/libopcodes.so

I see the file... so I think it's probably just some sort of path issue.
let me take a guess that /native/ is hard coded....
nope
ok, I'll try mounting it where you said.

bingo... path is hard coded.. same with /usr/local/qt! so I have to link to xscale-softvfp/qt (not just softvfp) ...

compiling gync now.

it's just sitting there... I don't have firefox open, but I am in X... if it doesn't complete, I'll try
killing X.  it would suck if I had to get out of X to compile... I'm sure I could add a swap on CF
or something.

ok, it compiled and went to linking:

/opt/native/arm/3.3.2-xscale-softvfp/lib/gcc-lib/armv5tel-cacko-linux/3.3.2/../../../../armv5tel-cacko-linux/bin/ld: warning: libGL.so.1, needed by /opt/native/arm/3.3.2-xscale-softvfp/qt/lib/libqt-mt.so, not found (try using -rpath or -rpath-link)
/opt/native/arm/3.3.2-xscale-softvfp/qt/lib/libqt-mt.so: undefined reference to `glXQueryServerString'
/opt/native/arm/3.3.2-xscale-softvfp/qt/lib/libqt-mt.so: undefined reference to `glColor3ub'


not sure why I need GL ...

I don't seem to have this lib anywhere -- do I need to install more libs?

Scott

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #11 on: April 12, 2005, 12:24:45 am »
hmm, I compiled qt with all optinons, including openGL.
if you install libmesa3d it should go on.

hmm maybe I should recompile qt without gl. (I didn't thought it will asks for the lib when compiling)

for the link, there is indeed a little typo in the readme and it should be something like this:

ln -s /opt/native/arm/3.3.2-xscale-softvfp/qt /usr/local/qt

As for the swap, yes compilations might require more ram than availale on the Z, especially when you run X
SLC-860 cacko / senao wifi

jandr

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • http://bok.fas.harvard.edu/john/zaurus/
Native -- C++ / Qt
« Reply #12 on: April 12, 2005, 02:29:44 pm »
This isn't a general solution -- it's pretty much the exact opposite of an SDK -- but if all you're looking for is pdaXrom-compatible QT libraries to link a certain program against, you can try the ones I compiled  (natively) for Konqueror.  There's QT3.3.3 (which required Debian's diffs) as well QT2.3.1 there.  To get Konq to compile against these libs I had to use a lot of the binary utilies from sarge; you may find the same with your app.  Similarly QT3 expected pdaXrom's Xft.h to be named XftFreetype.h, so you might expect to have to do some analogous symlinking of your own.

I have no idea if this helps, but I figure it can't hurt.  
- SL-C760 - Ambicom WiFi CF - PNY 512MB SD - Belkin 1500E IR kb - pdaXrom rc12 (2005/11) -

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Native -- C++ / Qt
« Reply #13 on: April 12, 2005, 02:32:27 pm »
hmm, a general solution to what?
how is this the opposite of an SDK?
you can happily link against the qt libs given by pdaxrom, see my first posts.

When i compiled Qt3 i didn' t have to rename anything.
« Last Edit: April 12, 2005, 02:33:14 pm by pgas »
SLC-860 cacko / senao wifi

jandr

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • http://bok.fas.harvard.edu/john/zaurus/
Native -- C++ / Qt
« Reply #14 on: April 12, 2005, 03:22:18 pm »
Quote
hmm, a general solution to what?
how is this the opposite of an SDK?
you can happily link against the qt libs given by pdaxrom, see my first posts.

When i compiled Qt3 i didn' t have to rename anything.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=74810\"][{POST_SNAPBACK}][/a][/div]

Ah, I was replying to both of the original post's questions at once, to wit: "yes I've managed to compile programs that use Qt natively on the zaurus (and here's how I did it)", but "no I don't have a working native SDK (and thus it's not a general solution)".

For what it's worth I wasn't able to link Konq against the qt libs provided by pdaxrom.  It was awhile ago so I don't recall why, but my guess is that Konq required some defs that weren't turned on by default.  And I only had to rename Xft.h if I wanted Qt's configure to find it; Qt did build quite happily without it.
- SL-C760 - Ambicom WiFi CF - PNY 512MB SD - Belkin 1500E IR kb - pdaXrom rc12 (2005/11) -