Installation » History » Version 72
Marcus Pearce, 2014-10-14 06:19 PM
1 | 47 | Marcus Pearce | h1. Installing IDyOM and its prerequisites |
---|---|---|---|
2 | 1 | Marcus Pearce | |
3 | 46 | Marcus Pearce | {{>toc}} |
4 | 1 | Marcus Pearce | |
5 | 46 | Marcus Pearce | h2. Summary |
6 | 1 | Marcus Pearce | |
7 | 50 | Marcus Pearce | # Download "Steel Bank Common Lisp [SBCL]":http://www.sbcl.org/platform-table.html and "install it":http://www.sbcl.org/getting.html |
8 | 61 | Marcus Pearce | # Install Emacs ("available here for MacOS":http://emacsformacosx.com/) |
9 | 61 | Marcus Pearce | # Install "Quicklisp":http://www.quicklisp.org/beta/, a library manager for Common Lisp (download "<code>quicklisp.lisp</code>":http://beta.quicklisp.org/quicklisp.lisp and follow the instructions "here":http://www.quicklisp.org/beta/#installation) |
10 | 50 | Marcus Pearce | # (Optional) Install an SQL database - I recommend "SQLite":http://www.sqlite.org/ which is already installed on most recent flavours of MacOS and Linux. See the "CLSQL Manual":http://clsql.b9.com/manual/ for information on other database systems you can use and how to access them from Common Lisp. |
11 | 50 | Marcus Pearce | # Install and setup the IDyOM code itself |
12 | 1 | Marcus Pearce | |
13 | 60 | Marcus Pearce | The following is a detailed description of each of these steps tested on MacOS 10.7.5 and Ubuntu 14.04 (GNU/Linux 3.13.0-24-generic x86_64). It has been successfully installed on Windows following the same basic steps but I don't have a Windows machine to test the detailed instructions. |
14 | 46 | Marcus Pearce | |
15 | 51 | Marcus Pearce | h2. 1. Install SBCL |
16 | 46 | Marcus Pearce | |
17 | 66 | Marcus Pearce | # download SBCL for your OS and processor (e.g., for MacOS 10, choose the AMD64 version) here: http://www.sbcl.org/platform-table.html |
18 | 46 | Marcus Pearce | # on MacOS make sure you have the Xcode developer tools installed from the DVD that came with your Mac (required for GNU make) |
19 | 49 | Marcus Pearce | # install SBCL by following the instructions here: http://www.sbcl.org/getting.html (Basically: unpack the downloaded tar.bz2 file, open a terminal window, change directory (<code>cd</code>) into the unpacked directory and type <code>sudo sh install.sh</code>). |
20 | 1 | Marcus Pearce | |
21 | 51 | Marcus Pearce | h2. 2. Download and install Emacs |
22 | 47 | Marcus Pearce | |
23 | 47 | Marcus Pearce | MacOS: Universal binaries available here: http://emacsformacosx.com/ |
24 | 47 | Marcus Pearce | Linux: <code>sudo apt-get install emacs</code> |
25 | 47 | Marcus Pearce | |
26 | 51 | Marcus Pearce | h2. 3. Install Quicklisp |
27 | 47 | Marcus Pearce | |
28 | 65 | Marcus Pearce | *NB:* the full, original instructions are here http://www.quicklisp.org/beta/#installation. The following is my summary. |
29 | 65 | Marcus Pearce | |
30 | 47 | Marcus Pearce | # make a new folder in your home directory called 'quicklisp' |
31 | 47 | Marcus Pearce | # download the file http://beta.quicklisp.org/quicklisp.lisp and put it into the new folder |
32 | 47 | Marcus Pearce | # open a terminal window and type 'sbcl' to start sbcl |
33 | 47 | Marcus Pearce | # type each of the following lines followed by enter, changing the path to match the location of your quicklisp folder: |
34 | 1 | Marcus Pearce | <pre> |
35 | 1 | Marcus Pearce | (load "/Users/marcusp/quicklisp/quicklisp.lisp") |
36 | 47 | Marcus Pearce | (quicklisp-quickstart:install :path "/Users/marcusp/quicklisp/") |
37 | 47 | Marcus Pearce | (ql:add-to-init-file) |
38 | 47 | Marcus Pearce | (ql:quickload "quicklisp-slime-helper") |
39 | 49 | Marcus Pearce | </pre> |
40 | 64 | Marcus Pearce | # Remember to follow the instructions given by each of these commands. *In particular*, the final command prints some lines of code to copy and paste into the emacs configuration file called <code>.emacs</code> in your home directory (you must create this file in Emacs or another text editor): |
41 | 64 | Marcus Pearce | <pre> |
42 | 64 | Marcus Pearce | To use, add this to your ~/.emacs: |
43 | 64 | Marcus Pearce | |
44 | 64 | Marcus Pearce | (load (expand-file-name "~/quicklisp/slime-helper.el")) |
45 | 64 | Marcus Pearce | ;; Replace "sbcl" with the path to your implementation |
46 | 64 | Marcus Pearce | (setq inferior-lisp-program "sbcl") |
47 | 64 | Marcus Pearce | </pre> |
48 | 47 | Marcus Pearce | # open (or restart) Emacs, press Alt-x and type slime - you should now be running SBCL from within Emacs |
49 | 1 | Marcus Pearce | |
50 | 52 | Marcus Pearce | h2. 4. Install an SQL database |
51 | 1 | Marcus Pearce | |
52 | 52 | Marcus Pearce | MacOS: No action required, Sqlite is already installed (unless you prefer a different database system, see below). |
53 | 57 | Marcus Pearce | Linux: <code>sudo apt-get install sqlite</code> |
54 | 52 | Marcus Pearce | |
55 | 52 | Marcus Pearce | h2. 5. Install IDyOM |
56 | 52 | Marcus Pearce | |
57 | 62 | Marcus Pearce | # download the latest release of the IDyOM code: |
58 | 70 | Marcus Pearce | ** "latest release: v1.1":https://code.soundsoftware.ac.uk/attachments/download/1194/idyom-1.1.zip |
59 | 62 | Marcus Pearce | ** "older releases":https://code.soundsoftware.ac.uk/projects/idyom-project/files |
60 | 47 | Marcus Pearce | # unzip the zip file into the folder 'local-projects' within the 'quicklisp' folder (e.g., '/Users/marcusp/quicklisp/local-projects/') |
61 | 72 | Marcus Pearce | # *(Only required for releases prior to v1.1)* create a folder in your home directory called 'idyom'. Within that folder make two further folders, one called 'db', the other called 'data'. Within the 'data' folder make three further folders called 'cache', 'models' and 'resampling'. |
62 | 1 | Marcus Pearce | # using Emacs or another text editor open the file called '.sbclrc' in your home directory and add the following lines to the end of the file (the file should already have some lisp code in it), changing the paths to match the location of the 'idyom' folder you created in step 3: |
63 | 47 | Marcus Pearce | <pre> |
64 | 47 | Marcus Pearce | ;;; Load CLSQL by default |
65 | 47 | Marcus Pearce | (ql:quickload "clsql") |
66 | 1 | Marcus Pearce | |
67 | 47 | Marcus Pearce | ;;; IDyOM |
68 | 47 | Marcus Pearce | (defun start-idyom () |
69 | 47 | Marcus Pearce | (defvar *idyom-root* "/Users/marcusp/idyom/") |
70 | 47 | Marcus Pearce | (ql:quickload "idyom") |
71 | 63 | Marcus Pearce | (clsql:connect '("/Users/marcusp/idyom/db/database.sqlite") :if-exists :old :database-type :sqlite3)) |
72 | 47 | Marcus Pearce | </pre> |
73 | 47 | Marcus Pearce | # Restart Emacs, run Slime again (<code>Alt-x slime</code>) and type <code>(start-idyom)</code> at the prompt, <code>CL-USER></code>, to load IDyOM. The first time you run this, it will also download all the required third-party lisp libraries. |
74 | 47 | Marcus Pearce | # The first time you run IDyOM, you must initialise the database by issuing the following command at the prompt (<code>CL-USER></code>): |
75 | 8 | Jeremy Gow | <pre> |
76 | 1 | Marcus Pearce | (mtp-admin:initialise-database) |
77 | 8 | Jeremy Gow | </pre> |
78 | 47 | Marcus Pearce | NB: if you run this command later it will delete all the contents of your database, so only run it once. |
79 | 8 | Jeremy Gow | |
80 | 47 | Marcus Pearce | h1. Starting IDyOM |
81 | 1 | Marcus Pearce | |
82 | 47 | Marcus Pearce | Having installed IDyOM as described above, you can start it by: |
83 | 47 | Marcus Pearce | |
84 | 50 | Marcus Pearce | # launching Emacs |
85 | 44 | Marcus Pearce | # typing <code>Alt-x slime</code> |
86 | 47 | Marcus Pearce | # entering <code>(start-idyom)</code> at the Lisp prompt, <code>CL-USER></code> |
87 | 44 | Marcus Pearce | |
88 | 44 | Marcus Pearce | h1. Troubleshooting |
89 | 1 | Marcus Pearce | |
90 | 67 | Marcus Pearce | h2. Editing text files |
91 | 67 | Marcus Pearce | |
92 | 67 | Marcus Pearce | If you use a text editor like Textedit (on MacOS) to edit lisp code (e.g., in the <code>.sbclrc</code> or <code>.emacs</code> files), it can insert non-ascii characters for things like curved quotation marks (smart quotes) which won't work. This is one reason (of many) to use Emacs as an editor. You never know, you might find you like it! |
93 | 67 | Marcus Pearce | |
94 | 67 | Marcus Pearce | h2. Using SBCL within Emacs |
95 | 67 | Marcus Pearce | |
96 | 67 | Marcus Pearce | Used within Emacs, SBCL will do pathname completion (using TAB) and expansion of "~" into your home directory and other useful things. You can also get previous commands easily. |
97 | 67 | Marcus Pearce | |
98 | 67 | Marcus Pearce | See "here":http://common-lisp.net/project/slime/ for more on Slime, the Emacs library which achieves this (it is automatically installed by Quicklisp). |
99 | 67 | Marcus Pearce | |
100 | 52 | Marcus Pearce | h2. The lisp debugger |
101 | 52 | Marcus Pearce | |
102 | 52 | Marcus Pearce | If you find yourself with something like this: |
103 | 52 | Marcus Pearce | |
104 | 52 | Marcus Pearce | <pre> |
105 | 52 | Marcus Pearce | * (/ 1 0) |
106 | 52 | Marcus Pearce | |
107 | 52 | Marcus Pearce | debugger invoked on a DIVISION-BY-ZERO: |
108 | 52 | Marcus Pearce | arithmetic error DIVISION-BY-ZERO signalled |
109 | 52 | Marcus Pearce | Operation was SB-KERNEL::DIVISION, operands (1 0). |
110 | 52 | Marcus Pearce | |
111 | 52 | Marcus Pearce | Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL. |
112 | 52 | Marcus Pearce | |
113 | 52 | Marcus Pearce | restarts (invokable by number or by possibly-abbreviated name): |
114 | 52 | Marcus Pearce | 0: [ABORT] Exit debugger, returning to top level. |
115 | 52 | Marcus Pearce | |
116 | 52 | Marcus Pearce | (SB-KERNEL::INTEGER-/-INTEGER 1 0) |
117 | 52 | Marcus Pearce | 0] |
118 | 52 | Marcus Pearce | </pre> |
119 | 52 | Marcus Pearce | |
120 | 52 | Marcus Pearce | Then you have typed something that lisp doesn't like. Be sure to read the information and the restart options and enter the appropriate restart number - usually this is the one labelled <code>[ABORT]</code> but, depending on the situation, <code>[CONTINUE]</code> may also be useful. |
121 | 52 | Marcus Pearce | |
122 | 68 | Marcus Pearce | h2. Updating or reinstalling IDyOM |
123 | 47 | Marcus Pearce | |
124 | 68 | Marcus Pearce | To update IDyOM simply remove the previously installation from the <code>.../quicklisp/local-projects/</code> directory and unzip the new version. Then restart Emacs/SBCL/IDyOM as described above. |
125 | 47 | Marcus Pearce | |
126 | 52 | Marcus Pearce | h2. Using different SQL database systems |
127 | 47 | Marcus Pearce | |
128 | 47 | Marcus Pearce | You may use different kinds of databases. For example, to create an SQLite database called 'example.db' in directory <code>DIR</code>: |
129 | 47 | Marcus Pearce | |
130 | 44 | Marcus Pearce | <pre> |
131 | 44 | Marcus Pearce | (clsql:connect '("DIR/example.db") :if-exists :old :database-type :sqlite3) |
132 | 44 | Marcus Pearce | </pre> |
133 | 47 | Marcus Pearce | |
134 | 44 | Marcus Pearce | Alternatively, to connect to an existing local MySQL database: |
135 | 47 | Marcus Pearce | |
136 | 44 | Marcus Pearce | <pre> |
137 | 44 | Marcus Pearce | (clsql:connect '("localhost" "example-database" "username" "password") :if-exists :old :database-type :mysql) |
138 | 44 | Marcus Pearce | </pre> |
139 | 47 | Marcus Pearce | |
140 | 44 | Marcus Pearce | See the "CLSQL documentation":http://clsql.b9.com/manual/ for more on "connect":http://clsql.b9.com/manual/connect.html and "supported databases":http://clsql.b9.com/manual/prerequisites.html#idp8251808. |
141 | 44 | Marcus Pearce | |
142 | 47 | Marcus Pearce | h2. Problems loading foreign database libraries: |
143 | 44 | Marcus Pearce | |
144 | 44 | Marcus Pearce | Depending on how your system is configured, <code>clsql:connect</code> may give a "Couldn't load foreign libraries" error. In this case, you |
145 | 44 | Marcus Pearce | need to "tell CLSQL where it can find these libraries":http://clsql.b9.com/manual/appendix.html#foreignlibs, e.g. |
146 | 47 | Marcus Pearce | |
147 | 44 | Marcus Pearce | <pre> |
148 | 1 | Marcus Pearce | (clsql:push-library-path "/usr/local/mysql/lib/") |
149 | 1 | Marcus Pearce | </pre> |
150 | 1 | Marcus Pearce | |
151 | 47 | Marcus Pearce | The exact path will depend on your system. Note that, for some database installations these libraries may not have been installed, and you should consult the database documentation. |