Game Development Community

ALPHA 1.1: Mac: Undefined symbols

by Scott Coursey · in Torque Game Builder · 11/24/2005 (10:54 pm) · 46 replies

I've successfully gotten T2D to build on my Mac. I could do a write-up on what I did, but most steps are covered elsewhere. The one thing I did find rather odd, and if anyone knows of a better way, then please let me know, was the use of "inline" in engine/T2D/t2dUtility.cc was breaking the final link.

I was getting errors such as:

/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
mSwap(float&, float&)
collect2: ld returned 1 exit status

The mSwap is an inline function inside t2dUtility.cc. I went in and removed all "inline" phrases and rebuilt. Everything worked. The T2D example also comes up nicely.

Now to play...
#21
11/27/2005 (10:37 am)
Cool, thanks.
Getting closer!
/usr/bin/ld: table of contents for archive: ../lib/vorbis/macosx/libogg.a is out of date; rerun ranlib(1) (can't load from it)
/usr/bin/ld: table of contents for archive: ../lib/vorbis/macosx/libvorbis.a is out of date; rerun ranlib(1) (can't load from it)
/usr/bin/ld: warning prebinding disabled because dependent library: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices can't be searched
collect2: ld returned 1 exit status
...failed StandaloneExecutable.LinkUsingFileList /Users/max/Desktop/GarageGames Stuff/T2D Stuff/ALPHA_T2D-SDK_1-1/pb/build/Development/T2D-Debug-OSX.app/Contents/MacOS/T2D-Debug-OSX ...
#22
11/27/2005 (11:22 am)
This is a classic TGE/T2D error (of sorts). Go into lib/vorbis/macosx and run:

ranlib *.a

Then continue the build.
#23
11/27/2005 (11:40 am)
Lol, I can't believe I didn't remember to do that, I've done it quite a few times before.
Thanks
#24
11/27/2005 (12:14 pm)
Ok, I think we're almost there!
yey!
/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
Resource<GFont>::_lock()
Resource<GFont>::unlock()
GameConnection::CurrentProtocolVersion
GameConnection::MinRequiredProtocolVersion
Resource<GFont>::_unlock()
T2DDatablockDropDownCtrl::setFilter(char const*)
T2DDatablockDropDownCtrl::T2DDatablockDropDownCtrl()
Resource<AudioBuffer>::_lock()
Resource<AudioBuffer>::purge()
Resource<AudioBuffer>::unlock()
Resource<AudioBuffer>::_unlock()
mGetT2DRandomF(float, float)
mGreaterThanOrEqual(float const&, float const&)
mSwap(float&, float&)
mNotZero(float const&)
mGetMinMax(float const&, float const&, float&, float&)
mLessThanZero(float const&)
mGreaterThanZero(float const&)
mLessThanOrEqual(float const&, float const&)
mIsOne(float const&)
collect2: ld returned 1 exit status
...failed StandaloneExecutable.LinkUsingFileList /Users/max/Desktop/GarageGames_Stuff/T2D_Stuff/ALPHA_T2D-SDK_1-1/pb/build/Development/T2D-Debug-OSX.app/Contents/MacOS/T2D-Debug-OSX ...
Thanks again Scott!
#25
11/27/2005 (1:54 pm)
Ah, well, you see all those functions that begin with an "m"? Read the very top of this post. Remove all "inline"s from t2dUtility.cc.

As far as the others, I'm not too sure. I don't recall getting those. Try doing a clean build and see if the errors are any different (after modifying the t2dUtility.cc, that is).

---

Oh, now I remember about the GameConnection errors... Remove the gameConnection.cc from Xcode, then add it back in to both binaries. It's currently not set properly.
#26
11/28/2005 (3:35 pm)
Bob, how's the progress? Any more errors?
#27
11/28/2005 (5:29 pm)
Yep, I'm getting that too.
Thanks a ton!
#28
11/28/2005 (5:36 pm)
All works fine now

made a mistake and deleted all lines with inline instead of just the words inline!

thanks Scott

looking to port my game now...
#29
11/28/2005 (5:38 pm)
Haha, that's what I did, lol!
Off to fix it now.
#30
11/28/2005 (5:52 pm)
Ok, now I'm getting this:
/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
Resource<GFont>::_lock()
Resource<GFont>::unlock()
Resource<GFont>::_unlock()
T2DDatablockDropDownCtrl::setFilter(char const*)
T2DDatablockDropDownCtrl::T2DDatablockDropDownCtrl()
Resource<AudioBuffer>::_lock()
Resource<AudioBuffer>::purge()
Resource<AudioBuffer>::unlock()
Resource<AudioBuffer>::_unlock()
collect2: ld returned 1 exit status
...failed StandaloneExecutable.LinkUsingFileList /Users/max/Desktop/GarageGames_Stuff/T2D_Stuff/ALPHA_T2D-SDK_1-1/pb/build/Development/T2D-Debug-OSX.app/Contents/MacOS/T2D-Debug-OSX ...
#31
11/28/2005 (8:44 pm)
Those are coming from resManager.cc and .h. Check over those files against the ones you downloaded and make sure nothing, other than the changes I suggested, was modified.

The T2DDatablockDropDownCtrl is because engine/T2D/sceneedit/gui2DDatablockDropDown.cc is missing from the project.

Add it to Xcode and apply to both targets.

Not too sure about the Resource ones.
#32
12/01/2005 (7:34 pm)
I was trying to get my copy to work (great work documenting the whole process guys) until I got to this step...

Quote:
This is a classic TGE/T2D error (of sorts). Go into lib/vorbis/macosx and run:

ranlib *.a

I have no idea how to do this. Could you maybe spell this out a little better? Thanks!

-Peter
#33
12/01/2005 (8:59 pm)
Certainly. The compilation process creates a set of vorbis libraries which, immediately after compile, may not be linked against.

One must first run "ranlib". So, the lengthy description of a simple problem is this:

1. Open a Terminal.
2. cd into lib/vorbis/macosx
(this is relative to the root of the engine's location. For me, I usually drop it into my
home directory. So, inside Terminal, I'd type: cd ~/projects/torque/t2d_11a1/lib/vorbis/macosx )
3. Enter "ranlib *.a" in Terminal. This will run "ranlib" on both of the ".a" files in there.

After this is done (a second or two of running ranlib), hit Build (CMD-B) in Xcode to complete the build. If everything goes properly, then it should say it succeeded.

Am I leaving this out? If so, I apologize. I come from a UNIX/Linux background, where everyone I spoke to inherently knew the development tools without having to explain them.
#34
12/02/2005 (10:07 am)
Okay. Thanks for breaking that down. I got it! Then I added the file gameconnection and now I'm left with this:

/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
Resource<GFont>::_lock()
Resource<GFont>::unlock()
Resource<GFont>::_unlock()
Resource<AudioBuffer>::_lock()
Resource<AudioBuffer>::purge()
Resource<AudioBuffer>::unlock()
Resource<AudioBuffer>::_unlock()
collect2: ld returned 1 exit status
...failed StandaloneExecutable.LinkUsingFileList /Users/peterrobinson/Desktop/ALPHA_T2D-SDK_1-1/pb/build/T2D-Debug-OSX.app/Contents/MacOS/T2D-Debug-OSX ...

So where do I go from here? Did Bob ever get this working? I'm gonna guess that I need to add another file to the project.

-Peter
#35
12/02/2005 (7:07 pm)
Ok. Really Stupid Question Time (tm).

What version of Mac OS are you runing?

What version of GCC do you have?

Try removing the "inline" from the "inline void" declarations on lines 269, 260, 252 and 275.

If you still get some errors, clean the build and try again once more.
#36
12/02/2005 (7:10 pm)
I'm running 10.4.3

GCC?

I already removed a bunch of "inlines". Which file are we talking about?

-Peter
#37
12/02/2005 (7:50 pm)
Oh, I'm sorry I didn't say which file. resManager.h

GCC is the compiler on the Mac. If you type "gcc -v" in Terminal, you get the version. Since you said you're running 10.4.3, then you have gcc 4.0.

I find it very odd that you're getting these errors and I am not.
#38
12/06/2005 (3:42 pm)
Well I had to go all the way through this post again but I'm happy to announce that it works! Thanks Scott!

-Peter
#39
12/06/2005 (6:21 pm)
Excellent news! I'm glad it worked for you!
#40
12/06/2005 (9:08 pm)
I got the program compiling but I still need to get it working. In particular I can't save tilemaps (amoung other things). So I checked the console and found some errors that look something like this.

Loading compiled script common/ui/SaveFileDlg.gui.
common/ui/SaveFileDlg.gui  (0): Unable to instantiate non-conobject class GuiDirectoryTreeCtrl.
common/ui/SaveFileDlg.gui  (0): Unable to instantiate non-conobject class GuiDirectoryFileListCtrl.

With a little checking I found that GuiDirectoryTreeCtrl and GuiDirectoryFileListCtrl aren't added to the xcode project. So I add them and compile. And I get... Undefined symbols.

/usr/bin/ld: Undefined symbols:
Platform::hasSubDirectory(char const*)
collect2: ld returned 1 exit status

So I'm going to assume something needs to be fixed in these files. But I'm not sure what. Any ideas?

-Peter