Problems Building UQBT 1.0 Alpha
The University of Queensland Binary Translator (UQBT), static version,
was released in late May 2002. The details are available from this web site:
http://www.experimentalstuff.com/Technologies/uqbt
. I had a number of problems compiling this project, mostly to do with using
the gcc compiler version 3.1.Problems Building UQBT 1.0 Alpha
Here are the notes I have accumulated about it:
- UQBT was not designed for gcc 3.X. If your compiler is gcc 3.0 or
later, there will be a few minor changes to be made. The main one is where
a C++ source file has a default parameter (e.g. pEntry = "main");
gcc no longer allows this syntax. (Just comment out the '= "main"').
There are about 8 of these. Also, there are a lot of long warnings about
how the strstream class is now obsolte; it is safe to ignore these.
- Another gcc 3.x difference is that it no longer generates a "operator!=()"
by using ! (not) and the operator=() function. In backend/c/translate2c.cc,
there are two places where you need to change
(cType != uType)
to
(!(cType == uType))
- If you don't configure with "--enable-uqbt-only", you will
also make some dynamic tools which use the "tools" program. This is the
Icon version of the NJMC toolkit, which you can download from the web. You
could just ignore this error, and continue the make (a generated file won't
be re-made, but that's not a problem).
- Again, if "--enable-uqbt-only" is not used at configure
time, there is a problem with a name clash in backend/po/sparc-encoder.h;
it seems that "not" is now a reserved word. Just change the definition
from "not" to "not1" (it isn't actually used anywhere; this is generated
code).
- If you get a problem with mltk.sh, remember to swap the
top two lines (or change as needed for your system). Also, of course, you
need to install the ML version of the New Jersey Machine Code Toolkit, or
configure with "--enable-remote" (as documented). Another alternative
is to merely tough the file that mltk.sh is trying to create (usually a
.cc file from a .m file).
- One of the "can't default in C++ files anymore" problems is in a
generated file, and reports as being in the file "flexskel.cc". (It isn't
in that file at all; the error reporting of flex++ leaves something to be
desired there). The easist way to fix the problem (if it happens)
is to comment out the "= false" in pal/patternscanner.l, i.e. change
%define CONSTRUCTOR_PARAM FILE* inFile, bool trace = false
to
%define CONSTRUCTOR_PARAM FILE* inFile, bool trace /* = false */
- There is a similar problem with pal/patternparser.y:
%define CONSTRUCTOR_PARAM \
const string& fileName, \
const set<string>& types, \
bool trace /*= false */
- On a Power PC platform, you may need -fdollars-in-identifiers
to compile some of the generated files, such as those that include machine/sparc/sparc.pat.h
.
- On a Linux system, the elf libraries are sometimes not installed. For example on Redhat, you need to find a package with a name like libelf-0.7.0.rpm and install it. (That exact version is no doubt out of date; any version should do). Without this library, you will have things like elf_Scn undefined.
Here are some problems that have cropped up with gcc version 3.4.3 from late 2005.
- In include/BinaryFile.h, enum REG_ENUM seems to have a name clash, so it needs to be renamed to UQBTREG_ENUM (similarly UQBTREG_PC and UQBTREG_SP). The changes are all in about 10 lines in that one file.
- In backend/common/outfile.cc, the declaration for less<TEMP_EL> needs to change to this:
class lessTempEl : public binary_function<TEMP_EL, TEMP_EL, bool> {
public:
bool operator() (const TEMP_EL& x, const TEMP_EL& y) const
  {return x.nat < y.nat;}
};
The two uses of set<TEMP_EL> need to change to set<TEMP_EL, lessTempEl>. - typeAnalysis/analyzeBlocks.cc needs a using namespace std;. Also, modern versions of gcc don't seem to grok the implementation of templated functions like BBBlock::deleteListFromMap, or at least the declaration of iterators within them. I don't have a fix for the latter problem at present.
Last modified: 18/Dec/2005: Second set of problems for late 2005.
