OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Sdl/zgcc Problem - Please Help
fordprefect
post Apr 17 2005, 09:33 AM
Post #1





Group: Members
Posts: 12
Joined: 2-March 05
Member No.: 6,554



Hi All,

I'd like to port some SDL apps and develop directly on the Zaurus, but I'm stuck
at a critical step here. Any pointers you can give me would be appreciated.

I'm an experienced C coder, but not so experienced with SDL, or development on the Z.

I'm trying to get an SDL program I wrote working on the Z (I have a C860) via
onboard development - Not using a cross compiler, but building using zgcc 2.95-2
on the stock Sharp ROM.

The program compiles and runs just fine on a PC, but dies on the Zaurus with the infamous:
--
QPaintDevice: Must construct a QApplication before a QPaintDevice
Aborted
--
I've read that this error is often due to a missing link to libSDLmain.a, but I'm linking to
it already!

I built my own SDL using the CVS version of the zports SDL.
Since the checked out zports version was missing some files,
I merged it with a vanilla copy of SDL 1.2.8 - hopefully that isn't
causing some funkiness (I assume it isn't since my compiled version
of SDL doesn't seem to crash my existing SDL programs).

Here are the build options I used to compile SDL onboard:

#!/bin/bash
OPTIMIZE=" -O3 -fexpensive-optimizations -funroll-loops -fomit-frame-pointer "
export CFLAGS="$OPTIMIZE -DZAURUS_SL=1"
./configure --enable-video-qtopia --disable-video-dummy --disable-video-fbcon -
-disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-video-x
11 --disable-nasm --prefix=/opt/QtPalmtop


Here's the relevant part of the Makefile for my program:
--
CFLAGS=-Wall -g ${SDLINC}
SDLLIB=-lqte -lqpe -lSDLmain -lSDL -L/mnt/cf/.zgcc/lib -lm -lc /lib/libpthread.so.0
#note: funky link to pthread above is due to missing symlink in /lib
SDLINC=-D_REENTRANT -I/mnt/cf/.include/Qtopia
CC=$(GCCPREFIX)gcc ${CFLAGS}

foo: foo.o ${OBJ}
${CC} ${CFLAGS} foo.o ${OBJ} -o foo ${SDLLIB}

--

Any help would be greatly appreciated - I hope I'm just missing something
obvious (Wouldn't be the first time) ;-)

Thanks,

Ford
Go to the top of the page
 
+Quote Post
fordprefect
post May 1 2005, 07:01 AM
Post #2





Group: Members
Posts: 12
Joined: 2-March 05
Member No.: 6,554



Any suggestions folks? I'm stuck at this point.

cheers,

Ford
Go to the top of the page
 
+Quote Post
pelrun
post May 17 2005, 11:07 PM
Post #3





Group: Members
Posts: 369
Joined: 6-September 04
From: Brisbane, Australia
Member No.: 4,488



I just hit this issue myself, and I eventually figured it out. Apparently the correct way to fix this is:

1) add #include "SDL_main.h" to the source file with your main() function
2) change your main() function definition to

CODE
#ifdef __cplusplus
extern "C"
#endif
int main(int argc, char *argv[])

3) ensure -DQWS is in the options to the compiler. If the sdl-config script is being called, add it to the --cflags section.
4) link with libSDLmain as you're already doing.

This should then do the right thing regardless of the platform being compiled for.

What is happening is that libSDLmain defines it's own main() function with the extra initialisation some platforms (Qtopia, win32, macosx etc) need. It then jumps to the symbol SDL_main, which is the original application's main() function. The SDL_main.h header file will redefine main to SDL_main if needed (in this case, because QWS is defined.)
Go to the top of the page
 
+Quote Post
fordprefect
post May 24 2005, 06:26 AM
Post #4





Group: Members
Posts: 12
Joined: 2-March 05
Member No.: 6,554



Thanks mate. That fixed the problem!

Cheers,

Ford
ps: Noticed you're from Sydney. Is there much of a Zaurus community there?
How hard is it to buy a Z? Just curious.
Go to the top of the page
 
+Quote Post
pelrun
post May 24 2005, 08:32 PM
Post #5





Group: Members
Posts: 369
Joined: 6-September 04
From: Brisbane, Australia
Member No.: 4,488



Good to hear it's working for you now - it's definitely something that should be documented a little better than it is.

Ouch... I should really change my location - I moved to Brisbane a few months ago smile.gif

Haven't seen much of a Z community in Sydney (I wasn't looking too hard) but there are definitely a few people posting to the Sydney and Brisbane regional boards here. I definitely wouldn't try buying a Z locally though! The one retailer I've seen selling C3000's is putting a 70% markup on them! Pricejapan.com (my choice) or one of the other international Z retailers is definitely still the way to go.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 27th November 2014 - 09:52 PM