Errors compiling beta

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Karl Garrison

Errors compiling beta

Post by Karl Garrison »

Since I couldn't get the RPM to work on RedHat 7.1 (see my other post), I thought I would see if I would have more luck compiling from source. I ried, but it errors out. Here are the errors I get. Any ideas?


Thanks,

-Karl


c++ -DHAVE_CONFIG_H -I. -I. -I.. -I./.. -I/usr/include/SDL -D_REENTRANT -DXWIN -O2 -Wno-long-long -g -O2 -c Flat.cc -o Flat.o
In file included from Flat.h:23,
from Flat.cc:28:
U7file.h:33: syntax error before `;'
U7file.h:37: parse error before `&'
U7file.h:37: missing ';' before right brace
U7file.h:38: ISO C++ forbids defining types within return type
U7file.h:38: semicolon missing after declaration of `class U7file'
U7file.h: In function `int U7file (const U7file &)':
U7file.h:38: base initializers not allowed for non-member functions
U7file.h:38: `class U7file' has no member named `filename'
U7file.h:38: warning: no return statement in function returning
non-void
U7file.h: At top level:
U7file.h:39: syntax error before `&'
U7file.h:40: destructors must be member functions
U7file.h:40: virtual outside class declaration
U7file.h:42: virtual outside class declaration
U7file.h:42: function `uint32 number_of_objects ()' is initialized like
a variable
U7file.h:43: virtual outside class declaration
U7file.h:43: function `char *retrieve (unsigned int, size_t &)' is
initialized like a variable
U7file.h:44: virtual outside class declaration
U7file.h:44: function `const char *get_archive_type ()' is initialized
like a variable
U7file.h:45: parse error before `}'
U7file.h:61: parse error before `,'
U7file.h:72: syntax error before `*'
U7file.h:79: syntax error before `;'
U7file.h:83: parse error before `&'
U7file.h:83: missing ';' before right brace
U7file.h:84: ISO C++ forbids defining types within return type
U7file.h:84: destructors must be member functions
U7file.h:84: return type specification for destructor invalid
U7file.h:84: virtual outside class declaration
U7file.h:86: virtual outside class declaration
U7file.h:89: parse error before `}'
In file included from Flat.cc:28:
Flat.h:30: parse error before `&'
In file included from ../exceptions.h:25,
from Flat.cc:34:
/usr/include/g++-3/stdexcept:43: syntax error before `;'
/usr/include/g++-3/stdexcept:45: parse error before `&'
/usr/include/g++-3/stdexcept:45: missing ';' before right brace
/usr/include/g++-3/stdexcept:46: ISO C++ forbids defining types within
return type
/usr/include/g++-3/stdexcept:46: extraneous `char' ignored
/usr/include/g++-3/stdexcept:46: virtual outside class declaration
/usr/include/g++-3/stdexcept:46: non-member function `what ()' cannot
have `const' method qualifier
/usr/include/g++-3/stdexcept: In function `const logic_error *what ()':
/usr/include/g++-3/stdexcept:46: `_what' undeclared (first use this
function)
/usr/include/g++-3/stdexcept:46: (Each undeclared identifier is
reported only once for each function it appears in.)
/usr/include/g++-3/stdexcept: At top level:
/usr/include/g++-3/stdexcept:51: parse error before `&'
/usr/include/g++-3/stdexcept:51: missing ';' before right brace
/usr/include/g++-3/stdexcept:56: parse error before `&'
/usr/include/g++-3/stdexcept:56: missing ';' before right brace
/usr/include/g++-3/stdexcept:61: parse error before `&'
/usr/include/g++-3/stdexcept:61: missing ';' before right brace
/usr/include/g++-3/stdexcept:66: parse error before `&'
/usr/include/g++-3/stdexcept:66: missing ';' before right brace
/usr/include/g++-3/stdexcept:70: syntax error before `;'
/usr/include/g++-3/stdexcept:72: parse error before `&'
/usr/include/g++-3/stdexcept:72: missing ';' before right brace
/usr/include/g++-3/stdexcept:73: ISO C++ forbids defining types within
return type
/usr/include/g++-3/stdexcept:73: extraneous `char' ignored
/usr/include/g++-3/stdexcept:73: virtual outside class declaration
/usr/include/g++-3/stdexcept:73: non-member function `what ()' cannot
have `const' method qualifier
/usr/include/g++-3/stdexcept: In function `const runtime_error *what
()':
/usr/include/g++-3/stdexcept:73: new declaration `const runtime_error
*what ()'
/usr/include/g++-3/stdexcept:46: ambiguates old declaration `const
logic_error *what ()'
/usr/include/g++-3/stdexcept: At top level:
/usr/include/g++-3/stdexcept:74: parse error before `protected'
/usr/include/g++-3/stdexcept:80: parse error before `&'
/usr/include/g++-3/stdexcept:80: missing ';' before right brace
/usr/include/g++-3/stdexcept:85: parse error before `&'
/usr/include/g++-3/stdexcept:85: missing ';' before right brace
/usr/include/g++-3/stdexcept:90: parse error before `&'
/usr/include/g++-3/stdexcept:90: missing ';' before right brace
In file included from Flat.cc:34:
../exceptions.h:33: syntax error before `;'
../exceptions.h:37: parse error before `&'
../exceptions.h:37: missing ';' before right brace
../exceptions.h: In method `exult_exception::exult_exception (const
char *)':
../exceptions.h:36: class `exult_exception' does not have any field
named `what_'
../exceptions.h: At top level:
../exceptions.h:38: ISO C++ forbids defining types within return type
../exceptions.h:38: extraneous `char' ignored
../exceptions.h:38: non-member function `what ()' cannot have `const'
method qualifier
../exceptions.h: In function `const exult_exception *what ()':
../exceptions.h:38: new declaration `const exult_exception *what ()'
/usr/include/g++-3/stdexcept:73: ambiguates old declaration `const
runtime_error *what ()'
../exceptions.h: In function `const logic_error *what ()':
../exceptions.h:38: `what_' undeclared (first use this function)
../exceptions.h: At top level:
../exceptions.h:39: non-member function `get_errno ()' cannot have
`const' method qualifier
../exceptions.h: In function `int get_errno ()':
../exceptions.h:39: `errno_' undeclared (first use this function)
../exceptions.h: At top level:
../exceptions.h:40: destructors must be member functions
../exceptions.h:40: virtual outside class declaration
../exceptions.h:41: parse error before `}'
../exceptions.h:64: parse error before `&'
../exceptions.h:64: missing ';' before right brace
../exceptions.h:65: parse error at null character
../exceptions.h:84: parse error before `&'
../exceptions.h:84: missing ';' before right brace
../exceptions.h:85: parse error at null character
../exceptions.h:88: ISO C++ forbids declaration of `string' with no
type
../exceptions.h:88: invalid use of `::'
../exceptions.h:88: parse error before `;'
../exceptions.h:90: parse error before `&'
../exceptions.h:90: missing ';' before right brace
../exceptions.h:91: base `file_exception' with only non-default
constructor in class without a constructor
../exceptions.h:94: ISO C++ forbids declaration of `string' with no
type
../exceptions.h:94: invalid use of `::'
../exceptions.h:94: parse error before `;'
../exceptions.h:96: parse error before `&'
../exceptions.h:96: missing ';' before right brace
../exceptions.h:97: base `file_exception' with only non-default
constructor in class without a constructor
../exceptions.h:100: ISO C++ forbids declaration of `string' with no
type
../exceptions.h:100: invalid use of `::'
../exceptions.h:100: parse error before `;'
../exceptions.h:102: parse error before `&'
../exceptions.h:102: missing ';' before right brace
../exceptions.h:103: base `file_exception' with only non-default
constructor in class without a constructor
../exceptions.h:107: parse error before `&'
../exceptions.h:107: missing ';' before right brace
../exceptions.h:108: base `file_exception' with only non-default
constructor in class without a constructor
In file included from Flat.cc:35:
utils.h:340: `::string' undeclared (first use here)
utils.h:340: parse error before `)'
utils.h: In function `int U7exists (...)':
utils.h:340: `fname' undeclared (first use this function)
utils.h: At top level:
utils.h:360: parse error before `&'
utils.h:361: syntax error before `('
utils.h:363: `str' was not declared in this scope
utils.h:363: variable or field `to_uppercase' declared void
utils.h:364: syntax error before `('
Flat.cc:47: parse error before `&'
Flat.cc:51: `fp' was not declared in this scope
Flat.cc:51: ISO C++ forbids declaration of `fclose' with no type
Flat.cc:51: `int fclose' redeclared as different kind of symbol
/usr/include/stdio.h:185: previous declaration of `int fclose (FILE *)'
Flat.cc:52: parse error before `}'
Flat.cc: In method `char *Flat::retrieve (unsigned int, size_t &)':
Flat.cc:59: `filename' undeclared (first use this function)
Flat.cc:66: `fclose' cannot be used as a function
make[3]: *** [Flat.lo] Error 1
make[3]: Leaving directory `/home/karlos/exult-0.96beta1/files'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/karlos/exult-0.96beta1/files'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/karlos/exult-0.96beta1'
make: *** [all-recursive-am] Error 2
nadir
Site Admin
Posts: 407
Joined: Thu May 14, 2020 1:34 pm

Re: Errors compiling beta

Post by nadir »

This shouldn't happen. I believe you have a fouled up installation of G++. I notice you're using gcc 3.0: did you install it yourself ?
Are you building with RPM ?

rpm --rebuild exult-0.96beta1-1.src.rpm

Tristan
Karl

Re: Errors compiling beta

Post by Karl »

What makes you think I'm using gcc 3.0? I don't think I have that installed, but I'll check to make sure when I get home. I should have gcc 2.96, the RedHat fork of gcc that comes with RedHat 7.x.

I also tried rebuilding the source RPM with similar results, so I tried compiling with the tarball source when that failed. Maybe I'll check to see if autoconfig is somehow detecting the wrong compiler when I get home . Thanks for your help.


-Karl
Darkstar
Posts: 44
Joined: Thu May 14, 2020 1:34 pm

Re: Errors compiling beta

Post by Darkstar »

I had the same problem once when I tried to compile exult with gcc3. It won't work (at least for me, it didn't).
gcc3 compiled c++ programs are terribly slow anyway so don't use it (yet :-)

--Darkstar
Karlos
Posts: 149
Joined: Thu May 14, 2020 1:34 pm

Re: Errors compiling beta

Post by Karlos »

Okay, I checked at home, and I definately have gcc 2.96 installed, not 3.0. The directory /usr/include/g++-3/ seen in the error posted above definately comes from the gcc-2.96 package (I checked with rpm).

Obviously it's something particular with my system, since I was able to get the RPM to work on a stock RedHat 7.1 machine at work, and was also able to recompile from work, but neither works on my machine at home. I'm not sure how to troubleshoot this, however.

Another thought: maybe I can try recompiling with egcs (a.k.a. kgcc) instead of gcc-2.96. Does anyone know how to tell ./configure to use a different compiler? Just setting CC=kgcc didn't seem to be enough to do the trick.


-Karl
nadir
Site Admin
Posts: 407
Joined: Thu May 14, 2020 1:34 pm

Re: Errors compiling beta

Post by nadir »

kgcc only comes with a C (not C++) frontend. Therefore that won't work.
Also you'd have to set CXX=kg++ (or equivalent).
What release of gcc 2.96 are you running ?
Make sure you're using the latest packages from RedHat

gcc-2.96-85.i386.rpm
gcc-c++-2.96-85.i386.rpm
libstdc++-2.96-85.i386.rpm
libstdc++-devel-2.96-85.i386.rpm
cpp-2.96-85.i386.rpm


Tristan
Max aka Moscow Dragon

Re: Errors compiling beta

Post by Max aka Moscow Dragon »

A pity Microsoft compiler (which never problems with C++ since early 90ies) cannot build ELF binaries and Linux cannot load PE ones.
Maybe some smartie will add PE binary format support to the kernel and to ld.so?
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Errors compiling beta

Post by wjp »

It's not just the exe format that's different, you know :-)

Anyway, if you want to run windows executables in linux, try wine. (www.winehq.org)
Max aka Moscow Dragon

Re: Errors compiling beta

Post by Max aka Moscow Dragon »

>It's not just the exe format that's different, you know :-)

I mean:
- having a Linux binary
- linked over a Linux libc.so and X toolkits
- using no Win32 functions, only Linux ones
- but with PE format!

MS compiler (not like Borland C++ Builder) can happily produce this if you will customize the entry point code.

Does WINE support COM/OLE?
nadir
Site Admin
Posts: 407
Joined: Thu May 14, 2020 1:34 pm

Re: Errors compiling beta

Post by nadir »

Wine supports COM/OLE.
G++ >=3.x (including 2.96 which is a pre 3.0 release) is more conformant to ISO C++ than Microsoft's compiler. The problems Karl is having are because of a screwed up installation.
The only aspect of MSVC that is superior to GCC is that it supports precompiled headers (they are coming in GCC 3.1).
I believe the best C++ compiler out there at the moment is Metrowerks C++ (Fingolfin ?).

But no compiler can compete with GCC in terms of supported frontends and backends:
Currently the main GCC distribution contains front ends for C (gcc), C++ (g++), Objective C, Chill (unmaintained), Fortran (g77), Java (GCJ), and Ada (GNAT). GCC 3.1 will be the first official version of GCC to include the Ada front end.

The very impressive list of supported architectures is here
Locked