-
Notifications
You must be signed in to change notification settings - Fork 54
Building and installing
Please see the directions on the ATS site.
Please note that compiling ATS2 in this style is recommended primarily for people who are interested in helping develop ATS2.
ATS2 is implemented in ATS1. Currently, the required version of ATS1 (ATS/Anairiats) for bootstrapping ATS2 (ATS/Postiats) is 0.2.12. Please install ATS1-0.2.12 with following proceeding:
wget http://downloads.sourceforge.net/project/ats-lang/ats-lang/anairiats-0.2.12/ats-lang-anairiats-0.2.12.tgz
tar xf ats-lang-anairiats-0.2.12.tgz
cd ats-lang-anairiats-0.2.12/
./configure
make all
export ATSHOME=${PWD}/ats-lang-anairiats-0.2.12
export ATSHOMERELOC=ATS-0.2.12
Checkout Postiats from sources by downloading the zip file or using the following command (assuming that ~/postiats
is a directory where the repository is to be put locally):
git clone https://github.com/githwxi/ATS-Postiats.git ~/postiats
Set PATH to include the directory ~/postiats/bin so that the second half of the building process knows where to locate the created "patsopt".
Now, build ATS2:
make -f Makefile_devl all
This command effectively executes both of the following:
make -f codegen/Makefile_atslib # this is only needed for the first time
make -f Makefile_devl
Optionally, put ~/postiats/bin
on your PATH, e.g., by adding the following line to your .bashrc
:
export PATH=${PATH}:${HOME}/postiats/bin
Finally, a couple of environmental variables need to be properly set:
export PATSHOME=${HOME}/postiats #For the example install above, or wherever ATS2 is located.
If you also want to use ats2-lang-contrib, then please set the environmental variable PATSHOMERELOC to the name of the directory where ats2-lang-contrib resides.
Should the build fail at some point, it may be necessary to clean up:
make -C src cleanall
If that does not work, it is worth trying to clean up ATSLIB as well:
make -f codegen/Makefile_atslib cleanall
The above make rule should be executed whenever one wishes to use updated [ATSLIB] code from the upstream github repository.
When trying to build ATS2, it is possible that the version of GMP used for the build of ATS1 is no longer the same as that being used for the current build procedure. In that case, do the following, then repeat the build cleanup and make procedures outlined above:
cd ${ATSHOME}
atslib libc/SATS/gmp.sats
atslib libc/DATS/gmp.dats
Other GMP problems can arise; if you don't care about GMP support in ATS (i.e. you aren't too worried about constraints involving large numbers), then you can bypass GMP support by calling make as follows:
make -f Makefile_devl all C3NSTRINTKND=intknd
which effectively replaces gmpknd
with intknd
. You shoud NOT do this for producing safety-critical production code, but should be find for most development. Also note that if you want to specify linker and library flags for GMP, you must currently do so through the environment variable LIBGMP
, not LDFLAGS
.
Using ATS under Mac OS X has been a thorny issue for quite sometime. Probably the easiest way to install ATS2 under OSX is by using a homebrew formula.
Here are some caveats:
-
ATS1 cannot be correctly compiled by clang. You need genuine gcc (the one on OSX is hooked to clang by default) to compile ATS1. See below.
-
When using gcc-4.x to compile ATS1, please make sure that you generate a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.
-
Please use ATS1-ngc to compile ATS2.
Sounds complicated? All the steps can be found in .travis.yml.
$ sudo apt-get install ats2-lang
ATS can be installed in a docker container using the following command:
docker run -ti -v [your source directory]:/src steinwaywhw/ats
This gives you the ability to edit/compile any ATS code on any platform as long as docker is installed. More information and the docker install file is available at https://github.com/steinwaywhw/docker-ats.
A Vagrantfile could be written based on that Dockerfile, which enables booting up a real virtual machine (instead of a container).