Game Development Community

FreeBSD 5.3 - Problem compiling audio/audio.cc

by Dave Shay · in Torque Game Engine · 01/26/2005 (5:37 am) · 4 replies

I just installed and configured a brand new FreeBSD 5.3 server, and am having a problem compiling the Torque engine. I get these errors whether I use "standalone" or the default mode:

In file included from ./sim/netConnection.h:19,
from ./game/gameConnection.h:16,
from audio/audio.cc:11:
./platform/event.h:127: error: a casts to a type other than an integral or enumeration type cannot appear in a constant-expression
./platform/event.h:127: error: '->' cannot appear in a constant-expression
./platform/event.h:127: error: '&' cannot appear in a constant-expression
./platform/event.h:127: error: enumerator value for 'PacketReceiveEventHeaderSize' not integer constant
./platform/event.h:130: error: a casts to a type other than an integral or enumeration type cannot appear in a constant-expression
./platform/event.h:130: error: '->' cannot appear in a constant-expression
./platform/event.h:130: error: '&' cannot appear in a constant-expression
./platform/event.h:130: error: enumerator value for 'ConnectedReceiveEventHeaderSize' not integer constant
./platform/event.h:133: error: a casts to a type other than an integral or enumeration type cannot appear in a constant-expression
./platform/event.h:133: error: '->' cannot appear in a constant-expression
./platform/event.h:133: error: '&' cannot appear in a constant-expression
./platform/event.h:135: error: enumerator value for 'ConsoleEventHeaderSize' not integer constant

I was able to successfully compile in Windows using the Cygwin compiler and the same /platform/event.h, so it doesn't appear to be a format error with that .h file. Something else is amiss. :)

A little more background:

I'm not a c/c++ guru so forgive me if I get my terminology wrong. I know enough about c in that I can trace through code and follow what's going on, but I'm not well versed in the subtleties of the different compilers and makefile options. This "disclaimer" being said, here's a few notes that might by of interest.

1. I can't use "make". When I use "make" it complains about errors in the Makefile, so I'm using "gmake". Here's what happens when I use "make":

"Makefile", line 1: Need an operator
"Makefile", line 3: Need an operator
"Makefile", line 7: Need an operator
"Makefile", line 8: Missing dependency operator
"Makefile", line 10: warning: duplicate script for target "doConfigure" ignored
"Makefile", line 11: warning: duplicate script for target "doConfigure" ignored
"Makefile", line 12: Need an operator
"Makefile", line 13: Need an operator
make: fatal errors encountered -- cannot continue

So I suppose the first question is: Since I'm using gmake rather than make, is there something I'm "missing" or have misconfigured on my system?

2. Here's the mk/configure.mk options I'm using:

Current Configuration: this config is VALID
OS: FreeBSD
COMPILER: GCC2
BUILD: DEBUG
DIR.OBJ: out

I've also tried conf.GCC2.LINUX.mk, conf.GCC3.LINUX.mk and conf.GCC3.4+.LINUX.mk and get the same result.

3. I installed openal-20040816 from the FreeBSD ports collection, and I've also installed SDL-1.2.8 and Mesa-6.2.1 using the links provided elsewhere on garagegames.com. So as far as I know I've satisfied all of the dependencies necessary to compile Torque on Linux.


Any words of wisdom? :)

#1
01/28/2005 (5:54 am)
Update:

This is indeed an operating system configuration problem.

I found the compiler version installed on my machine is gcc 3.2.1. Since the docs recommend gcc version 2 for Linux, I did some digging and found several gcc version 2 compilers available in the FreeBSD ports collection.

I installed gcc 2.95 (/usr/ports/lang/gcc295) and updated ~/mk/conf.UNIX.mk to point to the gcc295/g++295 executables. Now when I do a gmake I can compile all of the source code. The errors I mentioned in my first post now show up as mere "warnings".

Further on in the compile phase I found I was missing the assembler (missing reference to "nasm"). I installed the assembler (/usr/ports/devel/nasm) and then gmake was able to continue along its merry way.

Now my next hurdle is the linker. During the link phase of gmake I'm getting a lot of "undefined reference" messages. About half of these are related to vorbis, and the other half are related to standard things like memcpy/strcpy/memset. My guess is I need to fiddle with the LINK.LIBS.* variables in ~/mk/conf.UNIX.mk so the linker can find the libraries.

I'll post a follow-up if I can solve this problem. This may be elementary stuff to a lot of you, but perhaps this will be helpful info to somebody. :)
#2
01/28/2005 (1:54 pm)
The docs really shouldn't recommend gcc2 anymore. There are quite out of date. Most newer versions of gcc3 (including 3.2.1) should work fine. Especially, you don't want to use 2.95 since it doesn't output the dependency makefiles (.d files) to the correct location.

Re compiling on FreeBSD in general: I don't think it is a "supported" platform for Torque, and certainly no one is actively maintaining it. But it shouldn't take too much tweaking to get it working.
#3
01/28/2005 (3:00 pm)
John,

Thanks for pointing out the problem with 2.95. It appears I have 5 versions of gcc3 I can try, so I'll start with the newest version and work backwards until I get one working.
#4
01/29/2005 (6:52 am)
Got it to work!!!!

Upgrading my compiler to the gcc33 package allowed me to compile everything, and it also eliminated the linker error messages relating to the memory management libraries. Tweaking the ~/mk/conf.GCC.mk and ~/mk/conf.UNIX.mk files eliminated the remaining linker error messages (the ones relating to libogg and libvorbis).

I'm now up and running! :)