~ chicken-core (chicken-5) /README
Trap1
2
3
4 _/_/_/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/_/ _/ _/
5 _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/
6 _/ _/_/_/_/ _/ _/ _/_/ _/_/_/ _/ _/ _/
7_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/
8 _/_/_/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/_/ _/ _/
9
10
11
12 README file for the CHICKEN Scheme system
13 =========================================
14
15
16 (c) 2008-2022, The CHICKEN Team
17 (c) 2000-2007, Felix L. Winkelmann
18
19 version 5.4.1
20
21
22 1. Introduction
23
24 CHICKEN is a Scheme-to-C compiler supporting the language
25 features as defined in the 'Revised^5 Report on
26 Scheme'. Separate compilation is supported and full
27 tail-recursion and efficient first-class continuations are
28 available.
29
30 Some things that CHICKEN has to offer:
31
32 1. CHICKEN generates quite portable C code and compiled files
33 generated by it (including itself) should work without any
34 changes on Windows, most UNIX-like platforms, and with
35 minor changes on other systems.
36
37 2. The whole package is distributed under a BSD style license
38 and as such is free to use and modify as long as you agree
39 to its terms.
40
41 3. Linkage to C modules and C library functions is
42 straightforward. Compiled programs can easily be embedded
43 into existing C code.
44
45 4. Loads of extra libraries.
46
47 Note: Should you have any trouble in setting up and using
48 CHICKEN, please ask questions on the CHICKEN users mailing
49 list. Check http://wiki.call-cc.org/discussion-groups for
50 information on how to subscribe to CHICKEN mailing lists.
51
52
53 2. Installation
54
55 Building CHICKEN requires GNU Make. Other "make" derivates are
56 not supported. If you are using a Windows system and do not
57 have GNU Make, download
58 http://www.call-with-current-continuation.org/tarballs/UnxUtils.zip.
59 It contains a precompiled set of UNIX utilities, which among
60 other useful tools contains "make".
61
62 Configuration and customization of the build process is done by
63 either setting makefile variables on the "make" command line or
64 by editing the platform-specific makefile.
65
66 2.1. Building from a release tarball
67
68 To build CHICKEN, first extract the archive ("tar xzf
69 chicken-<version>.tar.gz" on UNIX or use your favorite
70 extraction program on Windows), then change to the
71 chicken-<version> directory and invoke "make" like this:
72
73 make PLATFORM=<platform> PREFIX=<destination>
74
75 where "PLATFORM" specifies on what kind of system CHICKEN
76 shall be built and "PREFIX" specifies where the executables
77 and libraries shall be installed. Out-of-directory builds are
78 currently not supported, so you must be in the toplevel source
79 directory to invoke "make".
80
81 If you enter "make" without the PLATFORM option, CHICKEN will
82 attempt to figure out what platform you are using. If it cannot
83 do so, you will see a list of supported platforms. If you are
84 cross-building, you must specify PLATFORM; for example,
85 PLATFORM=cross-linux-mingw will build CHICKEN on Linux to
86 deploy on Windows.
87
88 If CHICKEN somehow detects the wrong platform, type
89
90 make PLATFORM=""
91
92 to get a list of available platforms, and re-run "make" using
93 the correct platform.
94
95 Note that parallel builds (using the "-j" make(1) option) are
96 *not* supported.
97
98 If you invoke "make" later with different configuration parameters,
99 it is advisable to run:
100
101 make confclean
102
103 to remove old configuration files.
104
105 2.2. Building from Git
106
107 If you build CHICKEN directly from the development sources out
108 of the git repository, you will need a "chicken" executable to
109 generate the compiled C files from the Scheme library sources.
110 See section 2.1 for platform detection issues.
111
112 If you are building in a checkout where you have built other
113 versions of chicken, you need to make sure that all traces of
114 the previous build are removed. "make clean" is insufficient,
115 and you should do the following:
116
117 make spotless
118
119 You will need to have a "chicken" binary installed, ideally
120 from the development snapshot tarball that is closest to the
121 git version you are trying to build (significantly older or
122 newer ones are unlikely to work), and then use that chicken
123 to build from your git sources. Installing this CHICKEN is
124 recommended, if necessary you can install it to a temporary
125 location in your homedir for example.
126
127 Then, to build you can run:
128
129 make CHICKEN=<install-dir>/bin/chicken
130
131 In some cases, the sources may have diverged enough to
132 become unbuildable even with the snapshot. Then you'll need
133 to first build a bootstrapping compiler with the installed
134 CHICKEN and then use that to build the version from git.
135 See the "Bootstrapping" section below.
136
137 2.3. Finishing the installation
138
139 If CHICKEN is built successfully, you can install it on your
140 system by entering
141
142 make PREFIX=<destination> install
143
144 "PREFIX" defaults to "/usr/local". Note that the PREFIX is
145 compiled into several CHICKEN tools and must be the same
146 while building the system and during installation.
147
148 To install CHICKEN for a particular PREFIX on a different
149 location, set the "DESTDIR" variable in addition to "PREFIX":
150 It designates the directory where the files are installed
151 into.
152
153 2.4. Verifying your installation is correct
154
155 You can check whether CHICKEN is functioning correctly by
156 running
157
158 make <vars> check
159
160 where <vars> are all the variables you used while building
161 CHICKEN.
162
163 This will run the test scripts, which show a lot of output.
164 The only thing that matters is the exit status at the end.
165 If it exits with status 0, everything is fine, if it exits
166 with a nonzero status, the failing test's output should be
167 the final lines before Make's "error; exit" output. If the
168 check fails on unmodified sources, please file a bugreport.
169
170 2.5. Optional features
171
172 You can further enable various optional features by adding
173 one or more of the following variables to the "make"
174 invocation:
175
176 DEBUGBUILD=1
177 Disable optimizations in compiled C code and enable
178 debug information.
179
180 STATICBUILD=1
181 Build only static versions of the runtime library, compiler
182 and interpreter.
183
184 EXTRA_CHICKEN_OPTIONS=...
185 Additional options that should be passed to `chicken' when
186 building the system.
187
188 C_COMPILER_OPTIMIZATION_OPTIONS=...
189 Override built-in C compiler optimization options. Available
190 for debug or release build.
191
192 PROGRAM_PREFIX=
193 A prefix to prepend to the names of all generated executables.
194 This allows having multiple CHICKEN versions in your PATH
195 (but note that they have to be installed at different locations).
196
197 PROGRAM_SUFFIX=
198 A suffix to be appended to the names of all generated executables.
199
200 HOSTSYSTEM=
201 A "<machine>-<platform>" name prefix to use for the C compiler to
202 use to compile the runtime system and executables. Set this variable
203 if you want to compile CHICKEN for a different architecture than
204 the one on which you are building it.
205
206 TARGETSYSTEM=
207 Similar to "HOSTSYSTEM", but specifies the name
208 prefix to use for compiling code with the "csc" compiler
209 driver. This is required for creating a "cross chicken", a
210 specially built CHICKEN that invokes a cross C compiler to
211 build the final binaries. You will need a cross compiled
212 runtime system by building a version of CHICKEN with the
213 "HOST" option mentioned above. More information about this
214 process and the variables that you should set are provided
215 in the manual (see the "Cross development" chapter).
216
217 SRCDIR=
218 Specifies that CHICKEN should be built outside of its source
219 tree. The SRCDIR variable indicates the location of the
220 CHICKEN source tree. The executables and object files will
221 be generated in the current directory.
222
223 VARDIR=
224 If set, this directory overrides the location where
225 extensions along with their metadata are stored. Normally
226 this will be equivalent to "<PREFIX>/lib/chicken/<BINARYVERSION>".
227 When VARDIR is specified, extensions will be stored in
228 "<VARDIR>/chicken/<BINARYVERSION>", conforming to the FHS.
229
230 CONFIG=
231 If you build CHICKEN often, passing all those make variables
232 can get annoying. An alternative is to create a configuration
233 file defining the required variables and passing
234 "CONFIG=<configfile>" to make(1).
235 Even simpler is editing the included "config.make"
236 and just invoke make(1) without any extra parameters.
237
238 C_COMPILER=
239 You can select an alternative compiler by setting this variable.
240 The default compiler is "gcc". CHICKEN can be built with the
241 LLVM version of gcc and with "clang", the LLVM-based C compiler,
242 just set C_COMPILER to "llvm-gcc" or "clang".
243
244 LINKER=
245 Selects the linker to be used for creating executables and
246 dynamic libraries from compiled C code. This should normally
247 be the same as C_COMPILER.
248
249 PROFILE_OBJECTS=
250 This variable allows you to profile (parts of) CHICKEN itself.
251 Just pass in a whitespace-separated list of objects, without
252 the .scm-extension. (An "object" here is an individual
253 .scm-file which gets compiled to a .c-file)
254 To build with profiling support, run "make spotless" first.
255 Be warned that this is a highly experimental option and
256 profiling doesn't work for every component of CHICKEN.
257
258 2.6. Uninstalling CHICKEN
259
260 To remove CHICKEN from your file-system, enter (probably as
261 root):
262
263 make PREFIX=<destination> uninstall
264
265 (If you gave DESTDIR during installation, you have to pass
266 the same setting to "make" when uninstalling)
267
268 2.7. What gets installed
269
270 These files will be installed under the prefix given during
271 build and installation:
272
273 <PREFIX>
274 |-- bin
275 | |-- chicken
276 | |-- chicken-install
277 | |-- chicken-profile
278 | |-- chicken-status
279 | |-- chicken-uninstall
280 | |-- libchicken.dll (Windows)
281 | |-- csc
282 | |-- csi
283 | |-- feathers.bat (Windows)
284 | `-- feathers (Unix)
285 |-- include
286 | `-- chicken
287 | |-- chicken-config.h
288 | `-- chicken.h
289 |-- lib
290 | |-- chicken
291 | | `-- 9
292 | | |-- chicken.base.import.so
293 | | |-- chicken.bitwise.import.so
294 | | |-- chicken.blob.import.so
295 | | |-- chicken.compiler.user-pass.import.so
296 | | |-- chicken.condition.import.so
297 | | |-- chicken.continuation.import.so
298 | | |-- chicken.csi.import.so
299 | | |-- chicken.errno.import.so
300 | | |-- chicken.eval.import.so
301 | | |-- chicken.file.import.so
302 | | |-- chicken.file.posix.import.so
303 | | |-- chicken.fixnum.import.so
304 | | |-- chicken.flonum.import.so
305 | | |-- chicken.foreign.import.so
306 | | |-- chicken.format.import.so
307 | | |-- chicken.gc.import.so
308 | | |-- chicken.internal.import.so
309 | | |-- chicken.io.import.so
310 | | |-- chicken.irregex.import.so
311 | | |-- chicken.keyword.import.so
312 | | |-- chicken.load.import.so
313 | | |-- chicken.locative.import.so
314 | | |-- chicken.memory.import.so
315 | | |-- chicken.memory.representation.import.so
316 | | |-- chicken.pathname.import.so
317 | | |-- chicken.platform.import.so
318 | | |-- chicken.plist.import.so
319 | | |-- chicken.port.import.so
320 | | |-- chicken.pretty-print.import.so
321 | | |-- chicken.process.import.so
322 | | |-- chicken.process.signal.import.so
323 | | |-- chicken.process-context.import.so
324 | | |-- chicken.process-context.posix.import.so
325 | | |-- chicken.random.import.so
326 | | |-- chicken.repl.import.so
327 | | |-- chicken.sort.import.so
328 | | |-- chicken.string.import.so
329 | | |-- chicken.read-syntax.import.so
330 | | |-- chicken.syntax.import.so
331 | | |-- chicken.tcp.import.so
332 | | |-- chicken.time.import.so
333 | | |-- chicken.time.posix.import.so
334 | | |-- modules.db
335 | | |-- srfi-4.import.so
336 | | `-- types.db
337 | |-- libchicken.a
338 | |-- libchicken.dll.a (Windows)
339 | |-- libchicken.dylib (Macintosh)
340 | |-- libchicken.so -> libchicken.so.11 (Unix)
341 | `-- libchicken.so.11 (Unix)
342 `-- share
343 |-- chicken
344 | |-- doc
345 | | |-- LICENSE
346 | | |-- README
347 | | |-- DEPRECATED
348 | | |-- manual-html
349 | | |-- chicken.png
350 | | `-- *.html
351 | |-- chicken.rc.o (Windows)
352 | |-- feathers.tcl
353 | `-- setup.defaults
354 `-- man
355 `-- man1
356 |-- chicken-install.1
357 |-- chicken-profile.1
358 |-- chicken-status.1
359 |-- chicken-uninstall.1
360 |-- chicken.1
361 |-- csc.1
362 |-- csi.1
363 `-- feathers.1
364
365
366 3. Usage
367
368 Documentation can be found in the directory
369 PREFIX/share/chicken/doc in HTML format. The manual is
370 maintained in a wiki at http://wiki.call-cc.org. Go there to
371 read the most up to date documentation.
372
373
374 4. Extensions
375
376 A large number of extension libraries for CHICKEN are
377 available at http://wiki.call-cc.org/eggs. You can
378 automatically download, compile and install extensions with
379 the "chicken-install" program. See the CHICKEN User's Manual
380 for more information.
381
382 A selection of 3rd party libraries, together with source and
383 binary packages for tools helpful for development with CHICKEN
384 are also available at:
385 <http://www.call-with-current-continuation.org/tarballs/>.
386
387
388 5. Platform issues
389
390 Android:
391
392 - The Android SDK and NDK are required. Make sure you have
393 set up a project and have a suitable NDK toolchain
394 available. You will have to override the make(1) variable
395 C_COMPILER to contain the correct compiler; see
396 docs/STANDALONE-TOOLCHAIN.html in your NDK root for notes
397 on how to call the correct compiler. You will also need to
398 override the ARCH variable to match the device you're
399 targeting. The build will produce a libchicken.so that
400 can then be integrated into your project as a prebuilt
401 shared library. See the android section on
402 http://wiki.call-cc.org/embedding for a complete example.
403
404 - It is possible to use eggs, by copying them into the right
405 place and probably renaming the files. This is somewhat
406 awkward and requires various hacks to make the
407 loading/linking of eggs work. It may be easier to build
408 the eggs you need manually and linking them statically to
409 your executable.
410
411 - By default debug-logging is enabled and written to the
412 Android log.
413
414 FreeBSD/NetBSD/OpenBSD:
415
416 - *BSD system users *must* use GNU make ("gmake") - the makefiles
417 can not be processed by BSD make.
418
419 - On NetBSD it might be possible that compilation fails with a
420 "virtual memory exhausted error". Try the following:
421
422 % unlimit datasize
423
424 - When using -deploy on NetBSD, currently the kernel only
425 supports running the program through its absolute path,
426 otherwise you will get an error message stating:
427
428 execname not specified in AUX vector: No such file or directory
429
430 Deployed binaries can also be run without an explicit path,
431 through $PATH; only relative pathnames do not work.
432
433 - Using external libraries on NetBSD may also be easier, if
434 you add the following definitions to `Makefile.bsd':
435
436 C_COMPILER_OPTIONS += -I/usr/pkg/lib
437 LINKER_OPTIONS += -L/usr/pkg/lib -Wl,-rpath=/usr/pkg/lib
438
439 Note that this may cause build-problems, if you already have
440 an existing CHICKEN installation in the /usr/pkg prefix.
441
442 Linux:
443
444 - If you want to build Linux binaries which use the "X32 ABI",
445 you can pass ARCH=x32 on the Make command line.
446
447 - There have been reports where the library directory
448 "/usr/lib64" could not be found at build-time on a Fedora
449 12 system. If you build a 64-bit version of CHICKEN and
450 the library directory is set incorrectly, you can override
451 it by passing "LIBDIR=/usr/lib64" as an additional
452 argument when you invoke "make".
453
454 Solaris:
455
456 - By default, CHICKEN is build with the GNU C compiler (`gcc').
457 To use the SunPro C compiler (`cc') instead, pass
458
459 C_COMPILER=cc
460
461 to the "make" invocation.
462
463 - Older versions of Solaris have a bug in ld.so that causes
464 trouble with dynamic loading. Patching Solaris fixes the
465 problem. Solaris 7 needs patch 106950-18. Solaris 8 has an
466 equivalent patch, 109147-16.
467
468 You can find out if you have these patches installed by
469 running:
470
471 % showrev -p | grep 106950 # solaris 7
472 % showrev -p | grep 109147 # solaris 8
473
474 Mac OS X:
475
476 - The build currently assumes the C toolchain is in the path,
477 use the "xcode-select(1)" tool to make them available on the
478 command line if you haven't already done so.
479
480 - CHICKEN will normally select a 32-bit or 64-bit build
481 automatically when you use the normal build step:
482
483 make
484
485 Specifically, the defaults are:
486
487 10.4: 32-bit
488 10.5: 32-bit
489 10.6: 64-bit (32-bit on original Core Duo, circa early 2006)
490 10.7: 64-bit
491
492 On 10.5, you can optionally build in 64-bit mode on machines
493 released in late 2006 or later (i.e. with a Core 2 Duo or Xeon
494 CPU), by specifying ARCH=x86-64:
495
496 make ARCH=x86-64
497
498 - Universal binaries: On 10.4 and 10.5 only, CHICKEN and its eggs
499 can be built as universal binaries which will work on either
500 Intel or PowerPC. Most users will not want to do this.
501
502 For 10.4 universal build:
503 make ARCH=universal
504
505 For 10.5 universal build:
506 export MACOSX_DEPLOYMENT_TARGET=10.4
507 make C_COMPILER=gcc-4.0 ARCH=universal
508
509 For 10.6 and later, universal builds are not supported.
510
511 - On 10.3 and earlier, you must first install `dlcompat'
512 which can be found at http://distfiles.macports.org/dlcompat/.
513
514
515 iOS:
516
517 - Make sure the "XCODE_PATH" setting is correct (see
518 Makefile.ios), it defaults to "/Applications/Xcode.app".
519
520 - The paths for the various build tools changed between
521 Xcode 4 and 5. The makefile used for iOS builds of CHICKEN
522 assume Xcode 5 is used. If you are using Xcode 4, override
523 the XCODE_TOOLPATH and C_COMPILER make-variables providing
524 the correct paths, see Makefile.ios for suggestions.
525
526 - The iOS build is static (iOS doesn't support dynamic
527 loading of executable code). Only the runtime library
528 (libchicken.a) is of interest. To use it, integrate
529 libchicken.a in your Xcode project and use a normal MacOS
530 build to compile your Scheme sources into C files, adding
531 them to you project.
532
533 - Core library units must by accessed via "(declare (uses
534 ...))" and "(import ...)", "require", "require-library",
535 "require-extension" and "use" will not work, due to the
536 reasons mentioned above.
537
538 - As dynamic loading is not supported, eggs can not be used
539 as usual, you will have to compile them manually and
540 integrate what you need into your project.
541
542 - If you want to build for the iPhone Simulator, override
543 the ARCH and XCODE_SDK variables accordingly, see also in
544 Makefile.ios for suggestions.
545
546 Windows:
547
548 - On Windows, mingw32, <http://mingw.sourceforge.net/> and
549 Cygwin are supported (Microsoft Visual Studio is *NOT*).
550 Makefiles for mingw under MSYS and the Windows shell are
551 provided (`Makefile.mingw-msys' and `Makefile.mingw').
552 Please also read the notes below.
553
554 - When installing under the mingw-msys platform, PREFIX must be an
555 absolute path name (i.e. it must include the drive letter) and
556 must use forward slashes (no backward slashes), for example
557 "PREFIX=C:/chicken/".
558
559 - When installing under mingw, with a windows shell
560 ("cmd.exe"), pass an absolute pathname (including the
561 drive letter) as PREFIX and use forward slashes. If you
562 are building the sources from git, use backslashes to
563 specify the path to `chicken' (the "CHICKEN" variable).
564
565 - When installing under mingw without MSYS, make sure that the
566 MSYS tools (in case you have some of them, in particular the
567 sh.exe UNIX shell) are *NOT* visible in your PATH.
568
569 - 64-bit Windows is supported, invoke mingw32-make with the
570 "ARCH=x86-64" argument (this is currently not detected
571 automatically). The build has been tested on Windows 7
572 with the SJLJ binary package from "MinGW-builds", which
573 can be found here:
574
575 http://sourceforge.net/projects/mingwbuilds/
576
577 - Cygwin will not be able to find the chicken shared libraries
578 until Windows is rebooted.
579
580 - During "make check" you may see these intermittent errors:
581
582 ld.exe: cannot open output file a.out: Permission denied
583
584 When this happens, the virusscanner is holding open
585 the file of the previous test while the compiler is
586 preparing the next test.
587 To work around this in Windows Defender (the default),
588 disable "realtime protection" under tools->options.
589
590 AIX:
591
592 - CHICKEN is built with the GNU C compiler (`gcc'). IBM's XL
593 C compiler is not supported at this time.
594
595 - AIX users *must* use GNU make ("gmake") - the makefiles can not be
596 processed with IBM's version of make.
597
598 - Deployment doesn't work. See manual/Deployment for more details.
599
600 - The AIX linker may occasionally show warnings of the form:
601
602 ld: 0711-783 WARNING: TOC overflow. TOC size: 66656
603 Maximum size: 65536
604 Extra instructions are being generated for each reference to a TOC
605 symbol if the symbol is in the TOC overflow area.
606
607 Such messages indicate that lookups for some symbols in the
608 effected library/executable may be somewhat slower at runtime as an
609 auxiliary symbol table is needed to accommodate all of the symbols.
610
611 - The AIX assembler may show warnings of the form:
612
613 /tmp//ccycPGzK.s: line 527244: 1252-171 The displacement must be
614 greater than or equal to -32768 and less than or equal to 32767.
615
616 This is a known issue between the GNU toolchain and IBM's assembler:
617
618 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4587
619
620 The problem arises because the PPC architecture cannot perform jumps
621 to addresses that differ more than what a 16-bit integer can
622 represent. Adding support for IBM's XL C compiler may resolve this
623 issue.
624
625 Instructing gcc to optimize the size of generated code (-Os)
626 mitigates this to some degree, but very large C files may still be
627 uncompilable. This is known to affect the html-tags egg.
628
629 Haiku:
630
631 - The default GCC compiler is too old to support the -fwrapv
632 option. You can either remove the flag from Makefile.haiku,
633 use a newer GCC, or supply your own C_COMPILER_OPTIONS on
634 the Make command line.
635
636 - The default Haiku BFS file system only supports timestamps
637 with a granularity of one second. This may cause trouble
638 with pregenerated release or development snapshot tarballs
639 due to the way files are pre-translated to C. You'll either
640 need to have CHICKEN installed, or touch the
641 build-version.c file before building.
642
643
644 6. Bootstrapping
645
646 To build a bootstrapping compiler yourself, get the most
647 recent development snapshot tarball from
648 http://code.call-cc.org, unpack it, build and install it.
649 Then change to the directory containing the git code and run:
650
651 make CHICKEN=<path-to-existing-chicken> \
652 boot-chicken
653
654 This will produce a statically linked binary with the name
655 "chicken-boot[.exe]" that can be given as the value of the
656 "CHICKEN" argument when invoking make(1). Note that the path
657 to an existing `chicken' binary must be given to use it for
658 compiling the Scheme code of the runtime-system and compiler.
659
660 "scripts/bootstrap.sh" automates this process; use this script
661 if you are unsure how to build from the repository sources. It
662 downloads the necessary development snapshot with wget(1) and
663 builds the boot-chicken that you can use to compile the
664 development sources. The invocation is:
665
666 scripts/bootstrap.sh ...
667
668 You can add additional parameters if you like to customize the
669 build, but this should not be necessary. Note that your current
670 working directory must be the root directory of the CHICKEN
671 git(1) repository. Once the boot-chicken is built, proceed by
672 invoking make(1) as described above (in 2.2, Building from Git),
673 with the additional parameter:
674
675 make CHICKEN=./chicken-boot ...
676
677
678 7. Emacs support
679
680 See http://wiki.call-cc.org/emacs for tips and links to emacs
681 extensions for Scheme and CHICKEN programming.
682
683
684 8. What's next?
685
686 If you find any bugs, or want to report a problem, please send
687 a detailed bug report.
688
689 If you have any more questions or problems (even the slightest
690 problems, or the most stupid questions), then please subscribe
691 to the "chicken-users"
692 (http://lists.nongnu.org/mailman/listinfo/chicken-users)
693 mailing list and ask for help. It will be answered.