[DB-SIG] gcc -lc flag

Matthew T. Kromer matt@zope.com
Mon, 27 Aug 2001 15:58:35 -0400


ian@mulvany.net wrote:

>Hello,
>
>When I try to build MySQLdb.py hte 
>build falls over at the following point:
>
>$ python setup.py build
>
>gcc -shared build/temp.linux-i686-2.0/_mysqlmodule.o -L/usr/lib/mysql -lmysqlclient -lz -o build/lib.linux-i686-2.0/_mysql.so
>/usr/bin/ld: cannot find -lz
>collect2: ld returned 1 exit status
>error: command 'gcc' failed with exit status 1
>
>If I omit the '-lz' flag I can build and install 
>but when I attempt to import MySQLdb I get the following:
>
># python setup.py install
>
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File "/usr/lib/python2.0/site-packages/MySQLdb.py", line 19, in ?
>    import _mysql
>ImportError: /usr/lib/python2.0/site-packages/_mysql.so: undefined symbol: uncompress
>
>it's obvious that the -lz flag has something to do with 
>the problem, but i am unfamiliar with the flag. 
>
>Could anyone explain what the flag does and how I can get gcc to accept it or how I can get around the problem at all? 
>
>many thanks,
>
>-Ian 
>
Ian, the -lz flag specifes that zlib is to be linked into the result. If 
you don't have the zlib RPM installed (I cant tell which distribution 
you are using) you can build zlib yourself.  You should be able to pick 
up zlib from www.zlib.org.  Compile and install and you should be able 
to link MySQLdb.