The following resources discuss building software from autotools source packages on GNU/Linux, but most of the advice applies to other POSIX operating systems.
Bear should build and run successfully in any POSIX-like environment (unix, GNU/Linux, etc.); it is known to build on several GNU/Linux distributions, Mac OS X 10.2 (and probably other OS X releases), FreeBSD 4.8, and Solaris.
If you plan to use Bear, it is a good idea to also build and install Stephen Johnson's h5utils package, which includes a number of utilities for manipulating HDF5 data files. The h5topng command is especially useful, as it can produce Bers slice images from Bear output files.
tar --gzip -xvf bear-0.9.6.tar.gzThis will unpack the source files into a subdirectory, which in this case is called bear-0.9.6. To configure the Bear build process, change to this directory and run
./configureor a variant of this command with options appropriate for your situation; detailed instructions for running configure can be found in the file 'INSTALL', which is included in the source distribution. The most common configuration option is probably '--prefix', which indicates where Bear should eventually be installed on your system. If you are working on a multi-user system where you can execute commands as the root user, '/usr/local' may be a good choice. The associated configure command would then be:
./configure --prefix=/usr/localIf you do not have root access or only want to install Bear in your own account, you can set the prefix to your home directory, which is usally accomplished by:
./configure --prefix=~Assuming the configuration suceeds (if it does not, see Common Problems below), you can compile Bear by running make:
makeThe build process can take anywhere from a few seconds to a few minutes, and will produce a lot of output. If the build succeeds (i.e. does not stop because of an error), you can then install Bear with
make installwhich will copy a number of files created during the build process, including the Bear executable, to subdirectories of the installation prefix (e.g. '/usr/local' in the example above). If you are not the root user, you may not have access to '/usr/local'. Thus, if you want to install Bear in this directory you may need to execute 'make install' as root.
If you have the h5utils package (see Required Libraries and Utilities above), you may also want to run the experimental test suite included with Bear using the command:
make checkThis will run a couple of small Bers slice calculations, store the output, and compare it to reference data. If any significant differences are discovered, the test 'fails', though this may or may not indicate a serious problem.
When configure fails, it usually produces an error message describing the problem. This is supposed to be enough to determine an appropriate corrective action, but in case it is not, a more detailed log of what happened can be found in the file config.log. This file contains the concatenated output of every command configure (which is itself a very long shell script) runs.
If it is missing, you need to install the library and associated header files, either by building it from source or by installing binary packages created for your operating system. (See Installing Bear from a binary package for information on how to install the required libraries for some popular Linux distributions.)
If the library is installed in a place where configure cannot find it, then you may be able to resolve the problem by setting environment variables that configure and the C compiler use when looking for libraries and include files. For example, suppose that GSL is the missing library. We should first locate the GSL shared library files:
locate '*libgsl.*so*'
/usr/local/gsl-1.4/lib/libgsl.so /usr/local/gsl-1.4/lib/libgsl.so.0 /usr/local/gsl-1.4/lib/libgsl.so.0.7.0Thus it seems the shared library files for GSL are located in /usr/local/gsl-1.4/lib, a non-standard location that configure could not find. When a library is in a non-standard place, it is likely that the header files are also there, so we should look for those as well. In this case, we look for the GSL header file gsl_math.h:
locate 'gsl_math.h'
/usr/local/gsl-1.4/include/gsl/gsl_math.hSo the header files for GSL appear to be in /usr/local/gsl-1.4/include/gsl; however, GSL headers are expected to be in a subdirectory of an include directory called gsl, so the include directory is just /usr/local/gsl-1.4/include.
To advise configure of these locations, we set the enviroment variables CPPFLAGS (which stands for C preprocessor flags) and LDFLAGS (which tells the dynamic library loader ld where to find things). Using a Bourne-compatible shell (e.g. bash), this can be accomplished as follows:
CPPFLAGS="$CPPFLAGS -I/usr/local/gsl-1.4/include" LDFLAGS="$LDFLAGS -L/usr/local/gsl-1.4/lib" ./configureThese commands should be executed in the root directory of the Bear source code. The settings above use the directories from our example, but the general scheme is:
su
Password:
make install exitHowever, if you are not a system administrator on the computer where you want to install Bear, it is better to choose an install directory within your home directory. To do this, add --prefix=~ as an option to configure. After this, you should repeat the 'make', 'make install' sequence.