~ chicken-core (master) /README
Trap1234 _/_/_/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/_/ _/ _/5 _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/6 _/ _/_/_/_/ _/ _/ _/_/ _/_/_/ _/ _/ _/7_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/8 _/_/_/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/_/ _/ _/9101112 README file for the CHICKEN Scheme system13 =========================================141516 (c) 2008, The CHICKEN Team17 (c) 2000-2007, Felix L. Winkelmann1819 version 6.1.0202122 1. Introduction2324 CHICKEN is a Scheme-to-C compiler supporting the language25 features as defined in the 'Revised^5 Report on26 Scheme'. Separate compilation is supported and full27 tail-recursion and efficient first-class continuations are28 available.2930 Some things that CHICKEN has to offer:3132 1. CHICKEN generates quite portable C code and compiled files33 generated by it (including itself) should work without any34 changes on Windows, most UNIX-like platforms, and with35 minor changes on other systems.3637 2. The whole package is distributed under a BSD style license38 and as such is free to use and modify as long as you agree39 to its terms.4041 3. Linkage to C modules and C library functions is42 straightforward. Compiled programs can easily be embedded43 into existing C code.4445 4. Loads of extra libraries.4647 Note: Should you have any trouble in setting up and using48 CHICKEN, please ask questions on the CHICKEN users mailing49 list. Check http://wiki.call-cc.org/discussion-groups for50 information on how to subscribe to CHICKEN mailing lists.515253 2. Installation5455 Building CHICKEN requires GNU Make. Other "make" derivates are56 not supported.5758 Configuration and customization of the build process is done by59 either using the "configure" script, setting makefile variables60 on the "make" command line or by editing the platform-specific61 makefile.6263 2.1. Building from a release tarball6465 To build CHICKEN, first extract the archive ("tar xzf66 chicken-<version>.tar.gz" on UNIX or use your favorite67 extraction program on Windows), then change to the68 chicken-<version> directory and invoke "configure" like this:6970 ./configure [OPTION ...]7172 This will overwrite a configuration file for the subsequent73 "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 the76 results of the build should be installed:7778 ./configure --prefix $HOME/.local7980 If not given, the installation prefix defaults to "/usr/local".81 You can also define the build platform and whether you want to82 build with debug-information, in addition to other specialized83 settings. The platform is determined automatically if not84 specified.8586 Once you have configured the system you can start building it87 by entering8889 make9091 Note that GNU make is currently required, so use9293 gmake9495 On systems that use BSD make.9697 The old style invocation of "make" is still supported, where98 you pass platform and prefix information on the make command99 line, like this:100101 make PLATFORM=<platform> PREFIX=<destination>102103 Out-of-directory builds are currently not supported, so you must104 be in the toplevel source directory to invoke "configure" and105 "make".106107 If CHICKEN somehow detects the wrong platform, type108109 ./configure --platform=list110111 to get a list of available platforms, and re-run "configure" using112 the correct platform.113114 If you invoke "make" later with different configuration parameters,115 it is advisable to run:116117 make confclean118119 to remove old configuration files.120121 2.2. Building from Git122123 If you build CHICKEN directly from the development sources out124 of the git repository, you will need a "chicken" executable to125 generate the compiled C files from the Scheme library sources.126 See section 2.1 for platform detection issues.127128 Configuration is the same as when building from the distribution129 tarball. You may have to use the "--chicken" option to define130 which "chicken" compiler binary should be used to translate the131 Scheme source code in the repository:132133 ./configure --prefix ... --chicken <install-dir>/bin/chicken134135 If you do not want to use the "configure" script, create an empty136 "config.make", like this:137138 touch config.make139140 "Config.make" is required by the build process, even if it141 contains no settings.142143 If you are building in a checkout where you have built other144 versions of chicken, you need to make sure that all traces of145 the previous build are removed. "make clean" is insufficient,146 and you should do the following:147148 make spotless149150 You will need to have a "chicken" binary installed, ideally151 from the development snapshot tarball that is closest to the152 git version you are trying to build (significantly older or153 newer ones are unlikely to work), and then use that chicken154 to build from your git sources. Installing this CHICKEN is155 recommended, if necessary you can install it to a temporary156 location in your homedir for example.157158 In some cases, the sources may have diverged enough to159 become unbuildable even with the snapshot. Then you'll need160 to first build a bootstrapping compiler with the installed161 CHICKEN and then use that to build the version from git.162 See the "Bootstrapping" section below.163164 2.3. Verifying your installation is correct165166 You can check whether CHICKEN is functioning correctly by167 running168169 make check170171 This will run the test scripts, which show a lot of output.172 The only thing that matters is the exit status at the end.173 If it exits with status 0, everything is fine, if it exits174 with a nonzero status, the failing test's output should be175 the final lines before Make's "error; exit" output. If the176 check fails on unmodified sources, please file a bugreport.177178 2.4. Finishing the installation179180 If CHICKEN is built successfully, you can install it on your181 system by entering182183 make install184185 To install CHICKEN for a particular prefix on a different186 location, set the "DESTDIR" variable: It designates the187 directory where the files are installed into.188189 2.5. Optional features190191 You can further enable various optional features by adding192 one or more of the following variables to the "configure"193 invocation:194195 --debugbuild196 Disable optimizations in compiled C code and enable197 debug information.198199 --staticbuild200 Build only static versions of the runtime library, compiler201 and interpreter.202203 --program-prefix PREFIX204 A prefix to prepend to the names of all generated executables.205 This allows having multiple CHICKEN versions in your PATH206 (but note that they have to be installed at different locations).207208 --program-suffix SUFFIX209 A suffix to be appended to the names of all generated executables.210211 --host SYSTEM212 A "<machine>-<platform>" name prefix to use for the C compiler to213 use to compile the runtime system and executables. Set this variable214 if you want to compile CHICKEN for a different architecture than215 the one on which you are building it.216217 --target SYSTEM218 Similar to "HOSTSYSTEM", but specifies the name219 prefix to use for compiling code with the "csc" compiler220 driver. This is required for creating a "cross chicken", a221 specially built CHICKEN that invokes a cross C compiler to222 build the final binaries. You will need a cross compiled223 runtime system by building a version of CHICKEN with the224 "HOST" option mentioned above. More information about this225 process and the variables that you should set are provided226 in the manual (see the "Cross development" chapter).227228 --srcdir DIRECTORY229 Specifies that CHICKEN should be built outside of its source230 tree. The SRCDIR variable indicates the location of the231 CHICKEN source tree. The executables and object files will232 be generated in the current directory.233234 --vardir DIRECTORY235 If set, this directory overrides the location where236 extensions along with their metadata are stored. Normally237 this will be equivalent to "<PREFIX>/lib/chicken/<BINARYVERSION>".238 When VARDIR is specified, extensions will be stored in239 "<VARDIR>/chicken/<BINARYVERSION>", conforming to the FHS.240241 --staticlibdir DIRECTORY242 If set, the static runtime library (libchicken-static.a) is243 installed into this directory instead of "<PREFIX>/lib",244 and csc will look for it there when linking statically.245246 --c-compiler PROGRAM247 If set, determines the C compiler used to compiler C sources.248249 --linker PROGRAM250 Determines the executable used for linking compiled object files,251 usually the same as the C compiler executable.252253 --profile-object "FILENAME ..."254 This option allows you to profile (parts of) CHICKEN itself.255 Just pass in a whitespace-separated list of objects, without256 the .scm-extension. (An "object" here is an individual257 .scm-file which gets compiled to a .c-file)258 To build with profiling support, run "make spotless" first.259 Be warned that this is a highly experimental option and260 profiling doesn't work for every component of CHICKEN.261262 The "configure" script respects the "CC" and "CFLAGS" environment263 variables which allow overriding the C compiler to use and any264 additional C compiler flags that should be used when compiling265 the runtime system and C files generated by "chicken".266267 The default compiler is "gcc" ("cc" on *BSD systems). CHICKEN268 can be built with the LLVM version of gcc and with "clang",269 the LLVM-based C compiler, just set C_COMPILER to "llvm-gcc"270 or "clang". CHICKEN has also been successfully built with "zig cc",271 the C frontend of the "Zig" language toolchain.272273 Less frequently used settings are available by variables that can274 be passed on the "make" command line:275276 2.6. Uninstalling CHICKEN277278 To remove CHICKEN from your file-system, enter (probably as279 root):280281 make uninstall282283 (If you gave DESTDIR during installation, you have to pass284 the same setting to "make" when uninstalling)285286 2.7. What gets installed287288 These files will be installed under the prefix given during289 build and installation:290291 <PREFIX>292 |-- bin293 | |-- chicken294 | |-- chicken-install295 | |-- chicken-profile296 | |-- chicken-status297 | |-- chicken-uninstall298 | |-- libchicken.dll (Windows)299 | |-- csc300 | `-- csi301 |-- include302 | `-- chicken303 | |-- chicken-config.h304 | `-- chicken.h305 |-- lib306 | |-- chicken307 | | `-- 12308 | | |-- chicken.base.import.so309 | | |-- chicken.bitwise.import.so310 | | |-- chicken.bytevector.import.so311 | | |-- chicken.compiler.user-pass.import.so312 | | |-- chicken.condition.import.so313 | | |-- chicken.continuation.import.so314 | | |-- chicken.csi.import.so315 | | |-- chicken.errno.import.so316 | | |-- chicken.eval.import.so317 | | |-- chicken.file.import.so318 | | |-- chicken.file.posix.import.so319 | | |-- chicken.fixnum.import.so320 | | |-- chicken.flonum.import.so321 | | |-- chicken.foreign.import.so322 | | |-- chicken.format.import.so323 | | |-- chicken.gc.import.so324 | | |-- chicken.internal.import.so325 | | |-- chicken.io.import.so326 | | |-- chicken.irregex.import.so327 | | |-- chicken.keyword.import.so328 | | |-- chicken.load.import.so329 | | |-- chicken.locative.import.so330 | | |-- chicken.memory.import.so331 | | |-- chicken.memory.representation.import.so332 | | |-- chicken.pathname.import.so333 | | |-- chicken.platform.import.so334 | | |-- chicken.plist.import.so335 | | |-- chicken.port.import.so336 | | |-- chicken.pretty-print.import.so337 | | |-- chicken.process.import.so338 | | |-- chicken.process.signal.import.so339 | | |-- chicken.process-context.import.so340 | | |-- chicken.process-context.posix.import.so341 | | |-- chicken.random.import.so342 | | |-- chicken.repl.import.so343 | | |-- chicken.sort.import.so344 | | |-- chicken.string.import.so345 | | |-- chicken.read-syntax.import.so346 | | |-- chicken.syntax.import.so347 | | |-- chicken.tcp.import.so348 | | |-- chicken.time.import.so349 | | |-- chicken.time.posix.import.so350 | | |-- chicken.version.import.so351 | | |-- scheme.file.import.so352 | | |-- scheme.process-context.import.so353 | | |-- scheme.time.import.so354 | | |-- scheme.write.import.so355 | | |-- modules.db356 | | |-- srfi-4.import.so357 | | `-- types.db358 | |-- libchicken-static.a359 | |-- libchicken.dll.a (Windows)360 | |-- libchicken.dylib (Macintosh)361 | |-- libchicken.so -> libchicken.so.12 (Unix)362 | `-- libchicken.so.12 (Unix)363 `-- share364 |-- chicken365 | |-- doc366 | | |-- LICENSE367 | | |-- README368 | | |-- DEPRECATED369 | | |-- chicken.png370 | | |-- manual-html371 | | `-- *.html372 | |-- chicken.rc.o (Windows)373 | `-- setup.defaults374 `-- man375 `-- man1376 |-- chicken-install.1377 |-- chicken-profile.1378 |-- chicken-status.1379 |-- chicken-uninstall.1380 |-- chicken.1381 |-- csc.1382 `-- csi.1383384385 3. Usage386387 Documentation can be found in the directory388 PREFIX/share/chicken/doc in HTML format. The manual is389 maintained in a wiki at http://wiki.call-cc.org. Go there to390 read the most up to date documentation.391392393 4. Extensions394395 A large number of extension libraries for CHICKEN are396 available at http://wiki.call-cc.org/eggs. You can397 automatically download, compile and install extensions with398 the "chicken-install" program. See the CHICKEN User's Manual399 for more information.400401 A selection of 3rd party libraries, together with source and402 binary packages for tools helpful for development with CHICKEN403 are also available at:404 <http://www.call-with-current-continuation.org/tarballs/>.405406407 5. Platform issues408409 Android:410411 - The Android SDK and NDK are required. Make sure you have412 set up a project and have a suitable NDK toolchain413 available. You will have to override the make(1) variable414 C_COMPILER to contain the correct compiler; see415 docs/STANDALONE-TOOLCHAIN.html in your NDK root for notes416 on how to call the correct compiler. You will also need to417 override the ARCH variable to match the device you're418 targeting. The build will produce a libchicken.so that419 can then be integrated into your project as a prebuilt420 shared library. See the android section on421 http://wiki.call-cc.org/embedding for a complete example.422423 - It is possible to use eggs, by copying them into the right424 place and probably renaming the files. This is somewhat425 awkward and requires various hacks to make the426 loading/linking of eggs work. It may be easier to build427 the eggs you need manually and linking them statically to428 your executable.429430 - By default debug-logging is enabled and written to the431 Android log.432433 FreeBSD/NetBSD/OpenBSD:434435 - *BSD system users *must* use GNU make ("gmake") - the makefiles436 can not be processed by BSD make.437438 - On NetBSD it might be possible that compilation fails with a439 "virtual memory exhausted error". Try the following:440441 % unlimit datasize442443 - When using -deploy on NetBSD, currently the kernel only444 supports running the program through its absolute path,445 otherwise you will get an error message stating:446447 execname not specified in AUX vector: No such file or directory448449 Deployed binaries can also be run without an explicit path,450 through $PATH; only relative pathnames do not work.451452 - Using external libraries on NetBSD may also be easier, if453 you add the following definitions to `Makefile.bsd':454455 C_COMPILER_OPTIONS += -I/usr/pkg/lib456 LINKER_OPTIONS += -L/usr/pkg/lib -Wl,-rpath=/usr/pkg/lib457458 Note that this may cause build-problems, if you already have459 an existing CHICKEN installation in the /usr/pkg prefix.460461 Linux:462463 - If you want to build Linux binaries which use the "X32 ABI",464 you can pass ARCH=x32 on the Make command line.465466 - There have been reports where the library directory467 "/usr/lib64" could not be found at build-time on a Fedora468 12 system. If you build a 64-bit version of CHICKEN and469 the library directory is set incorrectly, you can override470 it by passing "LIBDIR=/usr/lib64" as an additional471 argument when you invoke "make".472473 Solaris:474475 - By default, CHICKEN is build with the GNU C compiler (`gcc').476 To use the SunPro C compiler (`cc') instead, override the477 used compiler like this:478479 CC=cc ./configure ...480481 - Older versions of Solaris have a bug in ld.so that causes482 trouble with dynamic loading. Patching Solaris fixes the483 problem. Solaris 7 needs patch 106950-18. Solaris 8 has an484 equivalent patch, 109147-16.485486 You can find out if you have these patches installed by487 running:488489 % showrev -p | grep 106950 # solaris 7490 % showrev -p | grep 109147 # solaris 8491492 Mac OS X:493494 - The build currently assumes the C toolchain is in the path,495 use the "xcode-select(1)" tool to make them available on the496 command line if you haven't already done so.497498 - CHICKEN will normally select a 32-bit or 64-bit build499 automatically when you use the normal build step:500501 make502503 Specifically, the defaults are:504505 10.4: 32-bit506 10.5: 32-bit507 10.6: 64-bit (32-bit on original Core Duo, circa early 2006)508 10.7: 64-bit509510 On 10.5, you can optionally build in 64-bit mode on machines511 released in late 2006 or later (i.e. with a Core 2 Duo or Xeon512 CPU), by specifying ARCH=x86-64:513514 make ARCH=x86-64515516 - Universal binaries: On 10.4 and 10.5 only, CHICKEN and its eggs517 can be built as universal binaries which will work on either518 Intel or PowerPC. Most users will not want to do this.519520 For 10.4 universal build:521 make ARCH=universal522523 For 10.5 universal build:524 export MACOSX_DEPLOYMENT_TARGET=10.4525 make C_COMPILER=gcc-4.0 ARCH=universal526527 For 10.6 and later, universal builds are not supported.528529 - On 10.3 and earlier, you must first install `dlcompat'530 which can be found at http://distfiles.macports.org/dlcompat/.531532 iOS:533534 - Make sure the "XCODE_PATH" setting is correct (see535 Makefile.ios), it defaults to "/Applications/Xcode.app".536537 - The paths for the the various build tools changed between538 Xcode 4 and 5. The makefile used for iOS builds of CHICKEN539 assume Xcode 5 is used. If you are using Xcode 4, override540 the XCODE_TOOLPATH and C_COMPILER make-variables providing541 the correct paths, see Makefile.ios for suggestions.542543 - The iOS build is static (iOS doesn't support dynamic544 loading of executable code). Only the runtime library545 (libchicken.a) is of interest. To use it, integrate546 libchicken.a in your Xcode project and use a normal MacOS547 build to compile your Scheme sources into C files, adding548 them to you project.549550 - Core library units must by accessed via "(declare (uses551 ...))" and "(import ...)", "require", "require-library",552 "require-extension" and "use" will not work, due to the553 reasons mentioned above.554555 - As dynamic loading is not supported, eggs can not be used556 as usual, you will have to compile them manually and557 integrate what you need into your project.558559 - If you want to build for the iPhone Simulator, override560 the ARCH and XCODE_SDK variables accordingly, see also in561 Makefile.ios for suggestions.562563 Windows:564565 - On Windows, native builds using the "MingW" toolchain and566 Cygwin are supported (Microsoft Visual Studio is *NOT*).567 Makefiles for MingW are provided (`Makefile.MingW').568 GNU make and a POSIX sh(1) are required to build the system.569 Please also read the notes below.570571 - Since there are various distributions of the MingW toolchain572 we recommend to use "w64devkit" by Chrstopher Wellons:573574 https://github.com/skeeto/w64devkit575576 This toolset is very complete, includes GNU make and a577 POSIX shell and is the development environment we use to578 test CHICKEN. Other distributions of MingW may work but579 are not tested by us.580581 - When installing under the MingW platform, PREFIX must be an582 absolute path name (i.e. it must include the drive letter) and583 must use forward slashes (no backward slashes), for example584585 ./configure --prefix C:/chicken/586587 - Under MingW, the "csc" compiler driver and "chicken-install"588 expect the compiler executable and the usual UNIX tools are589 in the PATH, so make sure to run them inside a shell that590 provides the necessary stuff.591592 - Cygwin will not be able to find the chicken shared libraries593 until Windows is rebooted.594595 - During "make check" you may see these intermittent errors:596597 ld.exe: cannot open output file a.out: Permission denied598599 When this happens, the virusscanner is holding open600 the file of the previous test while the compiler is601 preparing the next test.602 To work around this in Windows Defender (the default),603 disable "realtime protection" under tools->options.604605 AIX:606607 - CHICKEN is built with the GNU C compiler (`gcc'). IBM's XL608 C compiler is not supported at this time.609610 - AIX users *must* use GNU make ("gmake") - the makefiles can not be611 processed with IBM's version of make.612613 - Deployment doesn't work. See manual/Deployment for more details.614615 - The AIX linker may occasionally show warnings of the form:616617 ld: 0711-783 WARNING: TOC overflow. TOC size: 66656618 Maximum size: 65536619 Extra instructions are being generated for each reference to a TOC620 symbol if the symbol is in the TOC overflow area.621622 Such messages indicate that lookups for some symbols in the623 effected library/executable may be somewhat slower at runtime as an624 auxiliary symbol table is needed to accommodate all of the symbols.625626 - The AIX assembler may show warnings of the form:627628 /tmp//ccycPGzK.s: line 527244: 1252-171 The displacement must be629 greater than or equal to -32768 and less than or equal to 32767.630631 This is a known issue between the GNU toolchain and IBM's assembler:632633 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4587634635 The problem arises because the PPC architecture cannot perform jumps636 to addresses that differ more than what a 16-bit integer can637 represent. Adding support for IBM's XL C compiler may resolve this638 issue.639640 Instructing gcc to optimize the size of generated code (-Os)641 mitigates this to some degree, but very large C files may still be642 uncompilable. This is known to affect the html-tags egg.643644 Haiku:645646 - The default GCC compiler is too old to support the -fwrapv647 option. You can either remove the flag from Makefile.haiku,648 use a newer GCC, or supply your own C_COMPILER_OPTIONS on649 the Make command line.650651 - The default Haiku BFS file system only supports timestamps652 with a granularity of one second. This may cause trouble653 with pregenerated release or development snapshot tarballs654 due to the way files are pre-translated to C. You'll either655 need to have CHICKEN installed, or touch the656 build-version.c file before building.657658659 6. Bootstrapping660661 To build a bootstrapping compiler yourself, get the most662 recent development snapshot tarball from663 http://code.call-cc.org, unpack it, build and install everything.664 Then change to the directory containing the git code and run:665666 ./configure --chicken <path-to-existing-chicken>667 make boot-chicken668669 This will produce a statically linked binary with the name670 "chicken-boot[.exe]" that can be given as the value of the671 "--chicken" configuration option. Note that the path to an672 existing `chicken' binary must be given to use it for673 compiling the Scheme code of the runtime-system and compiler.674675 "scripts/bootstrap.sh" automates this process; use this script676 if you are unsure how to build from the repository sources. It677 downloads the necessary development snapshot with wget(1) and678 builds the boot-chicken that you can use to compile the679 development sources. The invocation is:680681 ./scripts/bootstrap.sh ...682683 You can add additional parameters if you like to customize the684 build, but this should not be necessary. Note that your current685 working directory must be the root directory of the CHICKEN686 git(1) repository. Once the boot-chicken is built, proceed by687 invoking make(1) as described above (in 2.2, Building from Git),688 with the additional parameter:689690 make CHICKEN=./chicken-boot ...691692 or run "configure" again:693694 ./configure --chicken ./chicken-boot ...695 make696697698 7. Emacs support699700 See http://wiki.call-cc.org/emacs for tips and links to emacs701 extensions for Scheme and CHICKEN programming.702703704 8. What's next?705706 If you find any bugs, or want to report a problem, please send707 a detailed bug report.708709 If you have any more questions or problems (even the slightest710 problems, or the most stupid questions), then please subscribe711 to the "chicken-users"712 (http://lists.nongnu.org/mailman/listinfo/chicken-users)713 mailing list and ask for help. It will be answered.