Dmalloc Logo


Search this site:

If dmalloc has saved you or your company time or money, please use your credit-card or PayPal account to donate to the cause.

Dmalloc Tutorial: 2.1 How to Install the Library
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 How to Install the Library

To configure, compile, and install the library, follow these steps carefully.

  1. Make sure you have downloaded the latest version of the library available from the home page at URL
  2. The release files have a `.tgz' file extension which means that they are a tar'd gzip'd directory of files. You will need to ungzip and then untar the release file into your source work directory. You may have to rename the file to `.tar.gz' to get some old zip programs to handle the file correctly.
  3. You may want to edit or at least review the settings in `settings.dist' to tune specific features of the library. The `configure' script will copy this file to `settings.h' which is where you should be adding per-architecture settings.
  4. Type sh ./configure to configure the library. You may want to first examine the `' file for some information about configure. You may want to use the --disable-cxx option if you do not want the Makefile to build the C++ version of dmalloc. You may want to use the --enable-threads option to build the threaded version of dmalloc. You may want to use the --enable-shlib option to build the shared versions of the dmalloc libraries. sh ./configure --help lists the available options to configure. Configure should generate the `Makefile' and configuration files automatically.
  5. You may want to examine the `Makefile' and `conf.h' files created by configure to make sure it did its job correctly.
  6. You might want to tune the settings in `settings.h' file to tune the library to the local architecture. This file contains relevant settings if you are using pthreads or another thread library. See section Using the Library with a Thread Package. The `configure' script created this file from the `settings.dist' file. Any permanent changes to these settings should made to the `settings.dist' file. You then can run `config.status' to re-create the `settings.h' file.
  7. The DMALLOC_SIZE variable gets auto-configured in `dmalloc.h.2' but it may not generate correct settings for all systems. You may have to alter the definitions in this file to get things to stop complaining when you go to compile about the size arguments to malloc routines. Comments on this please.
  8. Typing make should be enough to build `libdmalloc.a', and `dmalloc' program. If it does not work, please see if there are any notes in the contrib directory about your system-type. If not and you figure your problem out, please send me some notes so future users can profit from your experiences.

    NOTE: You may experience some errors compiling some of the `return.h' assembly macros which attempt to determine the callers address for logging purposes. See section Issues Important for Porting the Library. You may want to first try disabling any compiler optimization flags. If this doesn't work then you may need to disable the `USE_RETURN_MACROS' variable in the `settings.h' file.

    NOTE: The code is dependent on an ANSI-C compiler. If the configure script gives the `WARNING' that you do not have an ANSI-C compiler, you may still be able to add some sort of option to your compiler to make it ANSI. If there such is an option, please send it to the author so it can be added to the configure script.

  9. If you use threads and did not add the --enable-threads argument to configure, typing make threads should be enough to build `libdmallocth.a' which is the threaded version of the library. This may or may not work depending on the configuration scripts ability to detect your local thread functionality. Feel free to send me mail with improvements.

    See the section of the manual on threads for more information about the operation of the library with your threaded program. See section Using the Library with a Thread Package.

  10. If you have a C++ compiler installed, the library should have automatically built `libdmallocxx.a' which is the C++ version of the library. If it was not done automatically, you can build it by typing make cxx. You should link this library into your C++ programs instead of `libdmalloc.a'. See the `' C++ file which contains basic code to overload the new, new[], delete, and delete[] C++ operators. My apologies on the minimal C++ support. I am still living in a mostly C world. Any help improving this interface without sacrificing portability would be appreciated.
  11. Typing make light should build and run the `dmalloc_t' test program through a set of light trials. By default this will execute `dmalloc_t' 5 times - each time will execute 10,000 malloc operations in a very random manner. Anal folks can type make heavy to up the ante. Use dmalloc_t --usage for the list of all `dmalloc_t' options.
  12. Typing make install should install the `libdmalloc.a' library in `/usr/local/lib', the `dmalloc.h' include file in `/usr/local/include', and the `dmalloc' utility in `/usr/local/bin'. You may also want to type make installth to install the thread library into place and/or make installcc to install the C++ library into place.

    You may have specified a `--prefix=PATH' option to configure in which case `/usr/local' will have been replaced with `PATH'.

See the "Getting Started" section to get up and running with the library. See section Getting Started with the Library.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Gray Watson on May, 16 2007 using texi2html 1.76.

This work is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.
This page should be W3C Valid XHTML and should work with most browsers.