Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > mySQL c API

mySQL c API
Thread Tools
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Germany
Status: Offline
Reply With Quote
Jun 6, 2001, 04:12 AM
 
Hi!

I would like to link an object file which uses the mySQL c API in OS X, but I get the following result:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
& cc -c -I/usr/local/include/mysql main.c
& cc -o myThorcli main.o -L/usr/local/lib/mysql -lmysqlclient -lm
/usr/bin/ld: Undefined symbols:
_compress
_uncompress
</font>[/code]

This should work on linux and other unices, it's from a book. I don't find a way around this problem. Any ideas?

Stefan
Phure (aka BlackMac.de)
He who knows does not talk - He who talks does not know!
     
Mac Elite
Join Date: Jun 2001
Location: Dundee, Scotland
Status: Offline
Reply With Quote
Jun 8, 2001, 08:18 AM
 
I had exactly the same problem. After a lot of banging my head againsed a wall I discovered that you need to link it to zlib.
You need to install and lizlib library - then you compile your client with:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>cc -o progname progname.c -L/usr/local/lib/mysql -lmysqlclient -lz </font>[/code]

There are a few places to get zlib for OSX. I'll see if I can find one for you. The best place for this kind of stuff is the darwin sites.
     
Mac Elite
Join Date: Jun 2001
Location: Dundee, Scotland
Status: Offline
Reply With Quote
Jun 8, 2001, 08:29 AM
 
You'll find zlib here

http://port.mosxsw.com/port/zlib/

straight from the site:

zlib 1.1.3 binary for Mac OS X

zlib is a free compression library; it provides compression capabilities to other programs like libpng. The master zlib site is http://www.info-zip.org/pub/infozip/zlib/. zlib appears to be already present in Mac OS X PB, but libpng isn't satisfied with that version, so I built the standard version. To use my binary version, download zlib-1.1.3-macosx.tgz (don't bother uncompressing it with StuffIt), open Terminal and:

1. cd directory containing zlib-1.1.3-mosx.tgz
2. su
3. enter your root password
4. tar xzf zlib-1.1.3-mosx.tgz
5. cd zlib-1.1.3-mosx
6. ./install.sh
7. exit

The offical generic version of zlib compiles as-is under Mac OS X (if you have the software build tools). make and make install should install /usr/local/lib/libz.a and the headers.

------------------------------------------------------------------------

cheers,
sam.
     
Fresh-Faced Recruit
Join Date: Dec 2000
Status: Offline
Reply With Quote
Jun 8, 2001, 11:40 AM
 
Originally posted by sambeau:
<STRONG>You'll find zlib here

http://port.mosxsw.com/port/zlib/

straight from the site:

zlib 1.1.3 binary for Mac OS X

zlib is a free compression library; ...</STRONG>
Actually, zlib is already installed on Mac OS X out of the box. zlib.h is present in the Kernel framework. The Perl module Compress::Zlib uses it.

Embarrassingly enough, I don't know where the library is in the system frameworks directories. It links fine from Perl.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jun 9, 2001, 03:59 AM
 
Originally posted by bobDalgleish:
<STRONG>Actually, zlib is already installed on Mac OS X out of the box. zlib.h is present in the Kernel framework. The Perl module Compress::Zlib uses it.

Embarrassingly enough, I don't know where the library is in the system frameworks directories. It links fine from Perl.
</STRONG>
It's in /usr/lib, methinks.
     
Phure  (op)
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Germany
Status: Offline
Reply With Quote
Jun 9, 2001, 09:36 AM
 
Thank you, you guys are really great.
Phure (aka BlackMac.de)
He who knows does not talk - He who talks does not know!
     
Mac Elite
Join Date: Jun 2001
Location: Dundee, Scotland
Status: Offline
Reply With Quote
Jun 12, 2001, 10:13 AM
 
Funny that. I can definitely remember installing zlib to get gd working at some point. Was it in the public beta?

Talking of gd has anyone managed to get freetype working with it -- I've been banging my head against another brick wall all day.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2