Mac Link errors - zLib
by Andy Schatz · in Torque Game Engine · 11/08/2005 (3:56 pm) · 4 replies
I posted this in the Getting Started forums, but I got no response, so I'm reposting here in the Mac forums with a little more detail (mods feel free to delete the earlier post).
Currently, the Mac build of Wildlife Tycoon fails in the linking stage. It appears to not be linking with zlib properly.
I followed the directions in the resource regarding "ranlib", which solved the problem mentioned in that thread. This is NOT that issue.
Here is the error I get:
ld: warning prebinding disabled because of undefined symbols
ld: Undefined symbols:
_z_inflate
_z_inflateEnd
_z_inflateInit_
_z_inflateReset
I am using OSX, XCode 2.0, GCC 3.3, Torque 1.3 with RTS Starter Kit, SGLighting, and a couple other resources. I havent edited zlib at all, so I don't know what's going on.
It appears functions elsewhere in zlib are linking properly, the above functions are defined in inflate.c.
This seemingly similar post got fixed (it's pretty much the same error) though the poster doesn't remember what he did to fix it.
Thanks for any help you can offer!
Currently, the Mac build of Wildlife Tycoon fails in the linking stage. It appears to not be linking with zlib properly.
I followed the directions in the resource regarding "ranlib", which solved the problem mentioned in that thread. This is NOT that issue.
Here is the error I get:
ld: warning prebinding disabled because of undefined symbols
ld: Undefined symbols:
_z_inflate
_z_inflateEnd
_z_inflateInit_
_z_inflateReset
I am using OSX, XCode 2.0, GCC 3.3, Torque 1.3 with RTS Starter Kit, SGLighting, and a couple other resources. I havent edited zlib at all, so I don't know what's going on.
It appears functions elsewhere in zlib are linking properly, the above functions are defined in inflate.c.
This seemingly similar post got fixed (it's pretty much the same error) though the poster doesn't remember what he did to fix it.
Thanks for any help you can offer!
#2
It looks like you have Z_PREFIX defined somewhere, probably in macCarb_common_prefix.h . TGE 1.3 used to define it there. Defining Z_PREFIX prepends "z__" to all the zlib symbols.
The problem is this: most all of TGE uses macCarb_common_prefix.h, but zlib does not. So some TGE files get munged zlib function names, but no functions with those munged names are ever created, because zlib didn't get the message.
Also, MacOSX has always shipped with zlib. So using a custom local zlib is not necessary. You can remove the zlib files from your xcode project file, and add "-lz" to the linker flags.
So, the solution is twofold:
1. Make sure Z_PREFIX is not defined anywhere.
2. Remove the zlib files from your Xcode project, and add "-lz" to each target's linker flags.
This is already fixed in 1.4.
Share and Enjoy,
/Paul
11/14/2005 (11:26 pm)
@Andy,It looks like you have Z_PREFIX defined somewhere, probably in macCarb_common_prefix.h . TGE 1.3 used to define it there. Defining Z_PREFIX prepends "z__" to all the zlib symbols.
The problem is this: most all of TGE uses macCarb_common_prefix.h, but zlib does not. So some TGE files get munged zlib function names, but no functions with those munged names are ever created, because zlib didn't get the message.
Also, MacOSX has always shipped with zlib. So using a custom local zlib is not necessary. You can remove the zlib files from your xcode project file, and add "-lz" to the linker flags.
So, the solution is twofold:
1. Make sure Z_PREFIX is not defined anywhere.
2. Remove the zlib files from your Xcode project, and add "-lz" to each target's linker flags.
This is already fixed in 1.4.
Share and Enjoy,
/Paul
#3
http://ftp.man.poznan.pl/pub/mozilla/security/nss/sonmi/Linux2.4_x86_glibc_PTH_OPT.OBJ/include/zconf.h
But your right Paul, best thing to do is using OSX's zlib! I will try that tonight.
Thanks for the info!
11/15/2005 (12:26 am)
I compiled with -DZ_PREFIX (as mentioned in commentaries in zconf.h)http://ftp.man.poznan.pl/pub/mozilla/security/nss/sonmi/Linux2.4_x86_glibc_PTH_OPT.OBJ/include/zconf.h
But your right Paul, best thing to do is using OSX's zlib! I will try that tonight.
Thanks for the info!
#4
11/15/2005 (12:30 am)
Thanks Paul- Mathieu is working on the Mac port now... *phew* This would have taken me quite a while to figure out.
Torque Owner Brian Richardson
Different library, but maybe the linking "CoreServices and libz" in will fix it?
Odd, I just talked to Mark Grob today.
Shrimp, plate of shrimp? (10 points to anyone that gets that reference!)