Compiling Adv770 on OS X?

G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Have any of you Unix wizards out there tried to get one of the "fancy"
(readline or glk) versions of Mike Arnautov's Adv770 (see
http://www.mipmip.dsl.pipex.com/adv770/src770c.shtml) to compile on OS
X?

Not that there's really any problem to use the plain, "dumb"
executable, it is just that when something doesn't work, it kind of
hard to let it go.

I'm basically a Unix (and Darwin) newbie, although I have played
around some with Fink and X11. So far I've downloaded, patched and
compiled Xglk (0.4.11, patched for Linux), which seems to work fine,
but when I put the resulting libxglk.a and glk.h in the adv770 folder
and run the advbuild script (or try to run cc from the command line) ,
I get this:

Building adv770.

Searching for Glk library...
Searching for Glk header file glk.h...
Searching for X11 library...

Creating Glk-enabled executable...
ld: Undefined symbols:
_glkunix_startup_code
_xiodpy
_gctech
_matte_box
_xiodepth
....

and a long, long list of undefined symbols.

Please, what is wrong? And what should I do about it?
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Il Wed, 21 Apr 2004 11:39:35 -0700, Ewa Garcia-Folmer ha scritto:

> Please, what is wrong? And what should I do about it?

Apart that this type of question are more apt to r.a.i.f., i can say, if
MacOSX is true unixish, the library should be in /usr/lib or
/usr/local/lib

HTH,

Best regards from Italy,
Dott. Piergiorgio.
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

> Apart that this type of question are more apt to r.a.i.f., i can say,

Well, it's not about programming or creating i-f. I just want to know
how to get a game running.

> if MacOSX is true unixish, the library should be in /usr/lib or /usr/
> local/lib

Yeah, but in this case the compiler and linker seem to find all the the
files they are looking for, still the linking doesn't work right.
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Il Thu, 22 Apr 2004 00:48:46 +0000, Ewa Garcia-Folmer ha scritto:

> Yeah, but in this case the compiler and linker seem to find all the the
> files they are looking for, still the linking doesn't work right.

At this point, I can only surmise that you don't have some library, but
for a console app, I wonder if there is needed some other library, aside
curses.
OTOH, I'm on a Linux box, and I don't know MacOS X aside the fact is
around a BSDish 'nix


Best regards from Italy,
Dott. Piergiorgio.
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

ignalina@mac.com (Ewa Garcia-Folmer) wrote:

> Have any of you Unix wizards out there tried to get one of the "fancy"
> (readline or glk) versions of Mike Arnautov's Adv770 (see
> http://www.mipmip.dsl.pipex.com/adv770/src770c.shtml) to compile on OS
> X?

David Kinder's analysis is, of course, absolutely correct (I'd reply
to his message, but this news server hasn't got it yet!). The
difficulty is that Glk implementations on Unix and Windows differ
rather significantly in their setting up, because Glk usurps the
function of main() and hence has to deal with any command line
arguments. I'll have to do something about situations such as yours,
where the compiler doesn't say that the O/S is Unix or Linux, yet it
is xglk that is being used.

In the meantime, just modify the advbuild script to change line 115,
which reads

GLK="-DGLK$GLK -l$GLKLIB"

to
GLK="-DGLK$GLK -l$GLKLIB -Dunix"

and it should all work. Let me know if it doesn't!

Mike Arnautov
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

> Creating Glk-enabled executable...
> ld: Undefined symbols:
> _glkunix_startup_code

This first one is a symbol that is supposed to be defined in
the Adventure 770 source code. Looking at adv00.c around line
1663, the declaration is protected by a preprocessor line,
at line 1653:

#if defined(unix) || defined(linux)

I guess Apple's OS X gcc doesn't define either of these. Try
changing that line to

#if defined(unix) || defined(linux) || defined(__APPLE_CC__)

(I think that that is right, but check the compiler
documentation). There may be another, more suitable symbol to
check for.

David
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Another useful thing to do would be to find out exactly what
command line the advbuild script is running. The easiest way
would be to change the end of advbuild to read:

cd $SOURCE
echo $CC *.c -o "$TRG/$NAME" $DEBUG $GLK $READLINE
$CC *.c -o "$TRG/$NAME" $DEBUG $GLK $READLINE && echo && \
echo Executable $TARGET$NAME created.
echo


David
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

In <f2b6f345.0404251408.32fd6d@posting.google.com> mla@britishlibrary.
net wrote:

> In the meantime, just modify the advbuild script to change line 115,
> which reads
>
> GLK="-DGLK$GLK -l$GLKLIB"
>
> to
> GLK="-DGLK$GLK -l$GLKLIB -Dunix"
>
> and it should all work. Let me know if it doesn't!
>
> Mike Arnautov

Well, I'm sorry to break the bad news. After making your and David
Kinder's suggested changes, this is what I get (with xglk source and
binary in directory xglk in my home directory):

~/adv770] username% ./advbuild

Building adv770.

Searching for Glk library...
Searching for Glk header file glk.h...
Searching for X11 library...

Creating Glk-enabled executable...
: No such file or directory
cc .c -o ./adv770 -I/Users/username/xglk -DGLK -L/Users/username/xglk -
lxglk -Dunix -L/usr/X11R6/lib -lX11
ld: Undefined symbols:
_xiodpy
_gctech
_matte_box
_xiodepth
_xiowin
_prefs
_gcback
_gcflip
_gcfore
_gcselect
_gctechd
_gctechu
_gctextback
_gctextfore
_textbackpixel
_textforefont
_textforepixel
_xio_any_invalid
_xio_hgt
_xio_wid
_xiomap
_xioscn
_imageslegal
_jpeg_CreateDecompress
_jpeg_destroy_decompress
_jpeg_finish_decompress
_jpeg_read_header
_jpeg_read_scanlines
_jpeg_start_decompress
_jpeg_std_error
_jpeg_stdio_src
_pixelcube
_png_create_info_struct
_png_create_read_struct
_png_destroy_read_struct
_png_get_bit_depth
_png_get_channels
_png_get_color_type
_png_get_image_height
_png_get_image_width
_png_get_rowbytes
_png_init_io
_png_read_end
_png_read_image
_png_read_info
_png_read_update_info
_png_set_expand
_png_set_strip_16
_png_sig_cmp
_xiobackstore

That is, the same errors minus the first one. I'm sure I must have
missed something obvious!
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Ewa Garcia-Folmer <ignalina-remove-this@mac.com> wrote:

> Well, I'm sorry to break the bad news.

Well, you certainly have me scratching my head. I can see two
curiosities though, which may (or may not) offer a clue as to what the
heck is going on.

Firstly, you say "same errors minus the first one", Presumably you
mean that
the "No such file or directory" message is new? It's certainly got to
be significant!

Secondly,

> cc .c -o ./adv770 -I/Users/username/xglk -DGLK -L/Users/username/xglk -
> lxglk -Dunix -L/usr/X11R6/lib -lX11

First a trivial point (I hope :). I take it that what the script
actually has is "cc *.c -o ..."? More to the point, the above says
that the script attempts to load the library from the xglk
sub-directory of your home, not from your home itself. And indeed, the
script will check there before checking your home itself. (The search
order is defined by the line
LIBDIRS="/usr/lib /usr/local/lib $HOME/lib $HOME/xglk ./xglk ../xglk
..")

I presume that where you built and patched xglk, and it looks like its
presence is causing trouble. Try renaming it to something else, re-run
the script as it stends, and let me know what happens?

Mike.
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Mike Arnautov wrote:
> David Kinder's analysis is, of course, absolutely correct (I'd reply
> to his message, but this news server hasn't got it yet!).

Continuing in that theme, I can now see Ewa's reply to your message on
Google Groups, but it hasn't shown up on my news server. Grrr.... :(

Ewa Garcia-Folmer wrote:
> Well, I'm sorry to break the bad news. After making your and David
> Kinder's suggested changes, this is what I get (with xglk source and
> binary in directory xglk in my home directory):

Well, at least we're making some progress, as the link error for
_glkunix_startup_code is now gone.

All the remaining undefined symbols being reported by ld are part of
XGlk, so it looks like ld isn't finding the XGlk library. Looking at
the output from the modified advbuild script:

cc .c -o ./adv770 -I/Users/username/xglk -DGLK -L/Users/username/xglk
-lxglk -Dunix -L/usr/X11R6/lib -lX11

That "username" looks deeply suspicious (unless you really are logged
onto your Mac as a user called "username"): it should be something like
/Users/ewa/xglk (or whatever you're logged on as). As you've copied
XGlk to the adv770 directory, try running this command line instead,
from the same place:

cc .c -o ./adv770 -I. -DGLK -L. -lxglk -Dunix -L/usr/X11R6/lib -lX11

If that doesn't work, try adding a -v flag to the above line, and
posting the results: that will print out every command cc executes.

David
 
G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

> cc .c -o ./adv770 -I/Users/username/xglk -DGLK -L/Users/username/xglk
> -lxglk -Dunix -L/usr/X11R6/lib -lX11

Oops! As Mike says, that should start "cc *.c -o" ...

David