CVC3

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 the CVC3 Java library.
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 the file
00209 <code>libcvc3-X.Y.Z.jar</code> (where "X.Y.Z" is the CVC3 version) to
00210 the classpath (e.g., by setting the <code>CLASSPATH</code> environment
00211 variable) and both <code>libcvc3.so</code> and
00212 <code>libcvc3jni.so</code> to the runtime library path (e.g., by
00213 setting the <code>LD_LIBRARY_PATH</code> environment variable
00214 java.library.path JVM variable).
00215 
00216 For example, to compile the class Client.java:
00217 
00218 <pre>
00219     javac -cp lib/libcvc3-X.Y.Z.jar Client.java
00220 </pre>
00221 
00222 To run:
00223 
00224 <pre>
00225   export LD_LIBRARY_PATH=/path/to/cvc3/libs
00226   java -Djava.library.path=/path/to/cvc3/libs -cp lib/libcvc3-X.Y.Z.jar Client
00227 </pre>
00228 
00229 <!-- !!! THE .NET INTERFACE IS NO LONGER SUPPORTED !!!
00230 <h3>
00231 .NET interface
00232 </h3>
00233 
00234 <em><strong>Note: The .NET interface is experimental. The API may
00235 change in future releases.</strong></em>
00236 
00237 A .NET interface to the %CVC3 library can be built using Visual Studio
00238 2005 or later. To build the interface:
00239 
00240 <ol>
00241 <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:
00242   <ul>
00243   <li>Use the lexer/parser files created by a Cygwin build. It suffices to run Make in <code>src/parser</code>: 
00244 <pre>
00245 ./configure
00246 cd src/parser
00247 make
00248 </pre>
00249 </li>
00250 
00251   <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>
00252   </ul>
00253 </li>
00254 <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):
00255   <ul>
00256 <li>cvc3lib: the C++ %CVC3 library</li>
00257 <li>cvc3: the %CVC3 command-line program</li>
00258 <li>cvc3test: tests for cvc3lib</li>
00259 <li>cvc3libcli: the .NET %CVC3 library</li>
00260 <li>cvc3cli: a C# clone of the %CVC3 command-line program</li>
00261 <li>cvc3testcli: tests for cvc3libcli</li>
00262   </ul>
00263 </li>
00264 </ol>
00265 
00266 Each project can be built as usual with Visual Studio. Binaries will
00267 be put in the folders <code>windows/release</code> (for Release
00268 builds) and <code>windows/debug</code> (for Debug builds).
00269 
00270 For more information, see the file <code>windows/INSTALL</code>.
00271 
00272 <b>Note:</b> the .NET interface can only be used on Microsoft's CLR,
00273 because Visual Studio produces <a
00274 href="http://mono-project.com/CPlusPlus">mixed-mode assemblies</a>.
00275 -->
00276 
00277 <h3>
00278 Mac OS X
00279 </h3>
00280 
00281 Mac OS X uses <code>DYLD_LIBRARY_PATH</code> in place of
00282 <code>LD_LIBRARY_PATH</code>.
00283 
00284 On Intel Macs, by default, %CVC3 compiles in 32-bit or 64-bit mode
00285 based on the compiler's default.  If you want to build as one or
00286 the other in particular (for example, to match your libgmp
00287 installation), put CXXFLAGS=-m32 (and JREFLAGS=-d32, if you are
00288 compiling the Java bindings) in the environment when you run 
00289 configure.
00290 
00291 To run regression testing (make regress), you'll need GNU time.
00292 We suggest you install MacPorts (from macports.org) and then the
00293 "gtime" package.
00294 
00295 You'll need also a libgmp installation.  libgmp can be downloaded from
00296 gmplib.org.  If you install it in a nonstandard location (with
00297 ./configure --prefix=...) you'll need to give this location to CVC3
00298 when you configure it:
00299 
00300   ./configure --with-extra-includes=...--with-extra-libs=...
00301 
00302 or it may not find your installation of libgmp.
00303 
00304 <h3>
00305  Cygwin 
00306 </h3>
00307 
00308 In order to use GMP on Cygwin, make sure the following packages are
00309 installed: gmp, libgmp-devel, libgmp3, bison, flex, and make, as well
00310 as standard UNIX tools.
00311 
00312 On Windows, it's common to have directory names with embedded spaces.
00313 This can be problematic for the CVC3 build system.  Therefore on
00314 Cygwin we recommend symbolically linking to names without embedded
00315 spaces, something like the following:
00316 
00317 <pre>
00318   $ pwd
00319   /home/ACSys Group
00320   $ ln -s 'ACSys Group' /home/acsys
00321   $ export HOME=/home/acsys
00322   $ cd
00323   $ pwd
00324   /home/acsys
00325   $ cd cvc3
00326   $ ./configure --prefix=/home/acsys/cvc3.installation ...etc...
00327 </pre>
00328 
00329 On Windows, Sun's JDK doesn't install the Java compiler "javac" into the
00330 standard path for executables.  If you want to build Java bindings,
00331 you'll need to point CVC3 to it.  Again using symbolic linking as above:
00332 
00333 <pre>
00334   $ pwd
00335   /home/acsys/cvc3
00336   $ ln -s '/cygdrive/c/Program Files' /programs
00337   $ ./configure --enable-java --with-java-home=/programs/Java/jdk1.6.0_16 ...
00338 </pre>
00339 
00340 Such symbolic linking (and in general using cygwin full paths) may cause
00341 problems with non-cygwin programs.  In particular, if you have Windows
00342 emacs installed (instead of cygwin's emacs), you have a version of etags
00343 that may give errors at the end of the install.  These errors (about source
00344 files not existing when in fact they do) shouldn't break the build (make
00345 won't complain and bomb out; it's just that these are at the very end of
00346 the build, so it looks like they are causing problems) and can be safely
00347 ignored.
00348 
00349 <h3>
00350  <a name="64-bit Platforms">64-bit Platforms</a>
00351 </h3>
00352 
00353 When building %CVC3 on 64-bit platforms, you must compile %CVC3 in the
00354 same mode as any libraries it uses. For example, if GMP is compiled in
00355 64-bit mode, then %CVC3 must compiled in 64-bit mode as well. The
00356 configuration script will try to infer the correct compilation
00357 settings. You can run <code>./config.guess</code> to see the default
00358 platform type:
00359 
00360     $ ./config.guess
00361     i686-pc-linux-gnu
00362 
00363 You can use the <code>--build</code> argument to
00364 <code>configure</code> to override the default. For example, to
00365 compile in 64-bit mode on a x86-64 CPU, you can use <code>./configure
00366 --build=x86_64-pc-linux-gnu</code>.
00367 
00368 <h3>
00369   LLVM
00370 </h3>
00371 
00372 <em><strong>Note: Compiling %CVC3 with LLVM is not supported and 
00373 may cause runtime errors.</strong></em>
00374 
00375 To compile with LLVM, run configure with the options:
00376 
00377 <pre>
00378 ./configure CXX=llvm-gcc LIBS='-lstdc++'
00379 </pre>
00380 
00381 <h3>
00382 Other Configuration Options
00383 </h3>
00384 
00385 Other configuration options include where to install the results of
00386 "make install" (see below), what type of build to use (optimized,
00387 debug, gprof, or gcov), and whether to use static or dynamic
00388 libraries.  For help on these options, type
00389 
00390 <pre> 
00391 ./configure --help 
00392 </pre>
00393 
00394 configure creates the file Makefile.local which stores all of the
00395 configuration information.  If you want to customize your build
00396 without re-running configure, or if you want to customize it in a way
00397 that configure does not allow, you can do it by editing
00398 Makefile.local.  For example, you can build a debug, gprof version by
00399 editing Makefile.local and setting OPTIMIZED to 0 and GPROF to 1 (by
00400 default, gprof runs with an optimized executable).  Note that for most
00401 configuration options, the objects, libraries, and executables are
00402 stored in a configuration-dependent directory, with only symbolic
00403 links being stored in the main bin and lib directories.  This allows
00404 you to easily maintain multiple configurations and multiple platforms
00405 using the same source tree.
00406 
00407 <h4>
00408  Additional make options
00409 </h4>
00410 
00411 To rebuild dependencies, type:
00412 
00413 <pre> 
00414     make depend 
00415 </pre>
00416 
00417 To remove just the executable or libraries in the current
00418 configuration, type:
00419 
00420 <pre> 
00421     make spotty 
00422 </pre>
00423 
00424 To remove in addition all object files and makefile dependencies for
00425 the current configuration, type:
00426 
00427 <pre> 
00428     make clean 
00429 </pre>
00430 
00431 To remove all files that are not part of the distribution (including
00432 all object, library, and executables built for any configuration or
00433 platform), type:
00434 
00435 <pre> 
00436     make distclean 
00437 </pre>
00438 
00439 To build a tarball distribution of the current source tree, type:
00440 
00441 <pre> 
00442     make dist 
00443 </pre>
00444 
00445 \section installing Installing CVC3
00446 
00447 To install %CVC3 system-wide, (assuming you have already run configure)
00448 run:
00449 
00450 <pre>
00451     make install
00452 </pre>
00453 
00454 Installation depends on two configuration options: <code>prefix</code>
00455 and <code>exec_prefix</code>.  By default, both are set to
00456 <code>/usr/local</code>, but these can be overridden by specifying the
00457 correct arguments to configure or by editing
00458 <code>Makefile.local</code>.
00459 
00460 Installation copies all necessary header files to
00461 <code>$prefix/include/cvc3</code>. It installs the library
00462 <code>libcvc3</code> in <code>$exec_prefix/lib</code> and the
00463 executable <code>cvc3</code> in <code>$exec_prefix/bin</code>. By
00464 default, a static library and executable are installed.  If you want
00465 to install shared library versions, configure for shared libraries as
00466 described above.
00467 
00468 
00469 \section documentation Documentation
00470 
00471 To build HTML documentation, run
00472 
00473 <pre>
00474 
00475    make doc
00476 
00477 </pre>
00478 
00479 Then open <code>doc/html/index.html</code> in your favorite browser.
00480 
00481 \section faq Frequently Asked Questions
00482 
00483 <h3>
00484 Configuration Errors
00485 </h3>
00486 
00487 <h4>
00488 <code>libgmp.a is not found</code>
00489 </h4>
00490 
00491 Make sure the GMP library is in your <code>LD_LIBRARY_PATH</code> and
00492 <code>gmp.h</code> is in your <code>CPATH</code> (or use the
00493 <code>--with-extra-lib</code> and <code>--with-extra-include</code>
00494 arguments to <code>./configure</code>).
00495 
00496 If your paths are properly configured and you are compiling for a
00497 64-bit architecture, you may have a 32/64-bit mismatch. Check the
00498 binary type of the GMP library using the <code>file</code>
00499 utility. For example, running <code>file</code> on a 32-bit Linux GMP
00500 shared library will return:
00501 
00502 <pre>
00503     $ file /usr/lib/libgmp.so.3.4.2
00504     /usr/lib/libgmp.so.3.4.2: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
00505 </pre>
00506 
00507 You can use the <code>--build</code> arguments to
00508 <code>./configure</code> to set the target binary type for %CVC3. For
00509 example, <code>./configure --build=i686-linux-gnu</code> or
00510 <code>./configure --build=x86_64-linux-gnu</code>.
00511 
00512 <h4>
00513 <code>Unable to locate Java directories</code>
00514 </h4>
00515 
00516 Set the <code>JAVA_HOME</code> environment variable or use the
00517 <code>--with-java-home</code> argument to
00518 <code>./configure</code>. Some typical <code>JAVA_HOME</code> settings
00519 are as follows (where <em>X.Y.Z</em> is the version number of the installed
00520 Java runtime).
00521 
00522 <table>
00523 <tr>
00524 <th> Platform    </th><th> <code>JAVA_HOME</code> </th><th> Notes
00525 </th></tr>
00526 <tr>
00527 <td> Debian/Ubuntu Linux </td>
00528 <td> <code>/usr/lib/jvm/default-java</code> </td>
00529 <td> Install the <code>default-jre</code> or 
00530 <code>default-jre-headless</code> package </td></tr>
00531 <tr>
00532 <td>    Fedora Linux     </td>
00533 <td> <code>/usr/java/jre<em>X.Y.Z</em></code> </td>
00534 <td> </td></tr>
00535 <tr>
00536 <td>    Mac OS X         </td>
00537 <td> <code>/System/Library/Frameworks/JavaVM.framework/Home</code> </td>
00538 <td> </td></tr>
00539 <tr>
00540 <td>    Windows          </td>
00541 <td> <code>C:\\Program Files\\Java\\jdk<em>X.Y.Z</em></code> </td>
00542 <td> </td></tr>
00543 </table>
00544 
00545 <h3>
00546 Runtime Errors (CVC3 library)
00547 </h3>
00548 
00549 <h4>Segmentation fault when running a dynamically-linked executable.</h4>
00550 
00551 This can be caused by a mismatched "build type".  The debug and
00552 optimized version of the %CVC3 shared library are not binary
00553 compatible.  If you are linking against a debug version of the shared
00554 library, you must define the symbol _CVC3_DEBUG_MODE during
00555 compilation. E.g., add <code>-D_CVC3_DEBUG_MODE</code> to
00556 <code>CXXARGS</code>.
00557 
00558 <h4>Fatal error: <code>Mis-handled the ref. counting</code></h4>
00559 
00560 This can be cause by a number of problems. Make sure that all <code>Expr</code>
00561 objects are out of scope or have been manually deleted before deleting
00562 the <code>ValidityChecker</code>.
00563 
00564 <h4>
00565 <code>Exception in thread "main" java.lang.UnsatisfiedLinkError: no cvc3jni in java.library.path</code>
00566 </h4>
00567 
00568 The Java runtime was not able to find the %CVC3 JNI library. Use
00569 <code>java -Djava.library.path=PATH_TO_CVC3JNI</code>, where
00570 <code>PATH_TO_CVC3JNI</code> is the directory containing the file
00571 <code>libcvc3jni.so</code>.
00572 
00573 <h4>
00574 <code>Exception in thread "main" java.lang.UnsatisfiedLinkError: libcvc3jni.so.<em>x.y.z</em></code>
00575 </h4>
00576 
00577 The Java runtime was not able to satisfy the link dependencies of the
00578 %CVC3 JNI library. Make sure that the %CVC3 and GMP libraries are in
00579 your <code>LD_LIBRARY_PATH</code>.
00580 
00581 If your paths are properly configured and you are compiling for a
00582 64-bit architecture, you may have a 32/64-bit mismatch. Make sure the
00583 JVM is running in the same mode as the %CVC3 library using the
00584 <code>-d32</code> or <code>-d64</code> argument to <code>java</code>.
00585 
00586 <h4>
00587 On Mac: 
00588 <code>terminate called after throwing an instance of 'CVC3::TypecheckException'</code>
00589 </h4>
00590 
00591 This appears to be a bug in certain versions of GCC distributed by
00592 Apple. Upgrade to XCode 3.1.2 or later (GCC version "4.0.1 (Apple
00593 Inc. build 5490)") or configure with <code>CXXFLAGS=-01</code>.
00594 
00595 \section help Getting help
00596 
00597 If you find a problem with the instructions in this installation guide, please
00598 send email to <a href="mailto:cvc-bugs@cs.nyu.edu">cvc-bugs@cs.nyu.edu</a>.
00599 
00600 */