Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/cuda/INSTALL.md
ViewVC logotype

Annotation of /branches/cuda/INSTALL.md

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5620 - (view) (download)

1 : jhr 5597 # Build instructions for the Diderot compiler
2 :    
3 :     These instructions are organized into two parts. First is a quick
4 :     guide to installing the Diderot system (including the prerequisite
5 :     software). Following the quick overview are detailed instructions
6 :     for acquiring and installing the prerequisite software.
7 :    
8 :     ## QUICK GUIDE
9 :    
10 :     ### Prerequisite software
11 :    
12 :     #### Software tools
13 :    
14 :     To build *Teem*, you will need to have *cmake* installed. Instructions
15 :     for getting *cmake* are [below](#cmake-details).
16 :    
17 :     The Diderot runtime system is written in **C++11** and the code generator
18 :     also produces **C++** code, so you will need to have a modern **C++** compiler
19 :     installed (*e.g.*, either version 4.8.1 or later of **g++**, or
20 :     version 3.3 or later of **clang++**).
21 :    
22 :     #### Teem
23 :    
24 :     You must have **Teem** installed, which you can get from
25 :    
26 :     >
27 :     > <http://teem.sourceforge.net/download/index.html>
28 :     >
29 :    
30 :     Make sure that your **Teem** installation is revision **r6294** or later.
31 :     More details about installing **Teem** can be found [below](#teem-details).
32 :    
33 :     #### Standard ML of New Jersey
34 :    
35 :     You also must have **Standard ML of New Jersey** (SML/NJ) installed,
36 :     which you can get from
37 :    
38 :     >
39 :     > <http://smlnj.org/dist/working/index.html>
40 :     >
41 :    
42 :     Make sure that you get version 110.98 or later. More details about
43 :     installing **SML/NJ** can be found [below](#smlnj-details).
44 :    
45 :     #### MLton
46 :    
47 :     It is also possible to build **Diderot** using the **MLton**
48 :     Standard ML compiler, which you can get from
49 :    
50 :     >
51 :     > <http:/mlton.org>
52 :     >
53 :    
54 :     ### Getting the Diderot source
55 :    
56 :     You can checkout the stable version of the Diderot source tree from
57 :     <github.com> with the command:
58 :    
59 :     ````bash
60 :     % git clone https://github.com/Diderot-Language/diderot.git
61 :     ````
62 :    
63 :     or you can browse the source code
64 :    
65 :     >
66 :     > <https://github.com/Diderot-Language/diderot>
67 :     >
68 :    
69 :     ### Configuration
70 :    
71 :     Once you have downloaded the **Diderot** source code, go to the root of
72 :     the source tree and configure the build for your machine.
73 :    
74 :     ````bash
75 : adrianlehm 5620 autoreconf # Creates the configuration script
76 : jhr 5597 ./configure
77 :     ````
78 :    
79 :     The `configure` script will try to find your **Teem** installation and
80 :     the **sml** command. You may need to specify these locations as follows.
81 :    
82 :     The `configuration` script looks for **Teem** in either `/usr/local` or
83 :     `/usr/local/teem`. If **Teem** is installed elsewhere, use the command
84 :    
85 :     ````bash
86 :     ./configure --with-teem=/path/to/teem
87 :     ````
88 :    
89 :     where `/path/to/teem` is the full path of the directory containing the
90 :     **Teem** `lib` and `include` directories.
91 :    
92 :     If the **sml** command is in your `PATH`, then you are set. Otherwise,
93 :     you can specify its location to `configure` using the command
94 :    
95 :     ````bash
96 :     SMLNJ_CMD=/usr/local/smlnj/bin/sml ./configure
97 :     ````
98 :    
99 :     assuming that `/usr/local/smlnj` is the installation directory for
100 :     **SML/NJ**.
101 :    
102 :     ### Building and installing the Diderot system
103 :    
104 :     From the root of the Diderot source tree, run the command
105 :    
106 :     ````bash
107 :     make local-install
108 :     ````
109 :    
110 :     This command will build the Diderot compiler (`diderotc`) and runtime
111 :     support. Assuming that `$ROOT` is the root of the Diderot tree, the
112 :     compiler will be located at `$ROOT/bin/diderotc`.
113 :    
114 :     ## DETAILS
115 :    
116 :     ### CMake <a name="cmake-details"></a>
117 :    
118 :     [CMake](https://cmake.org) is required to build **Teem**.
119 :     These utilities can be obtained via `apt-get` on Ubuntu/Debian
120 :     Linux, or via [Homebrew `brew`](http://brew.sh) or
121 :     [Mac Ports `port`](https://www.macports.org) on **macOS**.
122 :    
123 :     To get CMake:
124 :     * **Linux**: CMake can be installed for Ubuntu/Debian using
125 :     the command `sudo apt-get install cmake`.
126 :     * **macOS**: CMake can be installed from [Homebrew](http://brew.sh)
127 :     using the command `brew install cmake` or from
128 :     [Mac Ports](https://www.macports.org) using the command
129 :     `sudo port install cmake`.
130 :     * Alternatively, the [CMake download](https://cmake.org/download/)
131 :     page includes "Binary distributions" that have the executable
132 :     `cmake` you will need, as well as source-code distributions.
133 :    
134 :     ### Teem <a name="teem-details"></a>
135 :    
136 :     The Diderot run-time depends on [**Teem**](http://teem.sourceforge.net).
137 :     **Teem** is overdue for a release, but in the mean time you should
138 :     build it from source with **CMake**, because **Diderot** requires
139 :     the current source (revision **r6294** or later).
140 :    
141 :     It is best to build a **Teem** for Diderot that has *none* of the
142 :     optional libraries (PNG, zlib, etc) enabled. Experience has shown
143 :     that additional library dependencies from **Teem** will complicate
144 :     the linking that the Diderot compiler must do to create executables.
145 :    
146 :     Create a directory for **Teem**; assume that `$TEEMDIR` specifies the path to
147 :     that directory. Then run the following shell commands:
148 :    
149 :     ````bash
150 :     cd $TEEMDIR
151 :     svn co https://svn.code.sf.net/p/teem/code/teem/trunk teem-src
152 :     ````
153 :    
154 :     The next step is to create a build directory and to configure the build
155 :     using **CMake**. This step requires specifying a bunch of flags to
156 :     disable dependency on various libraries.
157 :    
158 :     **COMMENT: for macOS, I do not think that turing off shared libraries
159 :     is required. Also, it is not clear that one need to disable PNG, etc.
160 :     on macOS (at least when using shared libraries). -- JHR**
161 :    
162 :     ````bash
163 :     mkdir teem-build
164 :     cd teem-build
165 :     TEEMBUILD=`pwd`
166 :     cmake -Wno-dev \
167 :     -D BUILD_EXPERIMENTAL_APPS=OFF -D BUILD_EXPERIMENTAL_LIBS=OFF \
168 :     -D BUILD_SHARED_LIBS=OFF -D BUILD_TESTING=OFF \
169 :     -D CMAKE_BUILD_TYPE=Release \
170 :     -D Teem_BZIP2=OFF -D Teem_FFTW3=OFF -D Teem_LEVMAR=OFF -D Teem_PTHREAD=OFF \
171 :     -D Teem_PNG=OFF -D Teem_ZLIB=OFF \
172 :     -D CMAKE_INSTALL_PREFIX:PATH=$TEEMDIR \
173 :     ../teem-src
174 :     ````
175 :    
176 :     Lastly, you can build and install **Teem**.
177 :    
178 :     ````bash
179 :     make
180 :     make install
181 :     ````
182 :    
183 :     At this point you will have a `$TEEMDIR/bin`, `$TEEMDIR/lib`, and
184 :     `$TEEMDIR/include` directories that contain the various parts of
185 :     **Teem**.
186 :    
187 :     To make sure your build works, try:
188 :    
189 :     ````bash
190 :     $TEEMDIR/bin/unu --version
191 :     ````
192 :    
193 :     Note that we do **not** recommend adding this `teem-ddro/bin` to your path;
194 :     it's not very useful.
195 :    
196 :     ### SML/NJ <a name="smlnj-details"></a>
197 :    
198 :     #### Installing on Linux
199 :    
200 :     On Ubuntu or Debian Linux, `apt-get` may work to install a sufficiently recent
201 :     version. `apt-cache policy smlnj` reports what version you can get;
202 :     if that's at or above version 110.82, you can:
203 :    
204 :     ````bash
205 :     sudo apt-get install smlnj
206 :     sudo apt-get install ml-lpt
207 :     ````
208 :    
209 :     The second `apt-get` to get `ml-lpt` is required because without it, the later compilation
210 :     of the Diderot compiler (with the `sml` from `apt-get`) will stop with an error message
211 :     like `driver/sources.cm:16.3-16.18 Error: anchor $ml-lpt-lib.cm not defined`.
212 :    
213 :     #### Installing on macOS
214 :    
215 :     On **macOS** systems, the easiest way to install **SML/NJ** is by
216 :     downloading the signed installer package from <smlnj.org>. Running the
217 :     installer will place the system in `/usr/local/smlnj` and the path to the
218 :     **sml** command will be `/usr/local/smlnj/bin/sml`.
219 :    
220 :     As an alternative you can install SML/NJ from [Homebrew](https://brew.sh)
221 :     using the following commands:
222 :    
223 :     It is also possible to get SML/NJ from [Homebrew](https://brew.sh) for macOS.
224 :     Assuming that `brew info smlnj` mentions version 110.82 or higher, then
225 :    
226 :     ````bash
227 :     brew install smlnj
228 :     ````
229 :    
230 :     (possibly followed by `brew link smlnj`) should work.
231 :    
232 :     #### Installing from source ####
233 :    
234 :     It is also possible to install **SML/NJ** using the installation script
235 :     provided as part of the source downloads.
236 :    
237 :     First, create a directory to hold the downloaded files and the results
238 :     of the installation; assume that `$SMLDIR` denotes the path to that
239 :     directory. Then run the following command to download and unbundle
240 :     the `config` directory:
241 :    
242 :     ```` bash
243 :     curl -O http://smlnj.org/dist/working/110.98/config.tgz
244 :     tar -xzf config.tgz
245 :     ````
246 :    
247 :     Then you can build the system using the command
248 :    
249 :     ```` bash
250 :     config/install.sh
251 :     ````
252 :    
253 :     This command will download the necessary source and precompiled files from
254 :     <smlnj.org> and build the **SML/NJ** runtime, compiler, and libraries.
255 :     The path to the **sml** command will be `$SMLDIR/bin/sml`.

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0