SourceForge.net Logo

TenDRA C/C++ for Minix

This software is a port of the TenDRA C/C++ compiler, version 4.1.2, to the Minix operating system. See http://www.ten15.org and http://www.tendra.org for other sites of TenDRA. Version 4.1.2 was the last version released by the original developers, the British DERA. Please read the file COPYRIGHT (at the top of the sources hierarchy) for the original license (OSD compliant). Additions and changes made for this port are public domain.

The latest release is "b", with many bug fixes in the C++ compiler.

Requirements and installation

This package will compile under versions 2.0.0/2/3/4 and 3.1.1 of Minix. You need at least an i486 processor (or i386+i387) and 4 MB of RAM to build (and use) the compiler.

To compile and install, type (as bin user),

cd /usr/local/src
gzip -d -c TenDRA412b.tgz | tar xf -
cd TenDRA-4.1.2                     
./INSTALL >> messages.build 2>&1

(If you are using Minix 2, you will probably need to install gzip to unpack the sources.)

The compilation and installation may take up to 8 hours on a slow machine (33 MHz). You can monitor the compilation process on another virtual terminal,

cd /usr/local/src/TenDRA-4.1.2
tail -n 24 -f messages.build

At the end, there should be no error messages in this file. Common causes of failure are:

In general, the original sources are very clean and the makefiles very well behaved, so if the installation gets interrupted somewhere, you can restart it with the ./INSTALL command above; no need of deleting anything nor unpacking again.

Almost everything gets installed under /usr/local/lib/TenDRA, a few scripts go into /usr/local/bin (tcc, tchk, tspec, ld), and man pages into /usr/local/man (don't forget "makewhatis /usr/local/man" to read them).

Usage

To compile a simple C program,

tcc hello.c

To compile a simple C++ program,

tcc -Yc++ hello.C

As mentioned before, the frontends don't use the system headers. Instead, they check your program against precompiled libraries of "tokens" (= macro definitions) that specify Application Programming Interfaces (APIs). These precompiled API token libraries are built during installation, using the specs given in src/lib/apis and the contents of the system headers. The TenDRA-4.1.2 distribution comes with several APIs, but only two of them can be built on standard Minix: ansi (X3.159) and posix (1003.1). APIs are chosen by specifying an environment with the -Y switch. By default, the ansi environment is used. Several -Y switches may be combined in the same command line,

tcc -Yposix -Yc++ prog.C

If you want to bypass API checking and use normal system headers, there is a special environment for doing this,

tcc -Ysystem prog.c
tcc -Ysystem -Yc++ prog.C

This is necessary for using Minix specific features (networking, for example). The compiler driver tcc behaves like any other one, accepting common options like -c (compile only), -o (name output file), etc. See the man page tcc(1). You can pass options to the linker script through the -Wl: switch; the most important use of this is to produce a separate I&D executable,

tcc -Ysystem -Wl:-i main.o module.o -lcurses

Important notes

Of course, there is a list of caveats about this program.

  1. No Standard C++ Library is included in the package (not even iostream). See the documentation for some advice on how to port GNU libio (although I haven't tried myself).
  2. The -g switch (emit debug info) is a complete nonsense. Never use it. I have wiped diagnostics off the Minix specific parts of the 80x86 installer (= the compiler backend), but the common part will still produce some output. Anyway, the ACK assembler cannot understand AT&T style debug information, so if you compile with -g, you will just get a stream of error messages from the assembler.
  3. I doubt that the -p switch (emit profiling data) works. I am not sure, but I think Minix has no support for profiling.
  4. Linking ACK object code with TenDRA object code is not possible in general. Two binary incompatibilities arise: (1) ACK uses ebx as a scratch register, this means it indulges in overwriting ebx without making a copy; (2) ACK returns float/double values in eax/edx, while TenDRA uses st(0) for this. You may have noticed that libc and the other system libraries are completely rebuilt with the TenDRA C compiler during installation. You will have to do so for new libraries as well.
  5. If you are used to dirty C programming, then you will find that it is almost impossible to compile a "normal" program with TenDRA. The frontends are very strict about languages and standards. This strictness can be suspended using suitable #pragmas. There is a plethora of them (they are also a way of expressing TDF constructs). For example, if you want to be able to assign a data pointer to a function pointer (something explicitly forbidden in ANSI C), you must put this #pragma somewhere in your code
       #pragma TenDRA function pointer as pointer allow
    
    See also the switch -X (compilation mode) in the documentation.

Comments

The C++ frontend was not so good as I thought at the time of the first release, but with the bunch of bugs fixed for this new release, it should compile most freestanding C++ programs without problems.

I have made some tests involving relatively complex inheritance hierarchies, with template classes, virtual bases, virtual tables, and exceptions, and everything has worked fine.

I don't plan to develop this project very actively, but I want it to be bug free. If you find some problem other than the five warnings I made above, please tell me (email me at the address josejuanmr <at> users <dot> sourceforge <dot> net) and I'll try to fix it (you'll have to be patient).

Download

Go to the project summary page to download. The file named TenDRA412b.tgz is a compressed tar file (.tar.gz) with the compiler sources. The letter following 412 indicates the release. The latest release is b. The file named TenDRA-doc.tgz contains plenty of HTML documentation.