[gambit-list] cross-compilation for dummies

Oisín Mac Fhearaí denpashogai at gmail.com
Sun Dec 14 17:16:27 EST 2008


2008/12/14 Marc Feeley <feeley at iro.umontreal.ca>:
> Interesting project!  Gambit-C is highly portable because the Gambit-C
> compiler generates portable C code.  In principle, and very often in
> practice, the C code generated can be compiled without modification on any
> target platform with a "decent" C compiler.  By "decent" I mean that it must
> support all of the ANSI C standard and it must be able to compile large
> files without taking too much memory and time.
>
> So if you install the prebuilt Gambit on Mac OS X then you can run
>
>   gsc -c module.scm
>
> to get module.c which you can then compile with the m68k C cross-compiler.
>  You also need to compile all the files in the lib/ directory.  The script
> misc/vctoolkit.bat will give you the basic idea of the files that need to be
> compiled and linked (for MS Visual C++).

Hi Marc,

However, I need to link the Gambit runtime with -lgambc - and this has
to be compiled with the host system compiler along with gsi and gsc,
right?

Otherwise:
;;;;
Lyrebird:scheme oisin$ m68k-palmos-gcc test.c test_.c
-I/Library/Gambit-C/current/include
-I/Users/oisin/.wine/drive_c/PalmOSCygwin/usr/include/
test.c:122: warning: overflow in implicit constant conversion
test_.c:8303: warning: overflow in implicit constant conversion
/usr/local/m68k-palmos/lib/crt0.o(.text+0x64): In function `start':
crt0.c:69: undefined reference to `PilotMain'
/var/folders/ra/raN9YbS9GOKB9pULa-Z47E+++TI/-Tmp-/ccnusdxU.o(.text+0x5a):test.c:
undefined reference to `___gstate'
/var/folders/ra/raN9YbS9GOKB9pULa-Z47E+++TI/-Tmp-/ccnusdxU.o(.text+0x110):test.c:
undefined reference to `___gstate'
/var/folders/ra/raN9YbS9GOKB9pULa-Z47E+++TI/-Tmp-/ccuO85n7.o(.text+0x34):test_.c:
undefined reference to `___main_char'
/var/folders/ra/raN9YbS9GOKB9pULa-Z47E+++TI/-Tmp-/ccuO85n7.o(.data+0x0):test_.c:
undefined reference to `____20___gambc'
collect2: ld returned 1 exit status
;;;;

> Note that Gambit expects words to be 32 or 64 bits wide.  You claim that the
> m68k has 16 bit words, but as I recall it has 32 bit words.

I think on m68k, 8-bit = byte, 16-bit = word, 32-bit = longword. I
should qualify that I mean specifically the 68000; I think 68020 and
higher might be fully 32-bit, but the 68000 has 32-bit registers and
only a 16-bit data bus.

> Also, if you want a native code compiler, the first version of Gambit (up to
> version 2.2) generated very tight code for m68k.  So perhaps you can also
> try to get it to work with the Palm.  See
>
>  http://www.iro.umontreal.ca/~gambit/.dl/gamb68k.tar.Z

Thanks for this, it sounds like it might be close to what I want,
given the fairly painful size constraints on the Palm. :)

Oisín


More information about the Gambit-list mailing list