Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Building a Native Library - GCC Tool Chain

Building a Native Library - GCC Tool Chain

A PocketC native palm library offering native forms and assorted utilities

Postby cable_guy_67 on Fri Jan 09, 2004 6:57 pm

This is really not a PtoolBox question so if it is not proper to have here just delete it.

I finally took your advice re: building a native library and have done all the research I can do. I have my tool chain up and running and I think all the background material I need. Currently I am at:

CygWin 1.5.5
GCC 3.3.1
PRC-Tools 2.3
Pilrc 3.1
par 0.5
DeveloperStudio for the PalmOS 2.6.2 (falch.net)
PalmOS SDK-5r3

I am trying to build a project template for DStudio and think I have all the compiler options:
-shared -nostartfiles -nostdlib and -lgcc for libgcc.a (I believe),
and --section-headers for objdump.

Working from the makefile from xGrfxLib I think I have that all square. But for some reason I have not been able to compile and get a working version of the native library. Either I still have some digging to do in the DStudio docs or I am missing something in the parameters I am passing to the m68k-palmos-gcc.

What I want to do is to take a large number of routines I am using in multiple applications and use them from a library to cut down the overhead on the actual device.

Do you know of any other native libs with the source provided besides the usual suspects (FractalLib, xGrfxLib and PocketCLib) so I can see a more up to date version of the makefile before I muck around any more. I want the IDE to generate the MakeFile as it needs and to do so I really have to understand what works.

Such a joy, having to learn the basics of make and bash. If you can forward any info I would be glad to post out a walk through for anyone else going through the same process. Most of the posts here are relatively old and while I can do it from the command line it would be nice if I could convince the IDE to take care of the drudgery.

Thanks in advance.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby jstadolnik on Sat Jan 10, 2004 1:23 am

What happens when you type "make" on the bash command line?

Below is a generic PocketC native library makefile I keep kicking around.

Joe

--------

LIBNAME = TestLib
CREATOR = XXXX
LIBPATH = c:/palmdev/sdk-4
VERSION = 1
RM = rm

#This CC macro is somewhat non-traditional in that it includes
# all the include path for the PalmOS SDK. The technique is
# a little dated, but it works.
CC = m68k-palmos-gcc -O2 \
-I $(LIBPATH)/include \
-I $(LIBPATH)/include/core \
-I $(LIBPATH)/include/core/system \
-I $(LIBPATH)/include/core/system/Unix \
-I $(LIBPATH)/include/core/hardware \
-I $(LIBPATH)/include/core/UI \
-I $(LIBPATH)/include/libraries/PalmOSGlue \
-L$(LIBPATH)/lib/m68k-palmos-coff

XTRALIBS = -lgcc
OBJRES = m68k-palmos-obj-res
BUILDPRC = build-prc

main : $(LIBNAME).prc size

$(LIBNAME).prc: libr0000.$(LIBNAME).grc
$(BUILDPRC) $@ $(LIBNAME) $(CREATOR) -v $(VERSION) $^

libr0000.$(LIBNAME).grc: $(LIBNAME)
$(OBJRES) $(LIBNAME)
mv code0001.$(LIBNAME).grc libr0000.$(LIBNAME).grc

$(LIBNAME): $(LIBNAME).o $(LIBNAME)Dispatch.o Makefile
$(CC) -shared -nostartfiles -nostdlib -o $(LIBNAME) $(LIBNAME)Dispatch.o $(LIBNAME).o $(XTRALIBS)
m68k-palmos-objdump --section-headers $(LIBNAME)

%.o : %.cpp $(LIBNAME).h
$(CC) -c $<

mostly_clean:
rm -f *.grc *.o *~ *.bin $(LIBNAME) $(FILENAME)

clean: mostly_clean
@rm -f $(LIBNAME).prc

size:
@ls -l $(LIBNAME).prc

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 2:50 am

OK, taking into consideration that I will have to add the tabs back to the commands after the targets I will poke at it again with your makefile you provided. When I make in bash for the xGrfxLib I get the following:

Code: Select all
$ make
m68k-palmos-gcc -c xGrfxLib.cpp
m68k-palmos-gcc -c xGrfxLibDispatch.cpp
m68k-palmos-gcc -shared -nostartfiles -nostdlib -o xGrfxLib xGrfxLibDispatch.o xGrfxLib.o -lgcc
m68k-palmos-objdump --section-headers xGrfxLib

xGrfxLib:     file format coff-m68k

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000ec0  00000000  00000000  000000d0  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         0000045c  00000000  00000000  00000f90  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  0000045c  0000045c  00000000  2**2
                  ALLOC
  3 .reloc        00000120  00000000  00000000  000013ec  2**2
                  CONTENTS, ALLOC, LOAD
m68k-palmos-obj-res xGrfxLib
mv code0001.xGrfxLib.grc libr0000.xGrfxLib.grc
build-prc -t libr xGrfxLib.prc xGrfxLib P!xg libr0000.xGrfxLib.grc
xGrfxLib.prc: resource 'code' #1 is missing
make: *** [xGrfxLib.prc] Error 1


The makefile I am using is:

Code: Select all
LIBNAME = xGrfxLib
CREATOR = P!xg

CC = m68k-palmos-gcc
XTRALIBS = -lgcc
OBJRES = m68k-palmos-obj-res
BUILDPRC = build-prc

$(LIBNAME).prc: libr0000.$(LIBNAME).grc
   $(BUILDPRC) -t libr $@ $(LIBNAME) $(CREATOR) libr0000.$(LIBNAME).grc

libr0000.$(LIBNAME).grc: $(LIBNAME)
   $(OBJRES) $(LIBNAME)
#   rm -f {code,pref,data,rloc}0000.$(LIBNAME).grc
   mv code0001.$(LIBNAME).grc libr0000.$(LIBNAME).grc

$(LIBNAME): $(LIBNAME).o $(LIBNAME)Dispatch.o Makefile
   $(CC) -shared -nostartfiles -nostdlib -o $(LIBNAME) $(LIBNAME)Dispatch.o $(LIBNAME).o $(XTRALIBS)
   m68k-palmos-objdump --section-headers $(LIBNAME)

$(LIBNAME)Dispatch.o: $(LIBNAME)Dispatch.cpp
   $(CC) -c $(LIBNAME)Dispatch.cpp

$(LIBNAME).o: $(LIBNAME).cpp
   $(CC) -c $(LIBNAME).cpp

clean:
   rm -f *.grc $(LIBNAME).o $(LIBNAME)Dispatch.o $(LIBNAME)

spotless: clean
   rm -f $(LIBNAME).prc


I am so damn close. I will try to use the info you have given me to get this thing working. Then to make a template and not have to worry about the headaches (except for actually using my routines) again. Like I said, it is the standard xGrfxLib that I am working from so I am not worried about the code inside just yet.

Thanks for the reply.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby jstadolnik on Sat Jan 10, 2004 3:14 am

Try replacing...

Code: Select all
$(LIBNAME).prc: libr0000.$(LIBNAME).grc
   $(BUILDPRC) -t libr $@ $(LIBNAME) $(CREATOR) libr0000.$(LIBNAME).grc


with...

Code: Select all
$(LIBNAME).prc: libr0000.$(LIBNAME).grc
   $(BUILDPRC) $@ $(LIBNAME) $(CREATOR) $^


Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 3:41 am

I still end up with the same output in make. Won't that change just expand out to:

$(BUILDPRC) $@ $(LIBNAME) $(CREATOR) $^

build-prc xGrfxLib.prc xGrfxLib P!xg libr0000.xGrfxLib.grc

Hmm, it does not take care of the 'code' #1.

I will have to try a bit more.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby jstadolnik on Sat Jan 10, 2004 3:49 am

Try ditching the ! character in the CID, this may be wacking things up.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 3:57 am

No, removing the ! had no effect. Good thought though. Where is the 'code' resource comming from? I will try and modify the makefile you sent me now and see if I can't use that.
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby jstadolnik on Sat Jan 10, 2004 3:59 am

I tried compiled the makefile I posted and oddly got the same exact message. I haven't tried compiling this mini-project for some time. It would seem that something in the tool chain changed.

I'll take a peek.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 4:36 am

Changed your makefile to conform to the library I am trying to create and now I get the same output as previously posted. Makefile now is:

Code: Select all
LIBNAME = xGrfxLib
CREATOR = XXXX
LIBPATH = c:/palmdev/sdk-5
VERSION = 1
RM = rm

#This CC macro is somewhat non-traditional in that it includes
# all the include path for the PalmOS SDK. The technique is
# a little dated, but it works.
CC = m68k-palmos-gcc -O2 \
#-I $(LIBPATH)/include \
#-I $(LIBPATH)/include/core \
#-I $(LIBPATH)/include/core/system \
#-I $(LIBPATH)/include/core/system/Unix \
#-I $(LIBPATH)/include/core/hardware \
#-I $(LIBPATH)/include/core/UI \
#-I $(LIBPATH)/include/libraries/PalmOSGlue \
#-L$(LIBPATH)/lib/m68k-palmos-coff

XTRALIBS = -lgcc
OBJRES = m68k-palmos-obj-res
BUILDPRC = build-prc

main : $(LIBNAME).prc size

$(LIBNAME).prc: libr0000.$(LIBNAME).grc
   $(BUILDPRC) $@ $(LIBNAME) $(CREATOR) -v $(VERSION) $^

libr0000.$(LIBNAME).grc: $(LIBNAME)
   $(OBJRES) $(LIBNAME)
   mv code0001.$(LIBNAME).grc libr0000.$(LIBNAME).grc

$(LIBNAME): $(LIBNAME).o $(LIBNAME)Dispatch.o Makefile
   $(CC) -shared -nostartfiles -nostdlib -o $(LIBNAME) $(LIBNAME)Dispatch.o   

   $(LIBNAME).o $(XTRALIBS)
   m68k-palmos-objdump --section-headers $(LIBNAME)

%.o : %.cpp $(LIBNAME).h
   $(CC) -c $<

mostly_clean:
   rm -f *.grc *.o *~ *.bin $(LIBNAME) $(FILENAME)

clean: mostly_clean
   @rm -f $(LIBNAME).prc

size:
   @ls -l $(LIBNAME).prc



At least we are on the same sheet of music.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby jstadolnik on Sat Jan 10, 2004 4:40 am

You'll want to take off the \ at the end of the CC line as it is a continuation character, and the text isn't being continued.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 4:56 am

Already done. I also bumped the line in target $(LIBNAME): to read:

$(CC) -shared -nostartfiles -nostdlib -o $(LIBNAME) $(LIBNAME) Dispatch.o $(LIBNAME).o $(XTRALIBS)

on one line because I didn't like the way it looked in bash while running. Still gives the same output though. I gotta get some sleep. If you have a revelation let me know. Thanks for the help Joe.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 3:09 pm

http://groups.yahoo.com/group/palm-dev-forum/message/77642

Ok, this seems to be the best "jump in" point of the thread. They are discussing the same error with "-t HACK" but the idea looks to be similar. I will go through this and back through the build-prc docs to see what I am missing. There appears to have been a change at version 2.2 that may be the root of this error for me.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 3:28 pm

Reading throught the prc-tools/build-prc docs I gather that the -t option does not set build-prc to knowing it is a library. -L seems to be the one I was looking for. Changing the section in makefile to:

Code: Select all
$(LIBNAME).prc: libr0000.$(LIBNAME).grc
   $(BUILDPRC) -L -t libr $@ $(LIBNAME) $(CREATOR) -v $(VERSION) $^


allows it to compile using make. I am not sure if this is correct but at least I have something generated to test from. Off to make a sample app that calls the library and see if it was the right one.

More to Follow...

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby cable_guy_67 on Sat Jan 10, 2004 3:47 pm

Success!

The last change was the correct one. I compiled and tested the sample apps that came with the xGrfxLib (xgrfxtest.c and cbe12.c) and they both ran on the emulator. They do crash back into preferences on exit but I think that is not an issue just something to do with the way the apps exit. I will whip up a test example of my own to verify but the library seems to have been built.

Now to verify the test and hit the super market. When I have varification from my own app I will wrap this thread up and make a nice little tutorial. Thanks for all the help Joe, it has been invaluable.

Mark
cable_guy_67
 
Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby mgreen on Sat Jan 10, 2004 8:05 pm

Just as an aside on the topic of native libraries, you can build native libraries for Pocket C on the Palm OS with either OnBoardC or PalmPascal. Have a look at the Yahoo Group for OnBoardC or <http://ppcompiler.free.fr/index.php?lng=en> for Palm Pascal. You'll find several examples of Pocket C native libraries on the PalmPascal website. Both of the development systems are free. PalmPascal has the added advantage of being able to compile ARM applets that could be called from the native library.

-----
Michael Green
-----
Michael Green
mgreen
 
Posts: 72
Joined: Fri Mar 14, 2003 9:40 pm
Location: USA

Next

Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron