Code Monkey home page Code Monkey logo

ktakashi / sagittarius-scheme Goto Github PK

View Code? Open in Web Editor NEW
47.0 10.0 4.0 212.87 MB

A manual (beh...) clone from bitbucket to use hosted CI service which only support GitHub

Home Page: https://bitbucket.org/ktakashi/sagittarius-scheme

License: Other

CMake 0.28% Scheme 86.62% TeX 0.14% Java 0.01% Batchfile 0.01% Shell 0.02% C 12.01% Assembly 0.92% C++ 0.01% PowerShell 0.01%
sagittarius sagittarius-scheme scheme r7rs r6rs r7rs-scheme r6rs-scheme

sagittarius-scheme's Introduction

Sagittarius Scheme System

What is this?

This is a free Scheme implementation, supporting R6RS and R7RS specification.

How to build and install?

Sagittarius uses CMake for its building infrastructure. If you do not have it on your platform, please install it.

NOTE: It should be higher than 3.5, though we don't use new features, so it should also work with 2.8.4

Quick build/install (for Unix like environment)

If your environment already has required libraries and just want to install to default location, run the following commands in the directory where all distributed files are expanded (c.f. By default it'd be sagittarius-X.X.X, X.X.X is the version you downloaded):

% cmake .
% make
% make install

Following sections describes more details.

Preparation for Unix-like environment

Sagittarius depends on the following libraries.

If you are using Linux which supports apt-get, then you can simply execute the following command:

% apt install libgc-dev, zlib1g-dev libffi-dev libssl-dev

Manual installation of Boehm GC

For Boehm GC, you need to install it with the option --enable-threads=pthreads. If your CPU is not incredibly old, you can also specify the option --enable-parallel-mark.

If you are too lazy to download the archive file of GC, CMake will download it for you. Make sure to run the following commands from in GC directory:

% ./configure \
      --enable-threads=pthreads   \
      --enable-parallel-mark      \
      --enable-large-config
% make
% make install

Note: most of the Linux distributions already have Boehm GC in their package management system, such as apt-get. I recommend to use it for security reason.

Building on Unix-like environment

After installing CMake and dependent libraries, you are ready to build Sagittarius; type the following command:

% cmake .

Note: The above command assumes you are in the source directory.

It is possible to build Sagittarius in a directory that is not the top source directory of the distributed package (out-of-tree building); for example:

% mkdir build
% cd build
% cmake ${path to Sagittarius' source directory}
% make

To run the tests, specify test target.

% make test

Or, alternatively, you can also use ctest. This is convenient to test individual tests.

To install Sagittarius non default location, you need to specify CMAKE_INSTALL_PREFIX variable.

% cmake . -DCMAKE_INSTALL_PREFIX=/path/to/install

On some environment, there are 64 bits runtime specific directories such as lib64. To install Sagittarius runtime in the directory, then you can specify LIB_DIR variable as the following:

% cmake . -DLIB_DIR=lib64

Then the runtime install directoy will be CMAKE_INSTALL_PREFIX/LIB_DIR. There are also the variables to specify bin, include and share directories, and the directory for the .pc files; BIN_DIR, INCLUDE_DIR SHARE_DIR, and PKGCONFIG_DIR, respectively.

Since 0.5.6, Sagittarius's REPL is renamed to sagittarius and legacy sash is kept as a symbolic link. If you don't need the symbolic link then you can put the INSTALL_SYMLINK option off as the following:

% cmake . -DINSTALL_SYMLINK=0

After a successful compilation, it is possible to install Sagittarius to the location specified by CMAKE_INSTALL_PREFIX or default system location if it's not specified with the command:

% make install

After installation, you might need to run ldconfig to run Sagittarius properly.

Note: For some reason, you might want to build a 32-bit runtime on a 64-bit platform. The following command can be used for this purpose;

% cmake . \
    -DCMAKE_CXX_COMPILER=${your 32 bit C++ compiler} \
    -DCMAKE_C_COMPILER={your 32 bit C compiler}

Make sure you have all the required 32-bit executables and libraries.

Building on Mac OS X

Only with Homebrew is tested. A user can install sagittarius directly with homebrew, via

$ brew install sagittarius-scheme

Alternately, the user can install the following dependencies and then make sagittarius locally.

Installing libffi, CMake, Boehm GC and OpenSSL.

$ brew install libffi cmake bdw-gc openssl

After installing dependent libraries, the rest of the process are the same as Unix-like environment.

If cmake can't find libffi, then you can specify the location via FFI_LIBRARY_DIR option like the following.

$ cmake . -DFFI_LIBRARY_DIR=/usr/local/Cellar/libffi/3.0.13/lib

Note: some Mac OS X environment may not be able to find ar command because /usr/bin/gcc is identical as /usr/bin/clang. In that case, export CC and CXX environment variable with proper GCC and G++ command path respectively so that CMake can find the command.

Building on FreeBSD

FreeBSD has multiple type of Boehm GC system libraries; gc, gc-threaded and gc-redirect. Sagittarius requires threaded runtime to make thread library works properly. The building process checks if gc has GC_get_parallel() function and if it doesn't then tries to use gc-threaded library. Please make sure your system has gc-threaded or gc built with multi thread option.

NB: If you install gc without build option, then default is without thread support. In such a case, you need to install gc-threaded as well.

Building on Windows (non Cygwin environment)

On Windows, you need to create an installer and Sagittarius is using innosetup for it. Please install it.

You need to install MSVC preferably Visual Studio 2010 or higher. And if you use cmake-gui, it will be much easier. Run Visual Studio Command Prompt and go to the directory which Sagittarius source codes are expanded.

If you prefer to use cmake instead of cmake-gui, then the following command needs to be executed:

% cmake . -G"NMake Makefiles"

Specifying -DDEBUG_VERSION=OFF enables MSVC optimisations.

The final commands are almost the same as in Unix-like environments.

% nmake
% nmake test

After these commands, you move to the win/ directory and double click the file innosetup.iss. Go to [Build] - [Compile], then it will create the installer. For more detail, please see Inno Setup's document.

Msbuild

Experimentally, we also support Visual Studio generators. So, the below command should also work on Windows.

% cmake .
% msbuild /p:Configuration=Release Sagittarius.sln

Forums and bug reporting

If you have any question, please ask on the following Google group:

If you find a bug, please report it on the project bug tracking board:

Or you can report it on Google group.

How to develop it?

See HACKING file.

sagittarius-scheme's People

Contributors

jasonhemann avatar ktakashi avatar okuoku avatar omasanori avatar wahjava avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sagittarius-scheme's Issues

Problem with equal-hash? -- Segmentation fault: 11

I recently added support for Saggitarius Scheme to my project. My project is a portable R6RS library. Its test suite is passed by Racket, Larceny, Petite Chez Scheme, Iron Scheme and partially Guile. Sagittarius fails three test cases however. I am running Sagittarius 0.7 in Mac OS X (homebrew version).

I am not sure why Sagittarius fails, but judging from previous experience (cf. christoff-buerger/racr#37, christoff-buerger/racr#55, IronScheme/IronScheme#11), faulty equal? and equal-hash implementations for cyclic data structures are often the reason.

Short background: My RACR project is a metacompiler library based on reference attribute grammar controlled rewriting. One of the example languages is a Petri net interpreter supporting the composition of nets in execution. The composition is based on place fusion. Place fusion requires fixpoint semantics to find all places a place is fused with (transitive closure computation). I therefore use circular attributes to compute this reachability problem. Fixpoint semantics require a termination condition. In case of reachability, the computation should terminate when the set of reachable places does not change anymore. In that process I use equal? to compare circularity-caches. The content of these caches are R6RS records, that themselves encode circular data structures. Since equal? must be well-defined for circular data structures according to the R6RS, this is not a problem. Another example of the RACR metacompiler is a simple imperative programming language (SiPLE). The language supports static typing and type coercions. The coercions are performed using attributes to deduce if and where a type coercion is required and then apply rewrites introducing respective type casts. All analyses are automatically cached and re-evaluated, if, and only if, a rewrite influenced some information an analyse used. To cache analyses, R6RS equal? hashtables are used.

The actual test cases failed by Sagittarius When you checkout my project and navigate to examples/siple you can execute one example test case for SiPLE via ../../run-program.bash -s sagittarius -e run.scm -- examples/correct/closures.siple :false:. This yields the following error:

Segmentation fault: 11

Another test case that fails is at examples/composed-petrinets/examples and executed via ../../../run-program.bash -s sagittarius -l .. -e purchase-processing.scm:

Unhandled exception
  Condition components:
  1. petrinets-exception
  2. &message Cannot compose Petri nets; The composed net is not well-formed.
  3. &stack-trace

stack trace:
  [1] raise-continuable
  [2] run-tests
    src: (ap:exception: "Cannot compose Petri nets; The com
  [3] load

The thrown exception is a false-positive. The tested Petri net is well-formed and the composition performed by other R6RS Scheme systems. The reason for the error is, that the well-formed? attribute is not correctly computed; I think most likely because of an erroneous computation of the circular fused-places attribute caused by incorrect equal? or equal-hash implementations.

Note: The issue is also reported at christoff-buerger/racr#60.

Wak fmt

Hi,

I was repeating the steps from a Akku.scm demo and tried to run it with sagittarius, there seems to be an error with one of the imports of the wak fmt dependency. The demo does work out of the box with guile, plt-r6rs and chez-scheme, so I'm not sure where to ask about the error (Akku.scm or here). Do you know what the problem is?

Unhandled exception
  Condition components:
  1. &compile
    program: (import (rnrs (6)) (sbank-hello))
    source: "bin/sbank-hello.sps":7
  2. &compile
    program: (library (sbank-hello) (export hello) (import (rnrs) (wak fm
    source: "/home/arch/daniel/scheme/projects/akku/sbank-hello/sbank-hello.sls":6
  3. &compile
    program: (library (wak fmt) (export new-fmt-state fmt fmt-start fmt-i
    source: "/home/arch/daniel/scheme/projects/akku/sbank-hello/.akku/lib/wak/fmt.sls":10
  4. &compile
    program: (library (srfi :6 basic-string-ports) (export (rename (open-
    source: "/home/arch/daniel/scheme/projects/akku/sbank-hello/.akku/lib/srfi/:6/basic-string-ports.sls":5
  5. &error
  6. &message import no such library ((srfi :6 basic-string-ports compat))
  7. &stack-trace

git checkout does not build

After running ./dist.sh gen, I tried cmake ., but it seems that a file is missing:

cmake .
-- System processor ... x86_64
-- System name ... Linux
-- Host system name ... Linux
-- Buinding directory ... /home/jeronimo/pkg/scheme/sagittarius-scheme
-- Looking for struct timespec
-- Looking for struct timespec - found
-- Architecture triple: x86_64-pc-linux
-- Install prefix: /usr/local
-- Fixup compiler flags x86_64
-- Found GC library: /usr/local/lib/libgc.so
-- operating system: Linux
-- Adding symbolic link sagittarius -> sash
-- Stub generator /home/jeronimo/pkg/scheme/sagittarius-scheme/build/sagittarius
-- OpenSSL lib dir /usr/lib/x86_64-linux-gnu
-- OpenSSL ssl lib: /usr/lib/x86_64-linux-gnu/libssl.so
-- OpenSSL crypto lib: /usr/lib/x86_64-linux-gnu/libcrypto.so
-- HAVE_ZLIB_INFLATE_RESET2 = 1
-- Found libraries /usr/lib/x86_64-linux-gnu/libffi.so
-- Sagittarius uses platform libffi
-- Adding linking target - platform /usr/lib/x86_64-linux-gnu/libffi.so
-- Searching odbc - found
-- Sagittarius supports ODBC
-- Filewatch implementation file: inotify_watch.c
-- Configuring done
CMake Error at src/CMakeLists.txt:107 (ADD_LIBRARY):
  Cannot find source file:

    lib_vm.c

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx


CMake Error at src/CMakeLists.txt:107 (ADD_LIBRARY):
  No SOURCES given to target: sagittarius

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.