|
From: Brent B. <bre...@gm...> - 2009-03-04 23:29:17
|
A couple weeks ago I asked about OS X port, and saw the responses
here. I've also been in contact with Steve Hudson about it, and have
gotten a running version. With a few other tweaks, I got the trackgen
program built and seemingly usable.
I'm building on new macbook, leopard 10.5.6, XCode 3.1.2 (GCC 4.0.1),
and have set the project default architectures to be "Universal
32-bit" (i386/ppc). Oh, this is the 1.3.0 Torcs source.
There are some odd intermittant linkage problems that I haven't
figured out yet. At one point, I was able to get a full, clean build
of everything in the projects that Steve shared, but it's eluding me
now. The ssggraph.so project is the epicenter of the 6 linkage
problems.
Two errors are this:
"ssgVtxTable::ssgVtxTable(unsigned long, ssgVertexArray*,
ssgNormalArray*, ssgTexCoordArray*, ssgColourArray*)", referenced
from:
initWheel(CarElt*, int)in grcar.o
initBackground() in grscene.o
... etc
Other errors are GCC "vtable of" errors. Here's a complete error:
"ssgSimpleState::isEnabled(unsigned long)", referenced from:
vtable for grMultiTexState in grmultitexstate.o
vtable for grManagedState in grtexture.o
The GCC vtable issue is this: when a class is declared in a header
file AND has virtual methods with the function body defined in the
header also, GCC will not generate a vtable anywhere. GCC requires at
least one of the virtual functions to have an implementation in a
compilation unit (.cpp), and GCC will place the vtable in that unit's
object file. A class defined like the following will generate this
error:
/* Foo.h */
class Foo {
public:
~Foo() {}
};
To fix it, just move any virtual function body out of the header, and
into a .cpp file somewhere. I made this change to the grManagedState
class (grtexture.h, grtexture.cpp) and that cleared up about half of
the specific error locations. Ditto for grMultiTexState. I'm stumped
as to what is causing the remaining vtable issues.
Has anybody else been trying out the OS X builds, and if they are
working for you, what's your hardware and versions?
BTW, I also fetched the plib-185 disk image Steve shared, and rebuilt
that framework ensuring the GCC arches and SDK version matched Torcs.
No change, as it matched OK.
-Brent
p.s. $ gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
|