Debian Codegraph @

embedded/www/files/critcl_howto_install.html

raw
1 <!DOCTYPE html><html><head>
2 <meta charset="UTF-8">
3 <meta name="viewport" content="width=device-width, initial-scale=1">
4 <title>critcl_howto_install - C Runtime In Tcl (CriTcl)</title>
5 <style type="text/css"><!--
6 HTML {
7 background: #FFFFFF;
8 color: black;
9 }
10 BODY {
11 background: #FFFFFF;
12 color: black;
13 }
14 DIV.doctools {
15 margin-left: 10%;
16 margin-right: 10%;
17 }
18 DIV.doctools H1,DIV.doctools H2 {
19 margin-left: -5%;
20 }
21 H1, H2, H3, H4 {
22 margin-top: 1em;
23 font-family: sans-serif;
24 font-size: large;
25 color: #005A9C;
26 background: transparent;
27 text-align: left;
28 }
29 H1.doctools_title {
30 text-align: center;
31 }
32 UL,OL {
33 margin-right: 0em;
34 margin-top: 3pt;
35 margin-bottom: 3pt;
36 }
37 UL LI {
38 list-style: disc;
39 }
40 OL LI {
41 list-style: decimal;
42 }
43 DT {
44 padding-top: 1ex;
45 }
46 UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
47 font: normal 12pt/14pt sans-serif;
48 list-style: none;
49 }
50 LI.doctools_section, LI.doctools_subsection {
51 list-style: none;
52 margin-left: 0em;
53 text-indent: 0em;
54 padding: 0em;
55 }
56 PRE {
57 display: block;
58 font-family: monospace;
59 white-space: pre;
60 margin: 0%;
61 padding-top: 0.5ex;
62 padding-bottom: 0.5ex;
63 padding-left: 1ex;
64 padding-right: 1ex;
65 width: 100%;
66 }
67 PRE.doctools_example {
68 color: black;
69 background: #f5dcb3;
70 border: 1px solid black;
71 }
72 UL.doctools_requirements LI, UL.doctools_syntax LI {
73 list-style: none;
74 margin-left: 0em;
75 text-indent: 0em;
76 padding: 0em;
77 }
78 DIV.doctools_synopsis {
79 color: black;
80 background: #80ffff;
81 border: 1px solid black;
82 font-family: serif;
83 margin-top: 1em;
84 margin-bottom: 1em;
85 }
86 UL.doctools_syntax {
87 margin-top: 1em;
88 border-top: 1px solid black;
89 }
90 UL.doctools_requirements {
91 margin-bottom: 1em;
92 border-bottom: 1px solid black;
93 }
94 --></style>
95 </head>
96 <!-- Generated from file 'critcl_howto_install.man' by tcllib/doctools with format 'html'
97 -->
98 <!-- Copyright &amp;copy; Jean-Claude Wippler -- Copyright &amp;copy; Steve Landers -- Copyright &amp;copy; 2011-2024 Andreas Kupries
99 -->
100 <!-- critcl_howto_install.n
101 -->
102 <body><hr> [
103 <a href="../toc.html">Table Of Contents</a>
104 &#124; <a href="../index.html">Keyword Index</a>
105 ] <hr>
106 <div class="doctools">
107 <h1 class="doctools_title">critcl_howto_install(n) 3.3.1 doc &quot;C Runtime In Tcl (CriTcl)&quot;</h1>
108 <div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
109 <p>critcl_howto_install - How To Install CriTcl</p>
110 </div>
111 <div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
112 <ul class="doctools_toc">
113 <li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
114 <li class="doctools_section"><a href="#section1">Description</a></li>
115 <li class="doctools_section"><a href="#section2">Install The Requisites</a>
116 <ul>
117 <li class="doctools_subsection"><a href="#subsection1">Install A Working C Compiler</a></li>
118 <li class="doctools_subsection"><a href="#subsection2">Install A Working Tcl Shell</a></li>
119 <li class="doctools_subsection"><a href="#subsection3">Install Supporting Tcl Packages</a></li>
120 </ul>
121 </li>
122 <li class="doctools_section"><a href="#section3">Install The CriTcl Packages</a>
123 <ul>
124 <li class="doctools_subsection"><a href="#subsection4">Install On Unix</a></li>
125 <li class="doctools_subsection"><a href="#subsection5">Install On Windows</a></li>
126 </ul>
127 </li>
128 <li class="doctools_section"><a href="#section4">Test The Installation</a></li>
129 <li class="doctools_section"><a href="#section5">Authors</a></li>
130 <li class="doctools_section"><a href="#section6">Bugs, Ideas, Feedback</a></li>
131 <li class="doctools_section"><a href="#keywords">Keywords</a></li>
132 <li class="doctools_section"><a href="#category">Category</a></li>
133 <li class="doctools_section"><a href="#copyright">Copyright</a></li>
134 </ul>
135 </div>
136 <div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
137 <p>Be welcome to the <i class="term">C Runtime In Tcl</i> (short: <i class="term"><a href="critcl.html">CriTcl</a></i>), a system for embedding and using C
138 code from within <a href="http://core.tcl-lang.org/tcl">Tcl</a> scripts.</p>
139 <p><i class="term"><a href="critcl.html">CriTcl</a></i> is installed in four major steps:</p>
140 <ol class="doctools_enumerated">
141 <li><p><span class="sectref"><a href="#section2">Install The Requisites</a></span></p></li>
142 <li><p>Follow the instructions on <i class="term"><a href="critcl_howto_sources.html">How To Get The CriTcl Sources</a></i></p></li>
143 <li><p><span class="sectref"><a href="#section3">Install The CriTcl Packages</a></span></p></li>
144 <li><p><span class="sectref"><a href="#section4">Test The Installation</a></span></p></li>
145 </ol>
146 <p>It is now possible to follow the instructions on <i class="term"><a href="critcl_howto_use.html">How To Use CriTcl</a></i>.</p>
147 </div>
148 <div id="section2" class="doctools_section"><h2><a name="section2">Install The Requisites</a></h2>
149 <p>This major step breaks down into three minor steps:</p>
150 <ol class="doctools_enumerated">
151 <li><p><span class="sectref"><a href="#subsection1">Install A Working C Compiler</a></span> and development environment.</p></li>
152 <li><p><span class="sectref"><a href="#subsection2">Install A Working Tcl Shell</a></span></p></li>
153 <li><p><span class="sectref"><a href="#subsection3">Install Supporting Tcl Packages</a></span></p></li>
154 </ol>
155 <div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Install A Working C Compiler</a></h3>
156 <p>While <i class="term"><a href="critcl.html">CriTcl</a></i> requires a working C compiler to both install itself, and to process
157 <i class="term"><a href="critcl.html">CriTcl</a></i>-based packages installing such is very much out of scope for this document.</p>
158 <p>Please follow the instructions for the platform and system <i class="term"><a href="critcl.html">CriTcl</a></i> is to be
159 installed on.</p>
160 <p>The important pieces of information are this:</p>
161 <ol class="doctools_enumerated">
162 <li><p>The path to the directory containing the C compiler binary has to be listed in the
163 environment variable <b class="variable">PATH</b>, for <i class="term"><a href="critcl.html">CriTcl</a></i> to find it.</p></li>
164 <li><p>On Windows(tm) the environment variable <b class="variable">LIB</b> has to be present and contain the
165 paths of the directories holding Microsoft's libraries. The standard <i class="term"><a href="critcl.html">CriTcl</a></i>
166 configuration for this platform searches these paths to fine-tune its settings
167 based on available libraries and compiler version.</p></li>
168 </ol>
169 <p>Links of interest:</p>
170 <dl class="doctools_definitions">
171 <dt><a href="http://www.tldp.org/HOWTO/HOWTO-INDEX/programming.html">http://www.tldp.org/HOWTO/HOWTO-INDEX/programming.html</a></dt>
172 <dd></dd>
173 </dl>
174 </div>
175 <div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">Install A Working Tcl Shell</a></h3>
176 <p>That a working installation of <i class="term"><a href="critcl.html">CriTcl</a></i> will require a working installation of
177 <a href="http://core.tcl-lang.org/tcl">Tcl</a> should be obvious.</p>
178 <p>Installing Tcl however is out of scope here, same as for installing a working C
179 compiler.</p>
180 <p>There are too many options, starting from
181 <a href="http://core.tcl-lang.org/tcl">building it from scratch</a>, installing what is provided
182 by the platform's package manager (<a href="https://en.opensuse.org/Portal:Zypper">zypper</a>, <a href="https://access.redhat.com/solutions/9934">yum</a>, <a href="https://help.ubuntu.com/community/AptGet/Howto">apt-get</a>, and more),
183 to using some vendor's <a href="https://core.tcl-lang.org/dist.html">distribution</a>.</p>
184 <p>A single piece of advice however.</p>
185 <p>While <i class="term"><a href="critcl.html">CriTcl</a></i> currently supports running on Tcl 8.4 and higher, and the
186 creation of packages for the same, the last release for this version was in 2013 (9 years
187 ago at the time of writing). Similarly, the last release for Tcl 8.5 was in 2016 (6 years
188 ago). Both are official end of life.</p>
189 <p>Given this I recommend to install and use Tcl 8.6.</p>
190 </div>
191 <div id="subsection3" class="doctools_subsection"><h3><a name="subsection3">Install Supporting Tcl Packages</a></h3>
192 <p>The implementation of <i class="term"><a href="critcl.html">CriTcl</a></i> uses and depends on</p>
193 <ol class="doctools_enumerated">
194 <li><p><b class="package">cmdline</b></p></li>
195 </ol>
196 <p>Depending on how Tcl was installed this package may be available already without
197 action, or not.
198 Invoke the command</p>
199 <pre class="doctools_example">
200 echo 'puts [package require cmdline]' | tclsh
201 </pre>
202 <p>to check if the package is present or not. If it is present then its version number will
203 be printed, else the error message <b class="const">can't find package cmdline</b> or similar.</p>
204 <p>If it is not present install the package as per the instructions for the chosen Tcl
205 installation.</p>
206 <p><em>Note</em>, the package <b class="package">cmdline</b> may not exist as its own installable
207 package. In such a case check if the chosen Tcl installation provides a <b class="package">tcllib</b>
208 package and install that. This should install all the packages in the Tcllib bundle,
209 including <b class="package">cmdline</b>.</p>
210 <p>As a last fallback, go to <a href="http://core.tcl-lang.org/tcllib">Tclib</a> and follow the instructions to install
211 the bundle from scratch.</p>
212 </div>
213 </div>
214 <div id="section3" class="doctools_section"><h2><a name="section3">Install The CriTcl Packages</a></h2>
215 <p>Note that this step has different instructions dependent on the platform <i class="term"><a href="critcl.html">CriTcl</a></i> is
216 to be installed on. In other words, only one of the sub sections applies, the other can be
217 ignored.</p>
218 <div id="subsection4" class="doctools_subsection"><h3><a name="subsection4">Install On Unix</a></h3>
219 <p>This section offers instructions for installing <i class="term"><a href="critcl.html">CriTcl</a></i> on various kinds of Unix and
220 Unix-related systems, i.e. <i class="term">Linux</i>, the various <i class="term">BSD</i>s, etc. It especially
221 covers <i class="term">Mac OS X</i> as well.</p>
222 <p>Use the instructions in section <span class="sectref"><a href="#subsection5">Install On Windows</a></span> when installing on a
223 Windows platform and not using a unix-like environment as provided by tools like
224 <a href="https://www.mingw-w64.org">MinGW</a>, <a href="https://www.cygwin.com/">CygWin</a>, <a href="https://gitforwindows.org">Git For Windows</a>, <a href="https://docs.microsoft.com/en-us/windows/wsl/faq">WSL</a>, etc.</p>
225 <ol class="doctools_enumerated">
226 <li><p>Change the working directory to the top level directory of the <i class="term"><a href="critcl.html">CriTcl</a></i>
227 checkout obtained by following the instructions of <i class="term"><a href="critcl_howto_sources.html">How To Get The CriTcl Sources</a></i>.</p></li>
228 <li><p>Verify that the file &quot;<b class="file">build.tcl</b>&quot; is marked executable. Make it executable if
229 it is not.</p></li>
230 <li><p>Invoke</p>
231 <pre class="doctools_example"> ./build.tcl install </pre>
232 <p>to perform the installation.</p>
233 <p><em>Attention</em> This command uses default locations for the placement of the
234 <b class="cmd"><a href="critcl.html">critcl</a></b> application, the various packages, and header files.</p></li>
235 <li><p>Invoke</p>
236 <pre class="doctools_example"> ./build.tcl dirs </pre>
237 <p>to see the chosens paths before actually
238 performing the installation.</p></li>
239 <li><p>Use the options listed below to change the paths used for installation as desired. This is
240 the same method as with <b class="cmd">configure</b> based packages.</p>
241 <dl class="doctools_options">
242 <dt><b class="option">--prefix</b> <i class="arg">path</i></dt>
243 <dd><p>Base path for non-package files.</p></dd>
244 <dt><b class="option">--include-dir</b> <i class="arg">path</i></dt>
245 <dd><p>Destination path for header files.</p></dd>
246 <dt><b class="option">--exec-prefix</b> <i class="arg">path</i></dt>
247 <dd><p>Base path for applications and packages.</p></dd>
248 <dt><b class="option">--bin-dir</b> <i class="arg">path</i></dt>
249 <dd><p>Destination path for applications.</p></dd>
250 <dt><b class="option">--lib-dir</b> <i class="arg">path</i></dt>
251 <dd><p>Destination path for packages.</p></dd>
252 </dl>
253 <p>These options are especially necessary in all environments not using the semi-standard
254 &quot;<b class="file">bin</b>&quot;, &quot;<b class="file">lib</b>&quot;, &quot;<b class="file">include</b>&quot; locations from <b class="syscmd">configure</b>.</p>
255 <p>As an example of such environments, Ubuntu (and possibly Debian) expect Tcl
256 packages to be installed into the &quot;<b class="file">/usr/share/tcltk</b>&quot; directory, therefore requiring
257 the use of</p>
258 <pre class="doctools_example">--lib-dir /usr/share/tcltk</pre>
259 <p>for proper installation.</p></li>
260 </ol>
261 <p><em>Note</em> that this guide neither covers the details of the <b class="method">install</b>
262 method, nor does it cover any of the other methods available through the <b class="cmd">build.tcl</b>
263 tool of <i class="term"><a href="critcl.html">CriTcl</a></i>.
264 These can be found in the <i class="term"><a href="critcl_build.html">CriTcl build.tcl Tool Reference</a></i>.</p>
265 </div>
266 <div id="subsection5" class="doctools_subsection"><h3><a name="subsection5">Install On Windows</a></h3>
267 <p>This section offers instructions for installing <i class="term"><a href="critcl.html">CriTcl</a></i> on a Windows (tm) host.
268 <em>Note</em> that environments as provided by tools like <a href="https://www.mingw-w64.org">MinGW</a>, <a href="https://www.cygwin.com/">CygWin</a>,
269 <a href="https://gitforwindows.org">Git For Windows</a>, <a href="https://docs.microsoft.com/en-us/windows/wsl/faq">WSL</a>, etc. are classed as Unix-like, and the instructions in section
270 <span class="sectref"><a href="#subsection4">Install On Unix</a></span> apply.</p>
271 <ol class="doctools_enumerated">
272 <li><p>In a DOS box, change the working directory to the top level directory of the
273 <i class="term"><a href="critcl.html">CriTcl</a></i> checkout obtained by following the instructions of
274 <i class="term"><a href="critcl_howto_sources.html">How To Get The CriTcl Sources</a></i>.</p></li>
275 <li><p>In the same DOS box, invoke</p>
276 <pre class="doctools_example"> tclsh.exe ./build.tcl install </pre>
277 <p>to perform
278 the installation.</p>
279 <p><em>Attention</em> This command uses default locations for the placement of the
280 <b class="cmd"><a href="critcl.html">critcl</a></b> application, the various packages, and header files.</p></li>
281 <li><p>Invoke</p>
282 <pre class="doctools_example"> tclsh.exe ./build.tcl dirs </pre>
283 <p>to see the chosens paths before
284 actually performing the installation.</p></li>
285 <li><p>Use the options listed below to change the paths used for installation as desired. This is
286 the same method as with <b class="cmd">configure</b> based packages.</p>
287 <dl class="doctools_options">
288 <dt><b class="option">--prefix</b> <i class="arg">path</i></dt>
289 <dd><p>Base path for non-package files.</p></dd>
290 <dt><b class="option">--include-dir</b> <i class="arg">path</i></dt>
291 <dd><p>Destination path for header files.</p></dd>
292 <dt><b class="option">--exec-prefix</b> <i class="arg">path</i></dt>
293 <dd><p>Base path for applications and packages.</p></dd>
294 <dt><b class="option">--bin-dir</b> <i class="arg">path</i></dt>
295 <dd><p>Destination path for applications.</p></dd>
296 <dt><b class="option">--lib-dir</b> <i class="arg">path</i></dt>
297 <dd><p>Destination path for packages.</p></dd>
298 </dl>
299 </li>
300 </ol>
301 <p><em>Attention!</em> The current installer does not put an extension on the
302 <b class="syscmd"><a href="critcl.html">critcl</a></b> application. This forces users to either explicitly choose the
303 <b class="syscmd">tclsh</b> to run the application, or manually rename the installed file to
304 &quot;<b class="file">critcl.tcl</b>&quot;. The latter assumes that an association for &quot;<b class="file">.tcl</b>&quot; is available, to
305 either <b class="syscmd">tclsh</b>, or <b class="syscmd">wish</b>.</p>
306 <p><em>Note</em> that this guide neither covers the details of the <b class="method">install</b>
307 method, nor does it cover any of the other methods available through the <b class="cmd">build.tcl</b>
308 tool of <i class="term"><a href="critcl.html">CriTcl</a></i>.
309 These can be found in the <i class="term"><a href="critcl_build.html">CriTcl build.tcl Tool Reference</a></i>.</p>
310 </div>
311 </div>
312 <div id="section4" class="doctools_section"><h2><a name="section4">Test The Installation</a></h2>
313 <p>Installing <i class="term"><a href="critcl.html">CriTcl</a></i> contains an implicit test of its functionality.</p>
314 <p>One of its operation modes uses the MD5 hash internally to generate unique ids for
315 sources, as a means of detecting changes. To make generation of such hashes fast a
316 <i class="term"><a href="critcl.html">CriTcl</a></i>-based package for MD5 is installed as part of the main installation process.</p>
317 <p>In other words, after installing the core packages of <i class="term"><a href="critcl.html">CriTcl</a></i> this partial
318 installation is used to build the rest.</p>
319 <p>This is possible because building a package from <i class="term"><a href="critcl.html">CriTcl</a></i>-based sources is the
320 operation mode not using MD5, therefore there is no circular dependency.</p>
321 <p>For our purposes this however is also a self-test of the system, verifying that the
322 core of <i class="term"><a href="critcl.html">CriTcl</a></i> works, as well as the C compiler.</p>
323 <p>For additional testing simply move on to section <b class="sectref">The First Package</b> of
324 the guide on <i class="term"><a href="critcl_howto_use.html">How To Use CriTcl</a></i>.</p>
325 </div>
326 <div id="section5" class="doctools_section"><h2><a name="section5">Authors</a></h2>
327 <p>Jean Claude Wippler, Steve Landers, Andreas Kupries</p>
328 </div>
329 <div id="section6" class="doctools_section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2>
330 <p>This document, and the package it describes, will undoubtedly contain
331 bugs and other problems.
332 Please report them at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a>.
333 Ideas for enhancements you may have for either package, application,
334 and/or the documentation are also very welcome and should be reported
335 at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a> as well.</p>
336 </div>
337 <div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
338 <p><a href="../index.html#c_code">C code</a>, <a href="../index.html#embedded_c_code">Embedded C Code</a>, <a href="../index.html#calling_c_code_from_tcl">calling C code from Tcl</a>, <a href="../index.html#code_generator">code generator</a>, <a href="../index.html#compile_run">compile &amp; run</a>, <a href="../index.html#compiler">compiler</a>, <a href="../index.html#dynamic_code_generation">dynamic code generation</a>, <a href="../index.html#dynamic_compilation">dynamic compilation</a>, <a href="../index.html#generate_package">generate package</a>, <a href="../index.html#linker">linker</a>, <a href="../index.html#on_demand_compilation">on demand compilation</a>, <a href="../index.html#on_the_fly_compilation">on-the-fly compilation</a></p>
339 </div>
340 <div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
341 <p>Glueing/Embedded C code</p>
342 </div>
343 <div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2>
344 <p>Copyright &copy; Jean-Claude Wippler<br>
345 Copyright &copy; Steve Landers<br>
346 Copyright &copy; 2011-2024 Andreas Kupries</p>
347 </div>
348 </div></body></html>