Undefined References

Member
Posts: 35
Joined: 2005.01
Post: #1
Today my project decided to not work anymore. It was working fine last night but now it doesn't seem to work right. My dad did a system update last night and the power went out when installing but it says that the update installed sucessfuly. We can't do a system restore because the only backup we have is of his account and not of the computer so that won't help. Heres the output I get while trying to compile and link. It compiles fine but won't link.

Code:
StandaloneExecutable /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.app/Contents/MacOS/Enginuity_Engine

StandaloneExecutable.LinkUsingFileList /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.app/Contents/MacOS/Enginuity_Engine
    /usr/bin/g++-3.3  -o /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.app/Contents/MacOS/Enginuity_Engine  "-L/Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build" "-L/Users/curtiscollins/Desktop/Programming/Enginuity_Engine" "-L/Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build"  "-F/Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build" "-F/Library/Frameworks"  -filelist /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.build/Enginuity_Engine.build/Objects-normal/LinkFileList  "-arch" "ppc" "-prebind" "-Wl,-no_arch_warnings"   "-framework" "Cocoa" "-framework" "OpenGL" "-framework" "SDL" "-lftgl" "-lfreetype"
ld: /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.build/Enginuity_Engine.build/Objects-normal/ppc/CMap.o illegal reference to symbol: std::_Rb_tree_rotate_left(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&) defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib
ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different symbols being used
symbol _acosl used from dynamic library /usr/lib/libstdc++.6.dylib(single module) not from earlier dynamic library /usr/lib/libSystem.B.dylib(ld64.o)
It repeats for other symbols as well. I was editing the project but as soon as I tried to run it would not link. I tried this with other projects as well that I only do a clean and build and they will not link either. Does anyone know why all of a sudden it won't work?

Thanks,
vbuser
Quote this message in a reply
Member
Posts: 35
Joined: 2005.01
Post: #2
Ok I found out how to add libstdc++.6.dylib manualy by pressing shift-control-g in the finder to get into that directory but then I get multiple definitions of lots of std things. Does anyone know why I am getting I am getting these errors without libstdc++6.dylib and the application services framework?
Code:
StandaloneExecutable.LinkUsingFileList /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.app/Contents/MacOS/Enginuity_Engine
    /usr/bin/g++-3.3  -o /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.app/Contents/MacOS/Enginuity_Engine  "-L/Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build" "-L/usr/lib/"  "-F/Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build" "-F/usr/lib/" "-F/Library/Frameworks" "-F/Developer/SDKs/MacOSX10.3.0.sdk/System/Library/Frameworks"  -filelist /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.build/Enginuity_Engine.build/Objects-normal/LinkFileList  "-arch" "ppc" "-Wl,-no_arch_warnings"   "-framework" "Cocoa" "-framework" "OpenGL" "-framework" "SDL" "-lftgl" "-lfreetype" "-lstdc++"
ld: /Users/curtiscollins/Desktop/Programming/Enginuity_Engine/build/Enginuity_Engine.build/Enginuity_Engine.build/Objects-normal/ppc/CMap.o illegal reference to symbol: std::_Rb_tree_rotate_left(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&) defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib
ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different symbols being used
symbol _acosl used from dynamic library /usr/lib/libstdc++.6.dylib(single module) not from earlier dynamic library /usr/lib/libSystem.B.dylib(ld64.o)

Thanks,
vbuser
Quote this message in a reply
mnajera
Unregistered
 
Post: #3
The same thing is happening with me and *all* of my programs. Everything compiles fine, but I am getting all kinds of strage linker errors. It all happened right after I completed the latest software update.

I am running OS X 10.3.9 and Xcode 1.5. Are you running the same? It seems likely that this latest update has somehow broken the compiler.

I was putting it off, but this weekend I am going to backup my computer, buy 10.4 at the local mac store, get set up with xcode 2.0 and try to compile all of my programs again.
Quote this message in a reply
mnajera
Unregistered
 
Post: #4
Ok. Yesterday I went to the mall and got 10.4.3, installed and updated everything (although I am still at xcode 2.1), and STILL my projects didn't compile!

On just about everything I got "undefined symbols" errors. Strangely enough, I was able to fix the problem by taking all of my source files and placing them into a SINGLE folder. When I had my files organized in nice folders like "graphics", "script" and "audio", the linker couldn't seem to find anything.

I am still able to create "groups" in xcode, but as soon as I try to put my source in folders again it gives me those errors.
Quote this message in a reply
boosted_sled
Unregistered
 
Post: #5
hey, any updates on this problem? I upgraded to 10.3.9 and it looks like it broke the linker. I'm getting the following messages from code that previously linked.


g++ -g -Wall -L/usr/local/lib -arch ppc -framework OpenGL -framework Cocoa -framework Carbon -framework SDL -framework SDL_image -pipe -o ../../src/client/main ../../src/client/../common/vectMath.o ../../src/client/ObjectPath.o ../../src/client/PGroup.o ../../src/client/AppEventHandler.o ../../src/client/CommandsToServer.o ../../src/client/UIWidgets.o ../../src/client/Layout.o ../../src/client/CameraWidget.o ../../src/client/Camera.o ../../src/client/Marker.o ../../src/client/GameTimer.o ../../src/client/PObjectStructs.o ../../src/client/NetworkStatusWidget.o ../../src/client/Player.o ../../src/client/main.o ../../src/client/ClientSDLGGApp.o ../../src/client/AppGraphics.o ../../src/client/AppInitializer.o ../../src/client/AppSelection.o ../../src/client/NetworkConnection.o ../../src/client/mixer.o ../../src/client/PObject.o ../../src/client/PCompositeObject.o ../../src/client/globals.o ../../src/client/Planet.o ../../src/client/ThingContainer.o ../../src/client/Commands.o ../../src/client/SDLMain.o -lfmod -lobjc -llua -llualib -largtable2 -lGiGi -lGiGiSDL -llog4cpp -lGiGiNet

ld: ../../src/client/Marker.o illegal reference to symbol: std::_Rb_tree_rotate_left(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&) defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib
...failed Link ../../src/client/main...
...failed updating 1 target...
...updated 5 targets...

Compilation exited abnormally with code 1 at Tue Jan 31 21:24:55
Quote this message in a reply
boosted_sled
Unregistered
 
Post: #6
Also, I am not using the Xcode IDE but Aquamacs/ECB/jam
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
try cleaning your project. You can't mix C++ code built with GCC 4.x with C++ code build with GCC 3.x.
Quote this message in a reply
boosted_sled
Unregistered
 
Post: #8
OneSadCookie - I cleaned and rebuilt to no avail. My gcc is still version 3.3 20030304 (Apple Computer, Inc. build 1666) after the 10.3.9 software update. Did I end up with frameworks built with GCC 4.x from the software update? Are there additional steps to get all the tools up to date through Xcode? Thanks for the help.
Quote this message in a reply
boosted_sled
Unregistered
 
Post: #9
From CppRuntimeEnv.pdf on the apple site:

In versions of Mac OS X prior to version 10.3.9, the standard C++ library is packaged as the static archive file libstdc++.a. Beginning with Mac OS X version 10.3.9, the standard C++ library is packaged as the dynamic shared library libstdc++.dylib. The change in packaging brings the C++ runtime in line with the C runtime, which has always been packaged as part of the dynamic shared library libSystem.dylib. Note: To build programs that link to libstdc++.dylib, you must have GCC 4.0, which is provided with the Xcode Tools in Mac OS X 10.4. You use this compiler along with the SDKs provided by Apple to build your binary for 10.3.9. For more information, see “Deploying Applications Using libstdc++.dylib” (page 9).

Three words

World of Pain

It looks like 10.3.9 is stranded as a development version??? Do I need to install gcc 4.0.1 from tarball to try and get my tools environment working again? Since I'm not using Xcode, maybe I can get away with installed the 2.2 SDK to get the base tools installed properly...

I'm not sure which is going to be worse, downgrading back to 10.3.4 or whatever I had or trying to make this work on 10.3.9. Arrgghh.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
10.3.9 should still be fine as a dev env -- there are plenty of people still managing to use it.

Since you're using GCC 3.3, you should *not* have to link libstdc++.dylib. If you are having to, it's because you've got some already-built C++ code sitting around.
Quote this message in a reply
boosted_sled
Unregistered
 
Post: #11
Well I have fmod, lua, lualib, argtable2, GiGi, GiGiSDL, log4cpp and GiGiNet as libraries, but these existed prior to the 10.3.9 upgrade and should all be built with the statically linked libc++. I am also using SDL and SDL_image frameworks but these didn't get upgraded either. The objc library and OpenGL, Cocoa, and Carbon frameworks would seem to be the candidates for now using the dynamic library. My understanding of how linkers behave when you have dynamic and static versions of the same library present is poor, but I know that this generally leads to all sorts of redefinition pain at link time, which is different than what I'm seeing.

I tried to add -lstdc++ and hid the dynamic library but this of course didn't work.

10.3.9 did something evil to my build enviroment, which is, admittedly, a bit of a hack job, but as others aren't having problems it would be nice to understand the root cause.

I'll give it a bit more investigation before I try and go back to 10.3.7 from CD, which, given Murphy's Law, will probably corrupt my OS and force a HD reformatSad
Quote this message in a reply
boosted_sled
Unregistered
 
Post: #12
OK, one more post on this and I'll stop wasting disk space.

When I hide the 10.3.9-installed libstdc++.6.dylib, add -lstdc++ and fire up the linker it gets through my source then fails as follows:

ld: warning can't open dynamic library: /usr/lib/libstdc++.6.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
ld: Undefined symbols:
_HICopyAccessibilityActionDescription referenced from QuickTime expected to be defined in Carbon
_HICopyAccessibilityRoleDescription referenced from QuickTime expected to be defined in Carbon
_LLCStyleInfoCheckForOpenTypeTables referenced from QuickTime expected to be defined in ApplicationServices
_LLCStyleInfoGetUserRunFeatures referenced from QuickTime expected to be defined in ApplicationServices
std::__throw_bad_alloc() referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
std::_Rb_tree_decrement(std::_Rb_tree_node_base*) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
std::_Rb_tree_increment(std::_Rb_tree_node_base*) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
std::__throw_length_error(char const*) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
operator delete(void*) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
operator new(unsigned long) referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
___cxa_pure_virtual referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
___eprintf referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
___gxx_personality_v0 referenced from QuickTime expected to be defined in /usr/lib/libstdc++.6.dylib
...failed Link ../../src/client/main...
...failed updating 1 target...

So maybe Carbon and ApplicationServices are the problem.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #13
That does indeed look like your QuickTime framework is incompatible with your Carbon and ApplicationServices frameworks. The libstdc++ errors from QuickTime are probably nothing to worry about.
Quote this message in a reply
Dingo
Unregistered
 
Post: #14
I started having problems similar to yours recently too. I think I fixed it. I'm using Xcode 1.5 and OS 10.3.9.

I'm not sure if this will work for you..

All I ended up doing was changin "Cross-Develop Using Target SDK" to 10.2.8. This SDK isn't installed by default but it is on the Xcode 1.5 disk image. I also tried using the 10.3 SDK and this worked as well.

Took me forever to figure this out.. mainly because I didn't have the SDK already installed. So hopefully that will work for some of you too.

James Sayer
Dingo Games
http://www.dingogames.com/
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help with undefined symbols error with Univeral app running under 10.3.9 dmdmdm 0 2,205 May 29, 2009 01:16 PM
Last Post: dmdmdm
  Need help with undefined symbols error with Univeral app running under 10.3.9 Malarkey 1 3,147 Nov 12, 2006 12:23 PM
Last Post: OneSadCookie
  'Undefined Symbols' problem with Xcode 2.3. Any ideas, please!! scratt 6 5,901 Jun 11, 2006 10:19 AM
Last Post: scratt
  "Undefined Symbols" error in XCode using SDL Lunatic 3 3,992 Aug 31, 2005 07:51 PM
Last Post: Lunatic
  SDL game porting trouble: undefined symbols destructive cactus 6 5,543 Jul 28, 2005 04:29 PM
Last Post: destructive cactus