INSTALL

Go to the documentation of this file.
00001 /*!
00002 
00003 \page INSTALL INSTALL
00004 
00005 <strong>Contents:</strong>
00006 
00007 <ul>
00008 <li>\ref quickstart</li>
00009 <li>\ref requirements</li>
00010 <li>\ref advanced</li>
00011 <li>\ref installing</li>
00012 <li>\ref documentation</li>
00013 <li>\ref faq</li>
00014 <li>\ref help</li>
00015 </ul>
00016 
00017 \section quickstart Quick Start
00018 
00019 You can download a source distribution of %CVC3 from the
00020 <a href="http://www.cs.nyu.edu/acsys/cvc3/download.html">CVC3 downloads
00021 page</a>. Save the source archive as <code>cvc3.tar.gz</code> in the
00022 directory of your choice and extract the contents using your favorite
00023 archive program (you can use <code>tar xzvf cvc3.tar.gz</code> from a
00024 terminal). This will create a directory containing the source of
00025 %CVC3, normally called <code>cvc3-XXX</code>. In the following we will
00026 denote the this directory as <code>$CVC3_SRC</code>. To build %CVC3,
00027 open your favorite terminal program and run the following sequence of
00028 commands
00029 
00030 <pre>
00031    cd $CVC3_SRC
00032    ./configure
00033    make
00034 </pre>
00035 
00036 If any part of the build process fails, please read the following section for more information.
00037 
00038 A successful build will create a library <code>libcvc3</code> in the
00039 <code>$CVC3_SRC/lib</code> directory, and an executable
00040 <code>cvc3</code> in the <code>$CVC3_SRC/bin</code> directory (these
00041 are symbolic links to the actual files which are stored in
00042 architecture- and configuration-dependent subdirectories). The
00043 directory <code>$CVC3_SRC/test</code> contains an example program
00044 using the %CVC3 library <code>libcvc3</code>. To try it out, run the
00045 following commands in the terminal:
00046 
00047 <pre>
00048    cd test
00049    make
00050    bin/test
00051 </pre>
00052 
00053 By default, <code>make</code> will build optimized code, static
00054 libraries, and a static executable. To build the "debug" version (much
00055 slower but with more error checking) use the following configuration
00056 command instead:
00057 
00058 <pre>
00059    ./configure --with-build=debug
00060 </pre>
00061 
00062 In case you prefer to build shared libraries (and thus a much smaller
00063 executable), use the following configuration command:
00064 
00065 <pre>
00066   ./configure --enable-dynamic
00067 </pre>
00068 
00069 If you do choose to buld the shared libraries, you must set your
00070 <code>LD_LIBRARY_PATH</code> environment variable to
00071 <code>$CVC3_SRC/lib</code> before running %CVC3 or using the shared
00072 libraries.
00073 
00074 Alternatively, these and other options can be changed by editing the
00075 <code>Makefile.local</code> file after running
00076 <code>configure</code>.  However, be aware that re-running
00077 <code>configure</code> will overwrite any changes you have made to
00078 <code>Makefile.local</code>.
00079 
00080 \section requirements Requirements
00081 
00082 %CVC3 has the following build dependencies:
00083 
00084 <ul>
00085 <li><a href="http://www.gnu.org/software/gcc/">GCC</a> version 3.0 or later</li>
00086 <li><a href="http://www.gnu.org/software/bash/">Bash</a></li>
00087 <li><a href="http://flex.sourceforge.net/">Flex</a></li>
00088 <li><a href="http://www.gnu.org/software/bison/">Bison</a></li>
00089 <li><a href="http://gmplib.org/">GMP</a> <em>(recommended)</em></li>
00090 <li>A <a href="http://python.org/">Python</a> interpreter 
00091 <em>(optional, for Java support)</em></li>
00092 <li>A <a href="http://java.sun.com/">Java</a> compiler 
00093 <em>(optional, for Java support)</em></li>
00094 </ul>
00095 
00096 All of these tools are available from common package repositories
00097 (e.g., Debian, Ubuntu, Red Hat, Cygwin).
00098 
00099 \section advanced Advanced Configuration
00100 
00101 The configure script checks for the components needed to build %CVC3.
00102 If for some reason, the configure script is missing or doesn't run on
00103 your platform, you can recreate it from <code>configure.ac</code> by
00104 running <code>autoconf</code>.
00105 
00106 As the configure script runs, if something is not found, it
00107 complains. configure looks for components in standard locations and
00108 also uses several environment variables that you can set to help it
00109 find things. In particular, you can set <code>CPPFLAGS</code> to
00110 &quot;<code>-I $includeDir</code>&quot; if you have headers in a nonstandard
00111 directory <code>$includeDir</code>, and <code>LDFLAGS</code> to
00112 &quot;<code>-L $libDir</code>&quot; if you have libraries in a nonstandard
00113 directory <code>$libDir</code>. Alternatively you can pass these
00114 directories to the <code>configure</code> script using the following
00115 command
00116 
00117 <pre>
00118     ./configure --with-extra-includes=$includeDir --with-extra-libs=$libDir
00119 </pre>
00120 
00121 Run <code>./configure --help</code> for a list of all such environment
00122 variables and options.
00123 
00124 <h3>
00125 GMP
00126 </h3>
00127 
00128 One of the components %CVC3 depends on is the GNU Multiple Precision (GMP)
00129 library.  Many Unix-like distributions include gmp packages.
00130 
00131 If you do not have GMP installed or your installation does not work, we
00132 recommend that you install it manually:
00133 
00134 1. Download the GMP source code from http://gmplib.org/
00135 
00136 2. Unpack the sources, and from the root-directory of the GMP source code, run
00137 
00138 <pre>
00139    ./configure 
00140    make
00141 </pre>
00142 
00143    On some Solaris machines, you may need to configure GMP with
00144   
00145 <pre>
00146    ./configure ABI=32
00147 </pre>
00148 
00149    to make the resulting GMP library compatible with the %CVC3
00150    libraries.  The reason for this is that the default ABI that gcc
00151    chooses in %CVC3 compilation is not necessarily the default ABI
00152    that the GMP configure script selects, and one of them may need to be
00153    adjusted.
00154 
00155 3. Now, either install GMP system-wide (make install), or supply the
00156    appropriate values for CPPFLAGS and LDFLAGS to the %CVC3 configure script.
00157 
00158 If for some reason, you do not want to use GMP, you can configure %CVC3 to use
00159 native arithmetic by running:
00160 
00161 <pre>
00162    ./configure --with-arith=native
00163 </pre>
00164 
00165 If you compile %CVC3 with native arithmetic, it is possible that %CVC3 may fail
00166 as the result of arithmetic overflow.  If an overflow occurs, you will get
00167 an error message and %CVC3 will abort.
00168 
00169 <h3>
00170 Java interface
00171 </h3>
00172 
00173 <em><strong>Note: The Java interface is experimental. The API may
00174 change in future releases.</strong></em>
00175 
00176 To build the Java interface to %CVC3, use the
00177 <code>--enable-java</code> configuration option.  The configuration
00178 script refers to the environment variables <code>JAVAC</code>,
00179 <code>JAVAH</code>, <code>JAR</code>, and <code>CXX</code> to set up
00180 the standard Java and C++ compiler commands. It refers to the
00181 environment variable <code>JFLAGS</code> for default Java compiler
00182 flags. It refers to the variable <code>javadir</code> for the
00183 installation directory of <code>libcvc3.jar</code>.
00184 
00185 The configuration options <code>--with-java-home</code> and
00186 <code>--with-java-includes</code> can be used to specify the path to
00187 the directories containing the JDK installation and JNI header files,
00188 respectively.
00189 
00190 You must build %CVC3 as a dynamic library to use the Java
00191 interface. For example, you might configure the build by running the
00192 following in the top-level %CVC3 directory:
00193 
00194 <pre>
00195     ./configure --enable-dynamic --enable-java
00196 </pre>
00197 
00198 <b>Note:</b> The Java interface depends on the "build type" (e.g.,
00199 "optimized", "debug") of %CVC3. If you choose to re-configure and
00200 re-build %CVC3 with a different build type, you must run "make clean"
00201 in the current directory and re-build the interface (cleaning and 
00202 rebuilding the entire %CVC3 package will suffice).
00203 
00204 <h4>
00205 Using the Java interface
00206 </h4>
00207 
00208 To access the library, you must add <code>libcvc3.jar</code> to the
00209 classpath (e.g., by setting the <code>CLASSPATH</code> environment
00210 variable) and both <code>libcvc3.so</code> and
00211 <code>libcvc3jni.so</code> to the runtime library path (e.g., by
00212 setting the <code>LD_LIBRARY_PATH</code> environment variable
00213 java.library.path JVM variable).
00214 
00215 For example, to compile the class Client.java:
00216 
00217 <pre>
00218     javac -cp lib/libcvc3.jar Client.java
00219 </pre>
00220 
00221 To run:
00222 
00223 <pre>
00224   export LD_LIBRARY_PATH=/path/to/cvc3/libs
00225   java -Djava.library.path=/path/to/cvc3/libs -cp lib/libcvc3.jar Client
00226 </pre>
00227 
00228 <h3>
00229 .NET interface
00230 </h3>
00231 
00232 <em><strong>Note: The .NET interface is experimental. The API may
00233 change in future releases.</strong></em>
00234 
00235 A .NET interface to the %CVC3 library can be built using Visual Studio
00236 2005 or later. To build the interface:
00237 
00238 <ol>
00239 <li>The lexers and parsers for the supported input languages need to be generated outside of Visual Studio. This can be done in two ways:
00240   <ul>
00241   <li>Use the lexer/parser files created by a Cygwin build. It suffices to run Make in <code>src/parser</code>: 
00242 <pre>
00243 ./configure
00244 cd src/parser
00245 make
00246 </pre>
00247 </li>
00248 
00249   <li>Run the script <code>make_parser.bat</code> in directory <code>src/parser</code> with the native Windows versions of <a href="http://gnuwin32.sourceforge.net/packages/flex.htm">Flex</a> and <a href="http://gnuwin32.sourceforge.net/packages/bison.htm">Bison</a>.</li>
00250   </ul>
00251 </li>
00252 <li>Open the solution file <code>windows/cvc3.sln</code> in Visual Studio. The solution file contains the following projects (each with Debug/Release versions):
00253   <ul>
00254 <li>cvc3lib: the C++ %CVC3 library</li>
00255 <li>cvc3: the %CVC3 command-line program</li>
00256 <li>cvc3test: tests for cvc3lib</li>
00257 <li>cvc3libcli: the .NET %CVC3 library</li>
00258 <li>cvc3cli: a C# clone of the %CVC3 command-line program</li>
00259 <li>cvc3testcli: tests for cvc3libcli</li>
00260   </ul>
00261 </li>
00262 </ol>
00263 
00264 Each project can be built as usual with Visual Studio. Binaries will
00265 be put in the folders <code>windows/release</code> (for Release
00266 builds) and <code>windows/debug</code> (for Debug builds).
00267 
00268 For more information, see the file <code>windows/INSTALL</code>.
00269 
00270 <b>Note:</b> the .NET interface can only be used on Microsoft's CLR,
00271 because Visual Studio produces <a
00272 href="http://mono-project.com/CPlusPlus">mixed-mode assemblies</a>.
00273 
00274 <h3>
00275 Mac OS X
00276 </h3>
00277 
00278 Mac OS X uses <code>DYLD_LIBRARY_PATH</code> in place of
00279 <code>LD_LIBRARY_PATH</code>.
00280 
00281 On Intel Macs, by default, %CVC3 compiles in 32-bit or 64-bit mode
00282 based on the compiler's default.  If you want to build as one or
00283 the other in particular (for example, to match your libgmp
00284 installation), put CXXFLAGS=-m32 (and JREFLAGS=-d32, if you are
00285 compiling the Java bindings) in the environment when you run 
00286 configure.
00287 
00288 To run regression testing (make regress), you'll need GNU time.
00289 We suggest you install MacPorts (from macports.org) and then the
00290 "gtime" package.
00291 
00292 You'll need also a libgmp installation.  libgmp can be downloaded from
00293 gmplib.org.  If you install it in a nonstandard location (with
00294 ./configure --prefix=...) you'll need to give this location to CVC3
00295 when you configure it:
00296 
00297   ./configure --with-extra-includes=...--with-extra-libs=...
00298 
00299 or it may not find your installation of libgmp.
00300 
00301 <h3>
00302  Cygwin 
00303 </h3>
00304 
00305 In order to use GMP on Cygwin, make sure the following packages are
00306 installed: gmp, libgmp-devel, libgmp3, bison, flex, and make, as well
00307 as standard UNIX tools.
00308 
00309 On Windows, it's common to have directory names with embedded spaces.
00310 This can be problematic for the CVC3 build system.  Therefore on
00311 Cygwin we recommend symbolically linking to names without embedded
00312 spaces, something like the following:
00313 
00314 <pre>
00315   $ pwd
00316   /home/ACSys Group
00317   $ ln -s 'ACSys Group' /home/acsys
00318   $ export HOME=/home/acsys
00319   $ cd
00320   $ pwd
00321   /home/acsys
00322   $ cd cvc3
00323   $ ./configure --prefix=/home/acsys/cvc3.installation ...etc...
00324 </pre>
00325 
00326 On Windows, Sun's JDK doesn't install the Java compiler "javac" into the
00327 standard path for executables.  If you want to build Java bindings,
00328 you'll need to point CVC3 to it.  Again using symbolic linking as above:
00329 
00330 <pre>
00331   $ pwd
00332   /home/acsys/cvc3
00333   $ ln -s '/cygdrive/c/Program Files' /programs
00334   $ ./configure --enable-java --with-java-home=/programs/Java/jdk1.6.0_16 ...
00335 </pre>
00336 
00337 Such symbolic linking (and in general using cygwin full paths) may cause
00338 problems with non-cygwin programs.  In particular, if you have Windows
00339 emacs installed (instead of cygwin's emacs), you have a version of etags
00340 that may give errors at the end of the install.  These errors (about source
00341 files not existing when in fact they do) shouldn't break the build (make
00342 won't complain and bomb out; it's just that these are at the very end of
00343 the build, so it looks like they are causing problems) and can be safely
00344 ignored.
00345 
00346 <h3>
00347  <a name="64-bit Platforms">64-bit Platforms</a>
00348 </h3>
00349 
00350 When building %CVC3 on 64-bit platforms, you must compile %CVC3 in the
00351 same mode as any libraries it uses. For example, if GMP is compiled in
00352 64-bit mode, then %CVC3 must compiled in 64-bit mode as well. The
00353 configuration script will try to infer the correct compilation
00354 settings. You can run <code>./config.guess</code> to see the default
00355 platform type:
00356 
00357     $ ./config.guess
00358     i686-pc-linux-gnu
00359 
00360 You can use the <code>--build</code> argument to
00361 <code>configure</code> to override the default. For example, to
00362 compile in 64-bit mode on a x86-64 CPU, you can use <code>./configure
00363 --build=x86_64-pc-linux-gnu</code>.
00364 
00365 <h3>
00366   LLVM
00367 </h3>
00368 
00369 <em><strong>Note: Compiling %CVC3 with LLVM is not supported and 
00370 may cause runtime errors.</strong></em>
00371 
00372 To compiler with LLVM, run configure with the options:
00373 
00374 <pre>
00375 ./configure CXX=llvm-gcc LIBS='-lstdc++'
00376 </pre>
00377 
00378 <h3>
00379 Other Configuration Options
00380 </h3>
00381 
00382 Other configuration options include where to install the results of
00383 "make install" (see below), what type of build to use (optimized,
00384 debug, gprof, or gcov), and whether to use static or dynamic
00385 libraries.  For help on these options, type
00386 
00387 <pre> 
00388 ./configure --help 
00389 </pre>
00390 
00391 configure creates the file Makefile.local which stores all of the
00392 configuration information.  If you want to customize your build
00393 without re-running configure, or if you want to customize it in a way
00394 that configure does not allow, you can do it by editing
00395 Makefile.local.  For example, you can build a debug, gprof version by
00396 editing Makefile.local and setting OPTIMIZED to 0 and GPROF to 1 (by
00397 default, gprof runs with an optimized executable).  Note that for most
00398 configuration options, the objects, libraries, and executables are
00399 stored in a configuration-dependent directory, with only symbolic
00400 links being stored in the main bin and lib directories.  This allows
00401 you to easily maintain multiple configurations and multiple platforms
00402 using the same source tree.
00403 
00404 <h4>
00405  Additional make options
00406 </h4>
00407 
00408 To rebuild dependencies, type:
00409 
00410 <pre> 
00411     make depend 
00412 </pre>
00413 
00414 To remove just the executable or libraries in the current
00415 configuration, type:
00416 
00417 <pre> 
00418     make spotty 
00419 </pre>
00420 
00421 To remove in addition all object files and makefile dependencies for
00422 the current configuration, type:
00423 
00424 <pre> 
00425     make clean 
00426 </pre>
00427 
00428 To remove all files that are not part of the distribution (including
00429 all object, library, and executables built for any configuration or
00430 platform), type:
00431 
00432 <pre> 
00433     make distclean 
00434 </pre>
00435 
00436 To build a tarball distribution of the current source tree, type:
00437 
00438 <pre> 
00439     make dist 
00440 </pre>
00441 
00442 \section installing Installing CVC3
00443 
00444 To install %CVC3 system-wide, (assuming you have already run configure)
00445 run:
00446 
00447 <pre>
00448     make install
00449 </pre>
00450 
00451 Installation depends on two configuration options: <code>prefix</code>
00452 and <code>exec_prefix</code>.  By default, both are set to
00453 <code>/usr/local</code>, but these can be overridden by specifying the
00454 correct arguments to configure or by editing
00455 <code>Makefile.local</code>.
00456 
00457 Installation copies all necessary header files to
00458 <code>$prefix/include/cvc3</code>. It installs the library
00459 <code>libcvc3</code> in <code>$exec_prefix/lib</code> and the
00460 executable <code>cvc3</code> in <code>$exec_prefix/bin</code>. By
00461 default, a static library and executable are installed.  If you want
00462 to install shared library versions, configure for shared libraries as
00463 described above.
00464 
00465 
00466 \section documentation Documentation
00467 
00468 To build HTML documentation, run
00469 
00470 <pre>
00471 
00472    make doc
00473 
00474 </pre>
00475 
00476 Then open <code>doc/html/index.html</code> in your favorite browser.
00477 
00478 \section faq Frequently Asked Questions
00479 
00480 <h3>
00481 Configuration Errors
00482 </h3>
00483 
00484 <h4>
00485 <code>libgmp.a is not found</code>
00486 </h4>
00487 
00488 Make sure the GMP library is in your <code>LD_LIBRARY_PATH</code> and
00489 <code>gmp.h</code> is in your <code>CPATH</code> (or use the
00490 <code>--with-extra-lib</code> and <code>--with-extra-include</code>
00491 arguments to <code>./configure</code>).
00492 
00493 If your paths are properly configured and you are compiling for a
00494 64-bit architecture, you may have a 32/64-bit mismatch. Check the
00495 binary type of the GMP library using the <code>file</code>
00496 utility. For example, running <code>file</code> on a 32-bit Linux GMP
00497 shared library will return:
00498 
00499 <pre>
00500     $ file /usr/lib/libgmp.so.3.4.2
00501     /usr/lib/libgmp.so.3.4.2: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
00502 </pre>
00503 
00504 You can use the <code>--build</code> arguments to
00505 <code>./configure</code> to set the target binary type for %CVC3. For
00506 example, <code>./configure --build=i686-linux-gnu</code> or
00507 <code>./configure --build=x86_64-linux-gnu</code>.
00508 
00509 <h4>
00510 <code>Unable to locate Java directories</code>
00511 </h4>
00512 
00513 Set the <code>JAVA_HOME</code> environment variable or use the
00514 <code>--with-java-home</code> argument to
00515 <code>./configure</code>. Some typical <code>JAVA_HOME</code> settings
00516 are as follows (where <em>X.Y.Z</em> is the version number of the installed
00517 Java runtime).
00518 
00519 <table>
00520 <tr>
00521 <th> Platform    </th><th> <code>JAVA_HOME</code> </th><th> Notes
00522 </th></tr>
00523 <tr>
00524 <td> Debian/Ubuntu Linux </td>
00525 <td> <code>/usr/lib/jvm/default-java</code> </td>
00526 <td> Install the <code>default-jre</code> or 
00527 <code>default-jre-headless</code> package </td></tr>
00528 <tr>
00529 <td>    Fedora Linux     </td>
00530 <td> <code>/usr/java/jre<em>X.Y.Z</em></code> </td>
00531 <td> </td></tr>
00532 <tr>
00533 <td>    Mac OS X         </td>
00534 <td> <code>/System/Library/Frameworks/JavaVM.framework/Home</code> </td>
00535 <td> </td></tr>
00536 <tr>
00537 <td>    Windows          </td>
00538 <td> <code>C:\\Program Files\\Java\\jdk<em>X.Y.Z</em></code> </td>
00539 <td> </td></tr>
00540 </table>
00541 
00542 <h3>
00543 Runtime Errors (CVC3 library)
00544 </h3>
00545 
00546 <h4>Segmentation fault when running a dynamically-linked executable.</h4>
00547 
00548 This can be caused by a mismatched "build type".  The debug and
00549 optimized version of the %CVC3 shared library are not binary
00550 compatible.  If you are linking against a debug version of the shared
00551 library, you must define the symbol _CVC3_DEBUG_MODE during
00552 compilation. E.g., add <code>-D_CVC3_DEBUG_MODE</code> to
00553 <code>CXXARGS</code>.
00554 
00555 <h4>Fatal error: <code>Mis-handled the ref. counting</code></h4>
00556 
00557 This can be cause by a number of problems. Make sure that all <code>Expr</code>
00558 objects are out of scope or have been manually deleted before deleting
00559 the <code>ValidityChecker</code>.
00560 
00561 <h4>
00562 <code>Exception in thread "main" java.lang.UnsatisfiedLinkError: no cvc3jni in java.library.path</code>
00563 </h4>
00564 
00565 The Java runtime was not able to find the %CVC3 JNI library. Use
00566 <code>java -Djava.library.path=PATH_TO_CVC3JNI</code>, where
00567 <code>PATH_TO_CVC3JNI</code> is the directory containing the file
00568 <code>libcvc3jni.so</code>.
00569 
00570 <h4>
00571 <code>Exception in thread "main" java.lang.UnsatisfiedLinkError: libcvc3jni.so.<em>x.y.z</em></code>
00572 </h4>
00573 
00574 The Java runtime was not able to satisfy the link dependencies of the
00575 %CVC3 JNI library. Make sure that the %CVC3 and GMP libraries are in
00576 your <code>LD_LIBRARY_PATH</code>.
00577 
00578 If your paths are properly configured and you are compiling for a
00579 64-bit architecture, you may have a 32/64-bit mismatch. Make sure the
00580 JVM is running in the same mode as the %CVC3 library using the
00581 <code>-d32</code> or <code>-d64</code> argument to <code>java</code>.
00582 
00583 <h4>
00584 On Mac: 
00585 <code>terminate called after throwing an instance of 'CVC3::TypecheckException'</code>
00586 </h4>
00587 
00588 This appears to be a bug in certain versions of GCC distributed by
00589 Apple. Upgrade to XCode 3.1.2 or later (GCC version "4.0.1 (Apple
00590 Inc. build 5490)") or configure with <code>CXXFLAGS=-01</code>.
00591 
00592 \section help Getting help
00593 
00594 If you find a problem with the instructions in this installation guide, please
00595 send email to <a href="mailto:cvc-bugs@cs.nyu.edu">cvc-bugs@cs.nyu.edu</a>.
00596 
00597 */

Generated on Wed Nov 18 16:13:30 2009 for CVC3 by  doxygen 1.5.2