Re: OS X linkage problems

Brent Burton <[email protected]> Sun, 8 Mar 2009 21:36:00 -0500
Newsgroups gmane.games.torcs.devel
Message-ID <[email protected]>
Some observations on the linkage issue with plib.

The issue occurs with the ssggraph module, and the grVtxTable subclass
of plib's ssgVtxTable. One of the ssgVtxTable constructors is:
ssgVtxTable(GLenum type, ssgVertexArray* va, ssgNormalArray* na,
ssgTexCoordArray* ta, ssgColourArray* ca)

GLenum is defined as "unsigned int" in GL/gl.h, so the output from the
plib framework's dylib (or a local static lib) has the signature:
    $ nm -g plib.framework/Versions/A/plib  | c++filt | grep
'ssgVtxTable::ssgVtxTable'
    00075972 T ssgVtxTable::ssgVtxTable(unsigned int,  ...as above...)
    0000234e T ssgVtxTable::ssgVtxTable(unsigned int, .....)
# <- output from my /usr/local/lib/libplibssg.a

I wrote a small test code based on the grVtxTable subclassing that
replicates this problem. The main() simply instantiates a grVtxTable,
which in turn invokes the above constructor. In tinkering with this
test, I found when it works and when it doesn't link.

If I compile the code manually, but link against *static* libraries,
the link works fine. The test source object file is looking for:
    nm -g libvtx.o | c++filt | grep 'ssgVtxTable::ssgVtxTable'
             U ssgVtxTable::ssgVtxTable(unsigned int, ...as above...)
and the linker finds it in the static libraries.

If I compile the test code to make a .so (as Torcs does), then the
compiler is attempting to find the signature with "unsigned long":
    $ nm -g libvtx.o | c++filt | grep 'ssgVtxTable::ssgVtxTable'
             U ssgVtxTable::ssgVtxTable(unsigned long, ...as above...)
and the linker does not find this in the dynamic library (plib framework).

Static linking finds the "unsigned int" version OK, and dynamic
linking is looking for "unsigned long". I've looked through project
settings and compiler options, but I didn't find anything relevant.

Any ideas?

thanks,
-Brent

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H