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