Re: Proper way to link to libxml and zlib
Re: Proper way to link to libxml and zlib
- Subject: Re: Proper way to link to libxml and zlib
- From: Fritz Anderson <email@hidden>
- Date: Thu, 2 Jun 2005 13:39:28 -0500
On 2 Jun 2005, at 1:08 PM, Tim Conkling wrote:
I'm using libxml and zlib in my program. When I compile and run the
program with ZeroLink enabled, everything works fine. When I
compile with ZeroLink disabled, I get a bunch of undefined symbols
at link time for both libraries. I searched my computer for files
containing the word "libxml" in them, and came up with
libxml2.2.dylib, which is in the MacOSX10.4.0.sdk directory in /
Developer/. I added this file to my project and put in the Link
Binary With Libraries build phase, and eliminated all the libxml-
related undefined symbol errors. I couldn't, however, find a
similar zlib library to link my program with.
I have a couple questions:
First, am I linking with libxml correctly? I suspect the answer is
no, since this dylib only exists in the Developer directory, and
doesn't seem to be included with Mac OS X itself.
Second, what do I need to do to make zlib work?
The reason the errors appeared only after you turned ZeroLink off is
that ZeroLink puts off all linkage tasks until it's time to load a
symbol -- this includes checking whether the symbol exists at all. So
the problem was there, but ZeroLink masked it.
When I type
locate libxml
in the Terminal, I get a long list that includes /usr/lib/
libxml2.2.dylib, and /usr/lib/libxml2.dylib (a symbolic link to the
2.2 version, but if you use that name, you'll get whatever's
current). Are those files not present on your system?
Remember that libraries are constrained in their names to begin with
"lib" and end with ".a" or ".dylib".
locate libz
turns up a number of possibilities, including a /usr/lib/libz.dylib.
nm /usr/lib/libz.dylib
shows the file contains entry points with names like "inflate" and
"deflate," suggesting that this is what you're looking for.
-- F
--
Fritz Anderson
Consulting Programmer
http://resume.manoverboard.org/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden