A few problems w/ compiling galib 2.4.5 under IRIX....

Itzinger, Oskar oitzinger at opec.org
Mon Jul 24 05:21:28 EDT 2000


Dr Wall,

the following reports some problems with building galib 2.4.5 and the
examples
(including the <gnu> and <graphic> stuff but not the pvm related stuff
since
I don't have pvm3 installed) under IRIX 6.5.7 with SGI's C++ 7.3 [on an
Indigo
R4400].


I. galib/base examples
======================

With


# IRIX 6.x with new 32-bit libraries
CXX         = CC
PRELINK     =
CXXFLAGS    = -g -fullwarn -n32
CXX_INC_DIR = /usr/include/CC
LD          = ld
AR          = ar rv
INSTALL     = bsdinst -c


in makevars, I get a whole bunch of warnings, errors and remarks, eg:


	CC -g -fullwarn -n32 -I.. -c garandom.C
cc-1035 CC: WARNING File = /usr/include/CC/iostream, Line = 18
  #error directive:  This header file requires the -LANG:std option

  #error This header file requires the -LANG:std option
   ^
.
.
.

cc-1070 CC: ERROR File = /usr/include/CC/string, Line = 2172
  The indicated type is incomplete.

    char __f = __os.fill();
               ^
.
.
.

cc-1424 CC: REMARK File = /usr/include/CC/stl_locale.h, Line = 58
  The template parameter "_Facet" is not used in declaring the argument
types of
          function template "std::locale::combine".

    template <class _Facet> locale combine(const locale&);
                    ^

and so on...


I changed CXXFLAGS to


CXXFLAGS    = -g -n32 -LANG:std


and galib build completely error-/warning-free (which is really quite
RARE,
and I do a lot of compiling!).


However, even with


# Use this for non-gnu make
$(EXS): $$@.o
	$(CXX) $@.o -o $@ $(LIB_DIRS) -lga -lm


in examples/makefile, I could not compile any of the examples because of


	CC -g -n32 -LANG:std -I.. -c randtest.C
cc-1239 CC: ERROR File = randtest.C, Line = 23
  "cerr" is ambiguous.

    cerr << "This program checks the random number generators in
GAlib.\n";
    ^
.
.
.

(and 100 more of the same for randtest.C).


I finally tracked the problem down to gaconfig.h which starts with


// By default, we use the old streams library.  
#if !defined(USE_OLD_STREAMS) && \
    !defined(USE_ANSI_STREAMS) && \
    !defined(NO_STREAMS)
#define USE_ANSI_STREAMS
#endif


and later on specifies


// Use the right streams library based on which streams macro was
defined.
#if defined(USE_OLD_STREAMS)
#include <iostream.h>
#include <fstream.h>

#elif defined(USE_ANSI_STREAMS)
#include <iostream>
#include <fstream>

// i'm terribly sorry to do this, but it is the easiest way for me to
get
// things to work properly with vcpp.
using namespace std;

#else
#ifndef NO_STREAMS
#define NO_STREAMS
#endif
#endif


After I'd inserted 


#define USE_OLD_STREAMS


before the line


// By default, we use the old streams library.


all examples build error-/warning-free as well (a SMALL suggestion:
change the
default streams library #define from USE_ANSI_STREAMS to USE_OLD_STREAMS
so
that it conforms with what the comment says; of course, it is then no
longer
necessary to use -LANG:std among the CXXFLAGs).


BTW, if I compile with


#define NO_STREAMS


I get


	CC -g -n32 -I.. -c gaerror.C
cc-1552 CC: WARNING File = gaerror.C, Line = 23
  The variable "__gaErrFlag" is set but never used.

  static GABoolean __gaErrFlag = gaTrue;
                   ^

(although galib builds otherwise error-/warning-free) but only exs 2, 3,
9, 
10, 12, 13, 15 and 23 compile properly - the others fail, eg:


cc-1323 CC: ERROR File = ex1.C, Line = 70
  No operator "<<" matches these operands.

            The operand types are:  ostream << const GAGenome.
    cout << "The GA found:\n" << ga.statistics().bestIndividual() <<
"\n";
                              ^

or


cc-1132 CC: ERROR File = ex6.C, Line = 195
  The class "GATreeGenome<int>" has no member "write".

  GATreeGenome<int>::write(ostream & os) const
                     ^

cc-1287 CC: ERROR File = ex6.C, Line = 195
  A type qualifier on this function is not allowed.

  GATreeGenome<int>::write(ostream & os) const
                                         ^

cc-1020 CC: ERROR File = ex6.C, Line = 198
  The identifier "rt" is undefined.

    WriteNode(os, (GANode<int> *)rt);
                                 ^

etc. For ex6, the reason appears to be that GATreeGenome.h has


#ifndef NO_STREAMS
  virtual int write (ostream & os=cout) const;
#endif


and similiar observations seem to hold for the other failed example
compiles.


I also found that running examples 1-19 and 21-27 TOGETHER took about
25' on
my machine, but example 20 by itself took about 50' - what is wrong here
(the comment for running the tests says "this could take up to 1/2
hour")?



II. <graphic>
=============


With the following changes/addition in the makefile


MOTIF=-DUSE_MOTIF
XLIBS= -lXm -lXt -lX11 -lPW 

# If you have SGI's CC compiler...
C++C= CC
CCFLAGS= -O -g $(MOTIF) $(INC_DIRS)


everything compiled error-/warning-free.


III. <gnu>
==========


Even with the following changes in the makefile


# If you have SGI's CC compiler...
CCFLAGS= -O -g $(INC_DIRS)
C++C= CC


I got the following

	CC -O -g -I. -I../.. -c gnuex.C
cc-1005 CC: ERROR File = bitstr.h, Line = 17
  The source file "ga/genome.h" is unavailable.

  #include <ga/genome.h>
                        ^

After changing (in bitstr.h)


#include <ga/genome.h>


to


#include <ga/GAGenome.h>


and also (in bitstr.C)


#include <ga/random.h>


to


#include <ga/garandom.h>


gnuex compiled error-free but with the following warnings:


cc-1174 CC: WARNING File = bitdo2.h, Line = 18
  The variable "word0" was declared but never referenced.

    _BS_word word0, mask;
             ^

[this warning appears 3 more times]


cc-1552 CC: WARNING File = bitlcomp.c, Line = 48
  The variable "mask" is set but never used.

    register _BS_word word0, word1, mask;
                                    ^

BTW, I'm a bit puzzled just why there are .c, .cc and .C files...


Thank you for wading thru the present long report.


Best regards,

Dr Itzinger





More information about the galib mailing list