Thot Editor Opera Project

Compiling Thot Editor Sources with Autoconf

Home

Downloading

Installing

Compiling

Using

Developing

Place here the content of the page

This document explains how to compile the Thot Editor environment (Thot Editor binary and Thot schemas compilers) from the distributed source tree.

Prerequisite:

  • We strongly recommend to use a GNU make and if possible GNU CC since these are the tools used by theOpera Team, and very few testings have been done with other flavours of make and C compilers.
  • You need the Thot library source code archive thot-src-xxx.tar.gz and the Thot Editor source code archive thoteditor-src-yyy.tar.gz.
  • Having usual Unix development tools, at least sed, awk and cpp should be available.
  • Thot Editor requires X-Windows (X11R5 or X11R6) and Motif (1.2.x or 2.0) or Lesstif (free Motif clone).

How to build in 4 steps:

Here is a simple recipe explaining how to build using autoconf:

  1. install your source code tree
  2. Lauch configure to create the Makefile(s), it is cleaner to create a subtree for objects:
    mkdir Target
    cd Target
    ../configure

    This creates all the Makefiles needed and generate an Options.orig file containing all the variable which can be tuned. For example one can just change the CFLAGS values. Be careful, autoconf usually set up the debug flag "-g" which tends to generate very big library and binaries.

    With -g the Target tree can grow up to 100 MBytes while without it it won't use more than 20 MBytes.

  3. Build everything:
    make all

    It is strongly recommended to use GNU make, which may not be the default make on your system. In this case try:

    gmake all

    or

    gnumake all

    The compilation process can take a fair amount of time, 10 minutes at least.

  4. Compile the document schemas:

    make schemas

    The structure, presentation and translation schemas are compiled.

    You can test the result immediately by lauching Thot Editor binary built in the bin directory:

    bin/thot

  5. If thot binary seems fine you can install it:
    make install

    By default, the binaries are installed in /usr/local/bin, libraries in /usr/local/lib and all data are in /usr/local/share/thot. This can be overrided by specifying different values for prefix(es) using configure command line options in step 2.

    Ultimately, if you're not satisfied with your current Thot Editor installation, you can clean up with:

    make uninstall

More info on the make files

All the Makefile(s) build in the object tree are generated by configure script and Makefile.in templates found in the source tree. It generates a main Makefile at the top of the object tree and a set of Makefiles in most of the directory of the object tree. The main Makefile accepts the following targets:

  • make rebuild : rebuild all the Makefile(s) from the autoconf and Makefile.in files.
  • make depend : rebuild all the dependencies in the object tree.
  • make proto : rebuild all the prototype include files xxx_f.h from their xxx.c counterpart.
  • make clean : removes all object files, but keep the binaries in Thot/Target/bin .
  • make libjpeg : rebuild the libjpeg.a library from Thot/libjpeg tree.
  • make libpng : rebuild the libpng.a and libz.a libraries from Thot/libpng tree.
  • make schemas : compile the document schemas used by Thot Editor.
  • make without argument rebuild everything.
  • make thot rebuild Thot Editor binary.

One can also go to a specific sub-directory in the object tree and launch make from that place. It will rebuild all the objects pertaining to this directory.

Next section try to give some hint on debugging errors at compile-time.

If make failed:

Errors may append at diffferent stages in the compilation process. Here is a small checklist:

  • from the start: typing make in the Thot/Target directory doesn't work. This means that the step 1 or 2 of the build process failed.
    1. do you use GNU make? The Makefile organization heavily relies on including sub-Makefiles and some old versions of Make don't support it.
    2. do you have write access on the Thot/Target directory ?

  • an error when compiling a C file occured. This should not be the case on any of the supported platform:
    1. check that you have some room left for the object.
    2. verify the include path for the X-Windows and Motif include files in Thot/Target/Options.
    3. verify that the target directory for the object exist and is writable. The object name is shown in the make output behind the -o flag.
    4. check that you are using an ANSI compliant compiler, while the code should compile with non-ANSI ones, we don't test this feature on a regular basis.
    5. If the error occurs when compiling a C file in the thot directory, check that all the compilers invocations in steps 7 to 11 did not produce any error (the Thot compilers are verbose so errors messages may not be easily detected).
    6. otherwise your best bet is to report the problem to the Thot Editor development Team, by sending the error to the thot@imag.fr mailing-list. Please check first the archive, the error may have been already reported.

    On an unsupported platform, check that:

    • The systems is 32-bit, as the Thot library has not yet been tested/ported to 64-bit systems.
    • The system offers the Posix system interfaces, at least for the libc and filesystem access calls.
    • The X11 (R5 or R6) and Motif (1.2.x or 2.0) or Lesstif interfaces are available.
    • A correct C compiler (preferably ANSI compliant) is available.
    • A config.h file describing specificities of target platform programming interface, this file may be generated by compiling the libwww or Amaya packages provided by the WWW consortium.

  • an error running a compiler schema occured:
    1. be sure that the compilers were properly build in step 5, check with ldd that there is no missing shared library, e.g:

      ldd bin/app

    2. be sure that cpp preprocessor is in the PATH. One can use the following shell script in conjuction with gcc, name it cpp, put it in the PATH with 755 Unix rights:
      #!/bin/sh
      exec `gcc --print-prog-name=cpp` $*
    3. check that you have write right access on Thot/thot directory.
    4. One can force the compiler to rebuild the schemas by typing:

      touch ../schemas/*.S

      make schemas

  • an error occured at link time:
    1. Check that the current directory contains all the libraries, namely libjpeg.a, libpng.a and libz.a
    2. Check that the libraries are not corrupted e.g.:

      file libjpeg.a

      nm libjpeg.a

      should not print any errors

    3. In case of a corrupted library, one can rebuild it by giving one of the appropriate commands:

      make libjpeg

      make libpng

    4. verify the library path (-L flags in LINK_OPTIONS) for the X-Windows and Motif libraries files in Thot/Target/Makefile.
    5. Check whether -lSM and -lICE X11R6 libraries are needed. These were not needed (available) when working on an X11R5 environment.
    6. If Thot Editor linking complains about XLookupString, check in Thot/thot/EDITOR.A that the section USES does not refer to Lookup. If needed, remove it, and restart

      make thot

      This is related to the input of ISO-Latin-1 sequences in Motif dialog boxes.

    7. Otherwise your best bet is to report the problem to the Thot Editor development Team, by sending the error to the thot@imag.fr mailing-list. Please check first the archive, the error may have been already reported

If Thot Editor binary doesn't work:

Here is a few rules to check if the editor binary just produced does not start:

  1. Check that the shared libraries needed by Thot editor are found on the system. The command

    ldd bin/thot on Suns or Linux

    chatr bin/thot on HP's

    should print all the shared libraries needed by Thot Editor and the path to the corresponding libraries in the system.

  2. Verify that the main registry file Thot/config/thot.ini is present.

If everything seems Ok, one can debug the problem by using a system call tracer like truss on Solaris or strace on Linux. Check for syscalls errors near the end of the system trace dump.

All the remaining technics to find out what's wrong are software debugging methods, for this of course one need to recompile the binary with debug option enabled, and use a debugger program to see what's happening exactly. Once a bug has been identified, please report it to the Thot Editor development Team, by sending the error to the thot@imag.fr mailing-list. Please check first the archive, the error may have been already reported. Of course, sending a contextual diff of the modified files may help correcting the problem, and have it patched on next release.

Stéphane Bonhomme
Date 1997/09/18