On Tue, 12 Feb 2013 13:38:17 EST Marc Feeley feeley@iro.umontreal.ca wrote:
On 2013-02-12, at 1:30 PM, Bakul Shah bakul@bitblocks.com wrote:
On Tue, 12 Feb 2013 13:20:13 EST Marc Feeley feeley@iro.umontreal.ca =
wrote:
Gambit requires *no* external libraries (except for libc) and its code is compilable by C, C++ and Objective-C compilers without any fancy command-line options.
=20 This leads me to ask if anyone has tried porting gambit to plan9? Thanks
Not that I know of, but it should be trivial to get something basic going.
Any hints on how to go about a new port?
You should ask on the Gambit mailing list.
Just did! Even if anyone has made a partial attempt at port, I'd like to hear about it, to avoid relearning the same lessons!
Thanks!
Bakul
Afficher les réponses par date
On 2013-02-12, at 1:47 PM, Bakul Shah bakul@bitblocks.com wrote:
On Tue, 12 Feb 2013 13:38:17 EST Marc Feeley feeley@iro.umontreal.ca wrote:
On 2013-02-12, at 1:30 PM, Bakul Shah bakul@bitblocks.com wrote:
On Tue, 12 Feb 2013 13:20:13 EST Marc Feeley feeley@iro.umontreal.ca =
wrote:
Gambit requires *no* external libraries (except for libc) and its code is compilable by C, C++ and Objective-C compilers without any fancy command-line options.
=20 This leads me to ask if anyone has tried porting gambit to plan9? Thanks
Not that I know of, but it should be trivial to get something basic going.
Any hints on how to go about a new port?
You could try
./configure make
and report back which errors you get.
If the configure fails, from a fresh Gambit distribution directory you could:
1) Create a new include/gambit.h file with
echo #ifndef ___VOIDSTAR_WIDTH > include/gambit.h echo #define ___VOIDSTAR_WIDTH ___LONG_WIDTH >> include/gambit.h echo #endif >> include/gambit.h echo #ifndef ___MAX_CHR >> include/gambit.h echo #define ___MAX_CHR 0x10ffff >> include/gambit.h echo #endif >> include/gambit.h cat include/gambit.h.in >> include/gambit.h
Usually the gambit.h file is created by the configure script, but here we'll avoid using the configure script because it may have issues on plan9.
2) In lib/ compile all the .c files to .o files using -D___LIBRARY and -D___PRIMAL and -D___HAVE_STDIO_H and -D___HAVE_STDLIB_H. Some of the files (os*.c) are operating system dependent, so most of your problems will be in compiling these files. By default, only stdio functions will be called for I/O and only malloc/free are used for memory allocation. Obviously you won't have a bunch of functionality such as sockets, process ports, time measurement, etc but these can be ported one by one as the need arises by adding the appropriate -DHAVE_XXX and adapting the os*.c files.
Once step #2 is completed, you are almost done!
3) In gsi/ compile all the .c files to .o files. Then link all the .o files from lib/ and gsi/ to produce the interpreter "gsi".
4) Repeat step #3 in the gsc/ to produce the compiler "gsc".
Marc
On Tue, 12 Feb 2013 14:06:57 EST Marc Feeley feeley@iro.umontreal.ca wrote:
You could try
./configure
term% ./configure ./configure: '/bin/sh' file does not exist
term% ape/sh configure sed: r.e.-using command garbled: /^.*/([^/][^/]*)/*$/{ configure: expr: not found sed: r.e.-using command garbled: s/[$]LINENO([^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_].*\n)(.*)/\2\1\2/ : error: cannot create .lineno; rerun with a POSIX shell
But this is not surprising.
If the configure fails, from a fresh Gambit distribution directory you = could:
- Create a new include/gambit.h file with
echo #ifndef ___VOIDSTAR_WIDTH > include/gambit.h echo #define ___VOIDSTAR_WIDTH ___LONG_WIDTH >> include/gambit.h echo #endif >> include/gambit.h echo #ifndef ___MAX_CHR >> include/gambit.h echo #define ___MAX_CHR 0x10ffff >> include/gambit.h echo #endif >> include/gambit.h cat include/gambit.h.in >> include/gambit.h
Usually the gambit.h file is created by the configure script, but here = we'll avoid using the configure script because it may have issues on = plan9.
- In lib/ compile all the .c files to .o files using -D___LIBRARY and =
-D___PRIMAL and -D___HAVE_STDIO_H and -D___HAVE_STDLIB_H. Some of the = files (os*.c) are operating system dependent, so most of your problems = will be in compiling these files. By default, only stdio functions will = be called for I/O and only malloc/free are used for memory allocation. = Obviously you won't have a bunch of functionality such as sockets, = process ports, time measurement, etc but these can be ported one by one = as the need arises by adding the appropriate -DHAVE_XXX and adapting the = os*.c files.
term% pcc -I../include -D___LIBRARY -D___PRIMAL -D___HAD_STDLIB_H *.c cpp: _eval.c:645 Unknown preprocessor control f cpp: ../include/gambit.h:748 _eval.c:661 Could not find include file <wchar.h> cpp: ../include/gambit.h:833 _eval.c:661 Bad operator (@) in #if/#elif cpp: ../include/gambit.h:1654 _eval.c:661 Bad operator (@) in #if/#elif cpp: ../include/gambit.h:1657 _eval.c:661 Bad operator (@) in #if/#elif cpp: ../include/gambit.h:1678 _eval.c:661 Bad operator (@) in #if/#elif /usr/bakul/gambit/lib/../include/gambit.h:7250[stdin:6880] syntax error, last name: wchar_t pcc: cpp: 8c 212: error
Once step #2 is completed, you are almost done!
Looks like the port will require some real work! That'll have to wait for some other time.
Nevertheless, thanks for the hints.
Bakul
On 2013-02-12, at 3:06 PM, Bakul Shah bakul@bitblocks.com wrote:
term% pcc -I../include -D___LIBRARY -D___PRIMAL -D___HAD_STDLIB_H *.c cpp: _eval.c:645 Unknown preprocessor control f cpp: ../include/gambit.h:748 _eval.c:661 Could not find include file <wchar.h> cpp: ../include/gambit.h:833 _eval.c:661 Bad operator (@) in #if/#elif cpp: ../include/gambit.h:1654 _eval.c:661 Bad operator (@) in #if/#elif cpp: ../include/gambit.h:1657 _eval.c:661 Bad operator (@) in #if/#elif cpp: ../include/gambit.h:1678 _eval.c:661 Bad operator (@) in #if/#elif /usr/bakul/gambit/lib/../include/gambit.h:7250[stdin:6880] syntax error, last name: wchar_t pcc: cpp: 8c 212: error
Hmmm... you should have said -D___HAVE_... not -D___HAD_... and added -D___HAVE_STDIO_H but that is probably not the issue here. I'm assuming plan9 does have stdlib.h and stdio.h .
Since plan9 doesn't seem to have a wchar.h file, then please try again with in addition: -D___DONT_HAVE_WCHAR_H .
Marc