Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GForth 6.2 built on Mac Xcode troubles

18 views
Skip to first unread message

bria...@rogers.com

unread,
Mar 10, 2008, 10:43:32 PM3/10/08
to
Hello GForth experts,

I have inherited a 'hand-me-down' Dual G5 from my wife, the graphic
designer (ellyfox.com). I of course had to install the newest Xcode
tools for the Leopard version of OS/X. And of course I don't know
very much about C. I have built GForth in the past using the command
line. (Even I can type 'make' :-) )

So, I think... wouldn't it be neat if I could build GForth with Xcode
(uses GCC 4.0) . So I did my best to put the appropriate files into
an Apple 'Standard Tool' project, which builds a command line app in
C.

I removed all "Arch" folder files except the ones for Power PC and 386
and here are the errors I get from file strerror.c :


#include <errno.h>
#include <stdio.h>
extern char *sys_errlist[];
error: conflicting types for 'sys_errlist'

extern int sys_nerr;
error: conflicting type qualifiers for 'sys_nerr'
< end errors>

I also get 19 warnings shown below:

Questions:
1. Can anybody help direct me to how to fix these errors? (looks like
conflict with stdio.h)
2. Can anybody tell me if these warnings are acceptable when compiling
GForth?

/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:
482:2: warning: #warning You can ignore the warnings about clobbered
variables in go_forth
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c: In
function 'flush_to_here':
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:830:
warning: pointer targets in passing argument 1 of '_sync_cache_range'
differ in signedness
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c: In
function 'loader':
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:
1360: warning: pointer targets in passing argument 2 of 'relocate'
differ in signedness
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c: In
function 'openimage':
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:
1401: warning: pointer targets in passing argument 1 of 'tilde_cstr'
differ in signedness
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:
482:2: warning: #warning You can ignore the warnings about clobbered
variables in go_forth
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:830:
warning: pointer targets in passing argument 1 of '_sync_cache_range'
differ in signedness
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:
1360: warning: pointer targets in passing argument 2 of 'relocate'
differ in signedness
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/main.c:
1401: warning: pointer targets in passing argument 1 of 'tilde_cstr'
differ in signedness

<more error explantions>
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/strerror.c:
24: error: conflicting types for 'sys_errlist'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/stdio.h:274: error:
previous declaration of 'sys_errlist' was here
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/strerror.c:
25: error: conflicting type qualifiers for 'sys_nerr'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/stdio.h:273: error:
previous declaration of 'sys_nerr' was here
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/strerror.c:
24: error: conflicting types for 'sys_errlist'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/stdio.h:274: error:
previous declaration of 'sys_errlist' was here
/Users/ellyfox/Mac gForthCLI/../gforth/gforth-0.6.2/engine/strerror.c:
25: error: conflicting type qualifiers for 'sys_nerr'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/stdio.h:273: error:
previous declaration of 'sys_nerr' was here

Build failed (2 errors, 19 warnings)

Appreciate any help

Thanks

Brian

John Doty

unread,
Mar 10, 2008, 11:19:38 PM3/10/08
to
bria...@rogers.com wrote:
> Hello GForth experts,
>
> I have inherited a 'hand-me-down' Dual G5 from my wife, the graphic
> designer (ellyfox.com). I of course had to install the newest Xcode
> tools for the Leopard version of OS/X. And of course I don't know
> very much about C. I have built GForth in the past using the command
> line. (Even I can type 'make' :-) )

The easy way is to install Fink (http://www.finkproject.org/). That's a
Unix open source software importation system for MacOSX. Then just "fink
install gforth" from the command line.

--
John Doty, Noqsi Aerospace, Ltd.
http://www.noqsi.com/
--
History teaches that logical consistency is neither sufficient nor
necessary to establish practical, real world truth. Those who attempt to
use logic for that purpose are abusing it.

bria...@rogers.com

unread,
Mar 10, 2008, 11:42:17 PM3/10/08
to
On Mar 10, 11:19 pm, John Doty <j...@whispertel.LoseTheH.net> wrote:

> brian....@rogers.com wrote:
> > Hello GForth experts,
>
> > I have inherited a 'hand-me-down' Dual G5 from my wife, the graphic
> > designer (ellyfox.com). I of course had to install the newest Xcode
> > tools for the Leopard version of OS/X. And of course I don't know
> > very much about C. I have built GForth in the past using the command
> > line. (Even I can type 'make' :-) )
>
> The easy way is to install Fink (http://www.finkproject.org/). That's a
> Unix open source software importation system for MacOSX. Then just "fink
> install gforth" from the command line.
>
> --
> John Doty, Noqsi Aerospace, Ltd.http://www.noqsi.com/

> --
> History teaches that logical consistency is neither sufficient nor
> necessary to establish practical, real world truth. Those who attempt to
> use logic for that purpose are abusing it.

Thanks John, I was looking at the Fink site and didn't understand the
need. GForth will compile perfectly at the command line on OS/X with
just 'make'. I will look closer at Fink to understand it better.

I was trying to understand this fancy development suite, Xcode, and
maybe, just maybe at some point get a window to open with gforth
running like win32forth.

After that's done, I was wondering if we could help our the Power Mops
people by building Mike's system on top of a "Mac Gforth". It
wouldn't be native code but at least it would be running an Intel
Binary on the new Macs.

I am dreaming in technicolour for my 'C' skill-set but it seems
doable.

Brian

John Doty

unread,
Mar 10, 2008, 11:52:43 PM3/10/08
to
bria...@rogers.com wrote:
> On Mar 10, 11:19 pm, John Doty <j...@whispertel.LoseTheH.net> wrote:
>> brian....@rogers.com wrote:
>>> Hello GForth experts,
>>> I have inherited a 'hand-me-down' Dual G5 from my wife, the graphic
>>> designer (ellyfox.com). I of course had to install the newest Xcode
>>> tools for the Leopard version of OS/X. And of course I don't know
>>> very much about C. I have built GForth in the past using the command
>>> line. (Even I can type 'make' :-) )
>> The easy way is to install Fink (http://www.finkproject.org/). That's a
>> Unix open source software importation system for MacOSX. Then just "fink
>> install gforth" from the command line.
>>
>> --
>> John Doty, Noqsi Aerospace, Ltd.http://www.noqsi.com/
>> --
>> History teaches that logical consistency is neither sufficient nor
>> necessary to establish practical, real world truth. Those who attempt to
>> use logic for that purpose are abusing it.
>
> Thanks John, I was looking at the Fink site and didn't understand the
> need. GForth will compile perfectly at the command line on OS/X with
> just 'make'. I will look closer at Fink to understand it better.

What the Fink packagers do is fix the little incompatibilities between
the "portable" source and the MacOSX environment. For some packages they
have precompiled binaries, which saves time. It's a lot like the Linux
distributions, and contains many of the same packages. If you know the
autotools inside and out, you don't need Fink, but still it saves time
unless you want run a bleeding edge or development release.

>
> I was trying to understand this fancy development suite, Xcode, and
> maybe, just maybe at some point get a window to open with gforth
> running like win32forth.
>
> After that's done, I was wondering if we could help our the Power Mops
> people by building Mike's system on top of a "Mac Gforth". It
> wouldn't be native code but at least it would be running an Intel
> Binary on the new Macs.
>
> I am dreaming in technicolour for my 'C' skill-set but it seems
> doable.
>
> Brian

Dennis Ruffer

unread,
Mar 11, 2008, 10:21:03 AM3/11/08
to
Brian, the warnings are typical, but the errors are a problem (I suspect).

I haven't updated to Leopard yet, nor have I tried to do it on a G5 in
quite a while, but the gforth TOT on CVS works fine on my PowerBook G4
with Tiger and the following gcc:

powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370)

Which gforth are you trying to compile?

DaR

bria...@rogers.com

unread,
Mar 11, 2008, 8:04:25 PM3/11/08
to

Thanks for the reply Dennis. Here is the welcome screen from the
version I have when I compile from the terminal command line

Gforth 0.6.2, Copyright (C) 1995-2003 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit

So when you compiled it on your Powerbook, did you use Xcode?

Maybe I just don't have all the files in the right places for Xcode to
figure things out?

BF

Dennis Ruffer

unread,
Mar 12, 2008, 1:22:57 PM3/12/08
to

The 0.6.2 version and even the 0.6.9 snapshot have some issues with OSX
that have been solved on their CVS TOT. I'm hoping that Anton does
another snapshot soon, but since I use the CVS, I leave distribution to
him.

I'm not sure what you mean when you say that you "use Xcode". It's got
a reasonable editor, and given enough time and patience, I'm sure it is
possible to convert gforth's make into an Xcode build. However, I have
not done that, nor do I know anyone who has.

I use BBEdit or Eclipse for editing and the Terminal to run a script
that I wrote so that I remember how to build it on my system. It
contains the following:

env CFLAGS="-I/opt/local/include -O2" LDFLAGS=-L/opt/local/lib
./BUILD-FROM-SCRATCH


This allows the build to find my fflib install from MacPorts so that I
can call external functions, although that is something that Anton has
been working on with the TOT version recently.

The gcc compiler and other tools required by the gforth build are not
present in OSX until you install Xcode, so I guess that means that
technically, I "use Xcode", but I have seen people install the tools
separately, so I don't view Xcode itself as a required part of the
process.

Anton wrote the BUILD-FROM-SCRATCH script and it takes care of all the
dependency issues. Xcode puts everything in the right place, and if
you don't care about external function calls, then it should be
sufficient.

Try typing that in the gforth folder and capture the full log. It is
pretty long, so I suggest that you join the gforth mailing list and
post it there. If you haven't already joined, instructions can be
found at:

http://www.complang.tuwien.ac.at/forth/gforth/

DaR

Robert Spykerman

unread,
Mar 29, 2008, 11:57:36 PM3/29/08
to
20 days later (sorry I am very busy IRL at the mo...)

On Mar 11, 12:43 pm, brian....@rogers.com wrote:
> Hello GForth experts,
>
> I have inherited a 'hand-me-down' Dual G5 from my wife, the graphic
> designer (ellyfox.com). I of course had to install the newest Xcode
> tools for the Leopard version of OS/X. And of course I don't know
> very much about C. I have built GForth in the past using the command
> line. (Even I can type 'make' :-) )

,,,snip

ROFL - I got a hand me down too - I wish I could say I got me a
duallie G5 but the ibook will do - I spent most of last night trying
to build 0,6.2 on the G4 with GCC3.3 OS X 10.3.9.

I built ffcall 1.1 then proceeded to go for gforth...

I finally got 0.6.2 compiled with the long long switch

http://www.complang.tuwien.ac.at/forth/gforth/Known-problems.html

It runs, it links to ffcall dynamically but there are a few issues I
have yet to sit down and figure out ie the word see seems to crash the
system.

*** Has anyone build a gforth 0.6.x on an old PPC G4 set up like mine
succesfully and can tell me about their experiences?

I know it's been done :

Bit of googling and I note Ian Osgood posted a link to a .dmg with a
prebuilt binary (0.6.2 with ffcall statically linked in) circa
2006. ).

http://www.quirkster.com/forth/gforth.dmg.gz

This appears to work beutifully - it may solve your problem but it's
not likely G5 optimised - it ran on my G4.

I don't actually know if it has a PPC asm built in - can't check I'm
out on my Eee at the moment (great piece of kit).

Hmm... come to think of it I recall I had some slight problems
building gforth on my Eee now come to think of it - I'll post my
workaround i case anyone's in the same boat.

Robert Spykerman

Dennis Ruffer

unread,
Mar 30, 2008, 8:58:13 PM3/30/08
to
On 2008-03-29 22:57:36 -0500, Robert Spykerman
<robert.s...@gmail.com> said:
> I finally got 0.6.2 compiled with the long long switch
>
> http://www.complang.tuwien.ac.at/forth/gforth/Known-problems.html
>
> It runs, it links to ffcall dynamically but there are a few issues I
> have yet to sit down and figure out ie the word see seems to crash the
> system.
>
> *** Has anyone build a gforth 0.6.x on an old PPC G4 set up like mine
> succesfully and can tell me about their experiences?
>
> I know it's been done :

Robert, I have been running gforth on G3/4/5 systems for years. You
found one of the issues with 0.6.2. There are others, but I don't
remember what they were at the moment. Anton and I worked most
recently on MacIntel boxes, and last I checked, his latest CVS version
has all the wrinkles worked out. I'm sure Anton would agree that you
should be using it. On PPC systems you might be able to get away with
the 0.6.9 snapshot, but as others have commented, waiting for gforth
releases or support is problematic. The CVS approach is your best bet.


>
> Bit of googling and I note Ian Osgood posted a link to a .dmg with a
> prebuilt binary (0.6.2 with ffcall statically linked in) circa
> 2006. ).
>
> http://www.quirkster.com/forth/gforth.dmg.gz
>
> This appears to work beutifully - it may solve your problem but it's
> not likely G5 optimised - it ran on my G4.

What kind of optimizations are you looking for? I haven't played with
it, but making it be a 64-bit Forth would be interesting, but even
then, getting OSX to let you use 64-bit calls will be problematic (last
I looked).


>
> I don't actually know if it has a PPC asm built in - can't check I'm
> out on my Eee at the moment (great piece of kit).

The CVS version does, but not sure about 0.6.9 and 0.6.2 does not.


>
> Hmm... come to think of it I recall I had some slight problems
> building gforth on my Eee now come to think of it - I'll post my
> workaround i case anyone's in the same boat.
>
> Robert Spykerman

DaR


Robert Spykerman

unread,
Mar 31, 2008, 5:54:54 AM3/31/08
to
On Mar 31, 10:58 am, Dennis Ruffer <druf...@speakeasy.net> wrote:
> On 2008-03-29 22:57:36 -0500, Robert Spykerman
> <robert.spyker...@gmail.com> said:
> > ...

> > *** Has anyone build a gforth 0.6.x on an old PPC G4 set up like mine
> > succesfully and can tell me about their experiences?
> > ...

>
> Robert, I have been running gforth on G3/4/5 systems for years. You
> found one of the issues with 0.6.2. There are others, but I don't
> remember what they were at the moment. Anton and I worked most
> recently on MacIntel boxes, and last I checked, his latest CVS version
> has all the wrinkles worked out. I'm sure Anton would agree that you
> should be using it. On PPC systems you might be able to get away with
> the 0.6.9 snapshot, but as others have commented, waiting for gforth
> releases or support is problematic. The CVS approach is your best bet.

Thanks I shall check that out later. I mean to inspect/dissect gforth
out completely down the line anyway. I guess once I can build gforth
pretty good on an ibook, I may stand a chance building it on a PS3 :)

> What kind of optimizations are you looking for? I haven't played with
> it, but making it be a 64-bit Forth would be interesting, but even
> then, getting OSX to let you use 64-bit calls will be problematic (last
> I looked).

Hmm.. come to think of it, I am not entirely sure I admit. I was
referring to the OP of course - I expect a build from source on a G5
with newer tools may spit out a binary which may be better than the
2006 dmg binary I linked a reference to.

But how much better, of course.. I dunno. It just struck me - I dunno
if a G5 has newer instructions / available optimisations at the 32 bit
level.

Anyway, as an aside (consider this off-topic), I found myself
wandering and ended up on the intel site. I got myself this intel 10.3
c compiler (the free non-commercial linux one). From memory a couple
of years ago the free eval versions were time limited, so this is a
welcome change.

I may tinker with this and gcc with the (linux x86) gforth just to see
what differences there are.

I've heard people say it's a better compiler etc but how compatible it
is with the many things out there that build without a hitch on gcc...
I guess I shall find out.

It's also available on OSX btw if you're interested. It is 'free' I
guess lol

Robert

Dennis Ruffer

unread,
Mar 31, 2008, 8:28:07 PM3/31/08
to
On 2008-03-31 04:54:54 -0500, Robert Spykerman
<robert.s...@gmail.com> said:

The gforth sources will make a difference, but I doubt there is much of
any difference between G4 and G5 out from gcc using the same source.
You have to use the new capabilities, or at least use something that
gcc thinks should be compiled differently, for there to be any
difference. I can't think of anything in gforth that would trigger
that, other than trying to make it be a 64-bit Forth.


>
> But how much better, of course.. I dunno. It just struck me - I dunno
> if a G5 has newer instructions / available optimisations at the 32 bit
> level.

Assuming gcc knows the difference.


>
> Anyway, as an aside (consider this off-topic), I found myself
> wandering and ended up on the intel site. I got myself this intel 10.3
> c compiler (the free non-commercial linux one). From memory a couple
> of years ago the free eval versions were time limited, so this is a
> welcome change.
>
> I may tinker with this and gcc with the (linux x86) gforth just to see
> what differences there are.
>
> I've heard people say it's a better compiler etc but how compatible it
> is with the many things out there that build without a hitch on gcc...
> I guess I shall find out.
>
> It's also available on OSX btw if you're interested. It is 'free' I
> guess lol
>
> Robert

I've heard of all sorts of ways to play with other versions of gcc and
yes, installing linux has been an option for a long time, even on a
PPC. However, rarely is it worth the trouble, IMO. ;)

DaR

Robert Spykerman

unread,
Mar 31, 2008, 11:03:35 PM3/31/08
to
On Mar 31, 8:28 pm, Dennis Ruffer <druf...@speakeasy.net> wrote:
> On 2008-03-31 04:54:54 -0500, Robert Spykerman
> ...

> > It's also available on OSX btw if you're interested. It is 'free' I
> > guess lol
>
> > Robert
>
> I've heard of all sorts of ways to play with other versions of gcc and
> yes, installing linux has been an option for a long time, even on a
> PPC. However, rarely is it worth the trouble, IMO. ;)
>
> DaR

Off topic for forth :

Just in case I misunderstood what you meant - I meant the free intel C
compiler is also available as a drop in for xcode on leopard. I'd get
it just for fun :)

I take your point if you have an intel mac you may not want to put in
a linux, but ... heck it's fun - and I have to admit I am slightly
more familiar with linux than darwin, although still self-admitedly
very n00bish 'nix wise.

I also have a sneaking hunch that x86 linux is probably faster than
leopard - this is just a generalisation of course - but given the one
could fine tune his/her linux install possibly better than a leopard
install, this may be true.

If/when I get a x86 mac I shall put this to the test of course - those
penryn macbook pro's sure look sexy. Been meaning to try and get
familiar with x86 64 bit asm as well, heh. I wonder if it's any better
than IA32 asm. I wonder how many new registers I have to play with,
must take a look.

It's a real shame the PowerPC G5's have been left behind. Now it looks
like we're stuck with intel mainly.

Right now I'm just in the midst of rebuilding my Eee PC's kernel -just
got more ram for it, and for some strange reason the kernel's been
built to only recognize 1 gb. This thing is a real fun toy and time
waster destined to be a classic I suspect.

Sorry guys, this is way off topic :)


Robert

0 new messages