Game Development Community

Error Compiling with MinGW32 (Solution inside)

by Tomas Dahle · in Torque Game Builder · 03/18/2005 (4:35 am) · 10 replies

RESOLVED!

Problem: Trying to compile T2D out of the box using the makefiles supplied and make/gcc causes errors (at least on mingw32). This is because part of the makefiles (targets.torque.mk to be exact) refers to a whole lot of files that doesn't exist in the T2D source distribution.

Solution:
Replace 'targets.torque.mk' in your engine folder with this one

I just removed the reference to all unusued files and inserted a reference to a few missing ones, and it worked like a charm.

Important note:
If MinGW fails compiling, try using MSYS-1.0.10.exe and MinGW-3.1.0-1.exe



ORIGINAL POST BELOW
------------------------------------------------

I tried to compile T2D out of the box with no modifications. Since I have done quite a bit of C++ dev before I had MinGW installed already with msys and tried to use this. After configuring and compiling a bunch of files and creating libraries (zlib and so on), make puked with compiler errors on audio.cc. (see next post)


Just to make sure I installed a fresh MinGW32 using the newest available package and tried again. This time I got a lot of warnings for a silly command-line switch, and _different_ errors when it came to audio.cc (again, see below)


Figuring out compiler errors for someone else's rather large and complicated code is quite difficult, so any help is appreciated.

Have anyone compiled this with MinGW?

Are there any other free alternatives to compiling T2D? (just so I can move onwards if MinGW compilation proves difficult)

(compiler errors below...)

#1
03/18/2005 (4:36 am)
With my old gcc version 3.2 (mingw special 20020817-1)
Quote:
"--> Compiling audio/audio.cc"
In file included from ../lib/vorbis/include/ogg/ogg.h:24,
from ../lib/vorbis/include/vorbis/codec.h:26,
from audio/vorbisStream.h:26,
from audio/audioBuffer.h:21,
from audio/audioDataBlock.h:13,
from audio/audio.h:13,
from audio/audio.cc:6:
../lib/vorbis/include/ogg/os_types.h:39: syntax error before ';' token
../lib/vorbis/include/ogg/os_types.h:40: syntax error before ';' token
../lib/vorbis/include/ogg/os_types.h:41: syntax error before ';' token
audio/audio.cc: In function 'int loopingImageSort(const void*, const void*)':
audio/audio.cc:161: warning: return to 'int' from 'float'
audio/audio.cc:161: warning: argument to 'int' from 'float'
audio/audio.cc: In function 'int streamingSourceSort(const void*, const
void*)':
audio/audio.cc:193: warning: return to 'int' from 'float'
audio/audio.cc:193: warning: argument to 'int' from 'float'
audio/audio.cc: In function 'AUDIOHANDLE alxCreateSource(const
Audio::Description*, const char*, const MatrixF*, AudioSampleEnvironment*)':
audio/audio.cc:707: warning: assignment to non-pointer type 'ALuint' from NULL
audio/audio.cc:707: warning: argument to non-pointer type 'unsigned int' from
NULL
audio/audio.cc: In function 'ALuint alxGetWaveLen(unsigned int)':
audio/audio.cc:2092: warning: return to 'ALuint' from 'F64'
audio/audio.cc:2092: warning: argument to 'unsigned int' from 'F64'
mingw32-make.exe[1]: *** [out.GCC3.DEBUG/audio/audio.obj] Error 1
mingw32-make.exe: *** [default] Error 2

With my fresh install of gcc version 3.4.2 (mingw-special)

Quote:
--> Compiling lungif/gifalloc.c
cc1.exe: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
Creating library out.GCC3.RELEASE/lungif.a
--> Compiling audio/audio.cc
In file included from ./audio/audioBuffer.h:16,
from ./audio/audioDataBlock.h:13,
from ./audio/audio.h:13,
from audio/audio.cc:6:
./core/resManager.h: In member function 'void Resource::unlock()':
./core/resManager.h:255: error: invalid use of undefined type 'struct ResManager '
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
./core/resManager.h: In member function 'void Resource::purge()':
./core/resManager.h:263: error: invalid use of undefined type 'struct ResManager '
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
./core/resManager.h:265: error: invalid use of undefined type 'struct ResManager '
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
./core/resManager.h: In member function 'void Resource::_unlock()':
./core/resManager.h:278: error: invalid use of undefined type 'struct ResManager '
./core/resManager.h:38: error: forward declaration of 'struct ResManager'
audio/audio.cc: In function 'int loopingImageSort(const void*, const void*)':
audio/audio.cc:161: warning: converting to 'int' from 'float'
audio/audio.cc: In function 'int streamingSourceSort(const void*, const void*)':
audio/audio.cc:193: warning: converting to 'int' from 'float'
audio/audio.cc: In function 'AUDIOHANDLE alxCreateSource(const Audio::Descriptio n*, const char*, const MatrixF*, AudioSampleEnvironment*)':
audio/audio.cc:707: warning: converting to non-pointer type 'ALuint' from NULL
audio/audio.cc: In function 'ALuint alxGetWaveLen(ALuint)':
audio/audio.cc:2092: warning: converting to 'ALuint' from 'F64'
make[1]: *** [out.GCC3.RELEASE/audio/audio.obj] Error 1
make: *** [default] Error 2
#2
03/18/2005 (6:31 am)
Try doing a GCC 2 compile instead. That worked for me.
#3
03/18/2005 (8:28 am)
Yeah, I tried GCC2 and GCC3 with the same result for both GCC versions.

Now I tried again with gcc version 3.2.3 (mingw special 20030504-1) and it manages to compile a few files more than the other versions. Still, it dies soon enough with the following message:

COMPILER=GCC3
Quote:
--> Compiling audio/wavStreamSource.cc
audio/wavStreamSource.cc: In member function 'void WavStreamSource::clear()':
audio/wavStreamSource.cc:109: warning: assignment to non-pointer type 'ALuint'
from NULL
audio/wavStreamSource.cc:109: warning: argument to non-pointer type 'unsigned
int' from NULL
make[1]: *** No rule to make target 'out.GCC3.RELEASE/collision/abstractPolyList.obj', needed by 'out.GCC3.RELEASE/T2D.exe'. Stop.
make: *** [default] Error 2

COMPILER=GCC2
Quote:
--> Compiling audio/wavStreamSource.cc
cc1plus.exe: warning: -fvtable-thunks is no longer supported
audio/wavStreamSource.cc: In member function 'void WavStreamSource::clear()':
audio/wavStreamSource.cc:109: warning: assignment to non-pointer type 'ALuint'
from NULL
audio/wavStreamSource.cc:109: warning: argument to non-pointer type 'unsigned
int' from NULL
make[1]: *** No rule to make target 'out.GCC2.RELEASE/collision/abstractPolyList .obj', needed by 'out.GCC2.RELEASE/T2D.exe'. Stop.
make: *** [default] Error 2

@Eugene Goh: Which version did you use?
#4
03/18/2005 (8:36 am)
The combination of mingw/minsys that I have found to be the most compatible with Torque Platform Apps is:

MYSIS-1.0.10.exe
MinGW-3.1.0-1.exe

has worked personally on Win98, WinXP-Pro, and WinXP-Home with TGE 1.3, RTS-SK, and the Synapse Lighting Pack distribution. Use COMPILER=GCC3, and you may need to tweak some lib settings, although in the last two installs I don't remember having to do that.

The "latest" (3.4.2 I think?) version of GCC itself has some compatibility issues with TGE as it stands--there have been quite a few threads scattered about in the TGE private forums regarding those issues if you happen to have access to them.

You didn't mention it specifically, but there are also some issues with 64 bit libraries if you happen to be on a linux box (trying to cross-compile maybe?)--but if that doesn't apply, don't worry about it!
#5
03/18/2005 (10:14 am)
@Stephen Zepp: Thanks for the info. I wish I had access to those forums, although I guess it would be confusing trying to sift through all the information there.

I'm back on MinGW 3.1.0-1, the one which dies approximately here:
Quote:
--> Compiling audio/wavStreamSource.cc
audio/wavStreamSource.cc: In member function 'void WavStreamSource::clear()':
audio/wavStreamSource.cc:109: warning: assignment to non-pointer type 'ALuint'
from NULL
audio/wavStreamSource.cc:109: warning: argument to non-pointer type 'unsigned
int' from NULL
make[1]: *** No rule to make target 'out.GCC3.RELEASE/collision/abstractPolyList.obj', needed by 'out.GCC3.RELEASE/T2D.exe'. Stop.
make: *** [default] Error 2


Now I've fixed weird make-file issues before, but so far I haven't had any luck with this one. T2D's makefiles confuse me.
#6
03/18/2005 (10:38 am)
I'm going to have to bow out of this one, since I only have minimal experience with TGE's makefile environment (one of my dev's handles all that), and no T2D makefile experience at all.

It does sound however that you are missing abstractPolyList.cc from your makefile somehow...
#7
03/18/2005 (11:07 am)
Actually, as I am working on right now, the makefile supplied with T2D refers a WHOLE BUNCH of files that are not in the T2D source distribution. (Most of which seem to me to be TGE files). I am trying to edit the makefile to include only the source files actually included in T2D and see if that helps.
#8
03/18/2005 (12:22 pm)
Hmm...that surprises me to be honest. Any chance you have an outdated makefile, or possibly are using the wrong one? I don't really see this one slipping by Josh and Melv...

Let me try and compile T2D and get back to ya.

EDIT: he's absolutely right--the targets.torque.mk contained in the T2D release is...well...not current!
#10
03/18/2005 (6:18 pm)
DOH! Good catch/memory Harold--I had already forgotten about that post. Man, time flies--T2D been out for 3 weeks I think now!